Skip to content

Commit 8b424ca

Browse files
committed
add check for RSA HostKey
Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>
1 parent 880a01d commit 8b424ca

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

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 if RSA HostKey size >= 4096'
528+
only_if('RSA HostKey exists') do
529+
file("#{sshd_custom_hostkeys_path}/ssh_host_rsa_key").exists?
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)