Skip to content

Commit 8ca6e27

Browse files
committed
improve only_if condition
Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>
1 parent 8b424ca commit 8ca6e27

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

controls/sshd_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,8 +525,8 @@
525525
impact 1.0
526526
title 'Server: RSA HostKey size'
527527
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?
528+
only_if('RSA HostKey is readable') do
529+
File.readable?("#{sshd_custom_hostkeys_path}/ssh_host_rsa_key")
530530
end
531531

532532
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

0 commit comments

Comments
 (0)