Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix SUID/SGID bit cleaning API spelling #72

Merged
merged 3 commits into from
Jan 28, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions COMPLIANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ See reference documentation [here](http://www.telekom.com/static/-/155996/7/tech

#### 3.21 Unix Requirements v1.2

| Requirement | Configuration |
|-------------|----------------------------------------------------------|
| 6 | active by default |
| 9 | active by default |
| 11 | active by default |
| 10 | active by default |
| 14 | `['security']['suid_sgid']['remove_from_unkown'] = true` |
| 16 | active by default |
| 17 | active by default |
| Requirement | Configuration |
|-------------|-----------------------------------------------------------|
| 6 | active by default |
| 9 | active by default |
| 11 | active by default |
| 10 | active by default |
| 14 | `['security']['suid_sgid']['remove_from_unknown'] = true` |
| 16 | active by default |
| 17 | active by default |

#### 3.01 Technical Baseline Security for IT/NT Systems

Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,11 @@ We deprecated `sysctl` version before `0.6.0`. Future versions of this cookbook
a list of paths which should have their SUID/SGID bits removed
* `['security']['suid_sgid']['whitelist'] = []`
a list of paths which should not have their SUID/SGID bits altered
* `['security']['suid_sgid']['remove_from_unkown'] = false`
* `['security']['suid_sgid']['remove_from_unknown'] = false`
true if you want to remove SUID/SGID bits from any file, that is not explicitly configured in a `blacklist`. This will make every Chef run search through the mounted filesystems looking for SUID/SGID bits that are not configured in the default and user blacklist. If it finds an SUID/SGID bit, it will be removed, unless this file is in your `whitelist`.
* `['security']['suid_sgid']['dry_run_on_unkown'] = false`
like `remove_from_unknown` above, only that SUID/SGID bits aren't removed. It will still search the filesystems to look for SUID/SGID bits but it will only print them in your log. This option is only ever recommended, when you first configure `remove_from_unkown` for SUID/SGID bits, so that you can see the files that are being changed and make adjustments to your `whitelist` and `blacklist`.
* `['security']['suid_sgid']['dry_run_on_unknown'] = false`
like `remove_from_unknown` above, only that SUID/SGID bits aren't removed.
It will still search the filesystems to look for SUID/SGID bits but it will only print them in your log. This option is only ever recommended, when you first configure `remove_from_unknown` for SUID/SGID bits, so that you can see the files that are being changed and make adjustments to your `whitelist` and `blacklist`.
* `['security']['packages']['clean'] = true`
removes packages with known issues. See section packages.

Expand Down
2 changes: 1 addition & 1 deletion TUTORIAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ EOF
cat > solo.json <<EOF
{
"security" : {"suid_sgid": {
"remove_from_unkown" : true,
"remove_from_unknown" : true,
"system_whitelist" : []
}
},
Expand Down
4 changes: 2 additions & 2 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@
default['security']['suid_sgid']['whitelist'] = []
# if this is true, remove any suid/sgid bits from files that were not in the
# whitelist
default['security']['suid_sgid']['remove_from_unkown'] = false
default['security']['suid_sgid']['dry_run_on_unkown'] = false
default['security']['suid_sgid']['remove_from_unknown'] = false
default['security']['suid_sgid']['dry_run_on_unknown'] = false

# remove packages with known issues
default['security']['packages']['clean'] = true
Expand Down
2 changes: 1 addition & 1 deletion libraries/suid_sgid.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def self.remove_suid_sgid_from_blacklist(blacklist)
end
end

def self.remove_suid_sgid_from_unkown(whitelist = [], root = '/', dry_run = false)
def self.remove_suid_sgid_from_unknown(whitelist = [], root = '/', dry_run = false)
all_suid_sgid_files = find_all_suid_sgid_files(root).select do|file|
in_whitelist = whitelist.include?(file)
Chef::Log.info "suid_sgid: Whitelisted file '#{file}', not altering SUID/SGID bit" if in_whitelist && !dry_run
Expand Down
11 changes: 6 additions & 5 deletions recipes/suid_sgid.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
whitelist = (sw - b + w).uniq

# root = "/"
dry_run = node['security']['suid_sgid']['dry_run_on_unkown']
dry_run = node['security']['suid_sgid']['dry_run_on_unknown']
root = node['env']['root_path']

# walk the blacklist and remove suid and sgid bits from these items
Expand All @@ -39,9 +39,10 @@
end
end

# remove suid bits from unkown, if desired
ruby_block 'remove_suid_from_unkown' do
# remove suid bits from unknown, if desired
ruby_block 'remove_suid_from_unknown' do
block do
SuidSgid.remove_suid_sgid_from_unkown(whitelist, root, dry_run)
SuidSgid.remove_suid_sgid_from_unknown(whitelist, root, dry_run)
end
end if node['security']['suid_sgid']['remove_from_unkown'] || node['security']['suid_sgid']['dry_run_on_unkown']
end if node['security']['suid_sgid']['remove_from_unknown'] ||
node['security']['suid_sgid']['dry_run_on_unknown']