File tree Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 2222 command ( 'ssh' ) . exist?
2323end
2424
25- ssh_version = command ( 'ssh -V 2>&1 | cut -f1 -d" " | cut -f2 -d"_"' ) . stdout . to_f
26-
2725control 'ssh-01' do
2826 impact 1.0
2927 title 'client: Check ssh_config owner, group and permissions.'
156154 impact 1.0
157155 title 'Client: Disable rhosts-based authentication'
158156 desc 'Avoid rhosts-based authentication, as it opens more ways for an attacker to enter a system.'
159- only_if { ssh_version < 7.6 }
157+ only_if { ssh_crypto . ssh_version < 7.6 }
160158 describe ssh_config do
161159 its ( 'RhostsRSAAuthentication' ) { should eq ( 'no' ) }
162160 end
166164 impact 1.0
167165 title 'Client: Enable RSA authentication'
168166 desc 'Make sure RSA authentication is used by default.'
169- only_if { ssh_version < 7.6 }
167+ only_if { ssh_crypto . ssh_version < 7.6 }
170168 describe ssh_config do
171169 its ( 'RSAAuthentication' ) { should eq ( 'yes' ) }
172170 end
Original file line number Diff line number Diff line change 184184 title 'Server: Specify UseLogin to NO'
185185 desc 'Disable legacy login mechanism and do not use login for interactive login sessions.'
186186 describe sshd_config do
187- its ( 'UseLogin' ) { should eq ( 'no' ) }
187+ its ( 'UseLogin' ) { should eq ( ssh_crypto . ssh_version < 7.4 ? 'no' : nil ) }
188188 end
189189end
190190
Original file line number Diff line number Diff line change 1919class SshCrypto < Inspec . resource ( 1 ) # rubocop:disable Metrics/ClassLength
2020 name 'ssh_crypto'
2121
22+ def ssh_version
23+ inspec . command ( 'ssh -V 2>&1 | cut -f1 -d" " | cut -f2 -d"_"' ) . stdout . to_f
24+ end
25+
2226 def valid_ciphers # rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength
2327 # define a set of default ciphers
2428 ciphers53 = 'aes256-ctr,aes192-ctr,aes128-ctr'
You can’t perform that action at this time.
0 commit comments