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

Check Configuration of password remember #157

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
22 changes: 22 additions & 0 deletions controls/os_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -282,3 +282,25 @@
end
end
end

control 'os-14' do
impact 1.0
title 'Check pam config - RedHat specific'
Copy link
Member

Choose a reason for hiding this comment

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

All controls that we are adding to the base line need to be applicable and tested on all major linux distributions.

Copy link
Author

Choose a reason for hiding this comment

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

Hi @chris-rock,
in dev-sec/ansible-collection-hardening there is currently no configuration of this for other distributions and I am not the Debian master that can create them. So I only change some code in dev-sec/ansible-collection-hardening and create the missing test in this repo.

Copy link
Contributor

Choose a reason for hiding this comment

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

Our code for PAM configuration on any non-RHEL based distribution is severely lacking.
I would propose to open an issue for this and going on with only RHEL support here.

desc 'Check config of files in /etc/pam.d.'

pam_files = ['/etc/pam.d/system-auth', '/etc/pam.d/password-auth']

pam_files.each do |pam_file|
describe file(pam_file) do
it { should exist }
it { should be_owned_by 'root' }
its('group') { should eq 'root' }
its(:content) { should match /^password requisite pam_pwhistory.so remember=60 use_authtok$/ }
Copy link
Member

Choose a reason for hiding this comment

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

This collects 60 passwords. I suggest to go with the CIS default of 5 and make this the default argument for this policy. You can than override the policy with 60 for your needs.

What do you think if we also split this into multiple pieces as CIS DIL 5.3 is doing?

Copy link
Author

Choose a reason for hiding this comment

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

I set the default back to 5

its(:content) { should match /^password requisite pam_pwquality.so try_first_pass retry=3 authtok_type=$/ }
its(:content) { should match /^auth required pam_faillock.so preauth silent audit even_deny_root deny=5 unlock_time=15$/ }
its(:content) { should match /^auth required pam_faillock.so authfail audit even_deny_root deny=5 unlock_time=15$/ }
its(:content) { should match /^account required pam_faillock.so$/ }
end
end
only_if { os.redhat? }
end