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(5.2.2): ensured correct host key permissions are checked on RedHa… #102

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
15 changes: 8 additions & 7 deletions controls/5_2_ssh_server_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,16 @@
tag cis: 'distribution-independent-linux:5.2.2'
tag level: 1

expected_gid = 0
expected_gid = 995 if os.redhat?

expected_perms = '0600'
expected_perms = '0640' if os.redhat?

command('find /etc/ssh -xdev -type f -name "ssh_host_*_key"').stdout.split.each do |f|
describe file(f) do
it { should_not be_readable.by 'group' }
it { should_not be_writable.by 'group' }
it { should_not be_executable.by 'group' }
it { should_not be_readable.by 'other' }
it { should_not be_writable.by 'other' }
it { should_not be_executable.by 'other' }
its('gid') { should cmp 0 }
it { should_not be_more_permissive_than(expected_perms) }
its('gid') { should cmp expected_gid }
its('uid') { should cmp 0 }
end
end
Expand Down