Skip to content

Commit 258245c

Browse files
Merge pull request #188 from schurzi/rsa_hostkey
add control for small RSA HostKey
2 parents 880a01d + 0761a51 commit 258245c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

controls/sshd_spec.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,3 +520,18 @@
520520
its('commands.first') { should_not match(/-oHostKeyAlgorithms/) }
521521
end
522522
end
523+
524+
control 'sshd-50' do
525+
impact 1.0
526+
title 'Server: RSA HostKey size'
527+
desc 'Verifies, that RSA HostKey is not smaller than 4096 bit'
528+
only_if('RSA HostKey is readable') do
529+
File.readable?("#{sshd_custom_hostkeys_path}/ssh_host_rsa_key")
530+
end
531+
532+
describe bash("test $(ssh-keygen -l -f #{sshd_custom_hostkeys_path}/ssh_host_rsa_key | awk '$1 < 4096 { print $1 }' | wc -l) -eq 0") do
533+
its('exit_status') { should eq 0 }
534+
its('stdout') { should eq '' }
535+
its('stderr') { should eq '' }
536+
end
537+
end

0 commit comments

Comments
 (0)