Skip to content
Open
Show file tree
Hide file tree
Changes from 5 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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ It will not:
* Sander van Zoest sysctl `https://github.com/svanzoest-cookbooks/sysctl`

## Attributes

* `['os-hardening']['yum']['gpg_exclude'] = []` - Array of yum configuration files to exclude from gpgcheck
* `['os-hardening']['components'][COMPONENT_NAME]` - allows the fine control over which components should be executed via default recipe. See below for more details
* `['os-hardening']['desktop']['enable'] = false`
true if this is a desktop system, ie Xorg, KDE/GNOME/Unity/etc
Expand Down
1 change: 1 addition & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
default['os-hardening']['packages']['pam_cracklib'] = 'pam_cracklib'
default['os-hardening']['packages']['pam_pwquality'] = 'libpwquality'
default['os-hardening']['packages']['auditd'] = 'audit'
default['os-hardening']['yum']['gpg_exclude'] = []

if node['platform_version'].to_f < 7
default['os-hardening']['auth']['pam']['passwdqc']['enable'] = true
Expand Down
16 changes: 13 additions & 3 deletions recipes/yum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,25 @@
block do
# TODO: harmonize with latter function
config_file = '/etc/yum.conf'
GPGCheck.check(config_file)
# Only check files not listed in gpg_exclude array
unless node['os-hardening']['yum']['gpg_exclude'].include? config_file
GPGCheck.check(config_file)
end

Dir.glob('/etc/yum.repos.d/*').each do |file|
GPGCheck.check(file)
config_file = '/etc/yum.conf'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need the config_file line here?

# Only check files not listed in gpg_exclude array
unless node['os-hardening']['yum']['gpg_exclude'].include? file
GPGCheck.check(file)
end
end

rhn_conf = '/etc/yum/pluginconf.d/rhnplugin.conf'
File.file?(rhn_conf) do
GPGCheck.check(rhn_conf)
# Only check files not listed in gpg_exclude array
unless node['os-hardening']['yum']['gpg_exclude'].include? rhn_conf
GPGCheck.check(rhn_conf)
end
end
end
action :run
Expand Down