Skip to content

Commit bf8bb76

Browse files
UseLogin is deprecated
starting from openssh 7.4 (rhel 7) Fixes #95 Signed-off-by: Artem Sidorenko <[email protected]>
1 parent d5166bc commit bf8bb76

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

controls/ssh_spec.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
command('ssh').exist?
2323
end
2424

25-
ssh_version = command('ssh -V 2>&1 | cut -f1 -d" " | cut -f2 -d"_"').stdout.to_f
26-
2725
control 'ssh-01' do
2826
impact 1.0
2927
title 'client: Check ssh_config owner, group and permissions.'
@@ -156,7 +154,7 @@
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
@@ -166,7 +164,7 @@
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

controls/sshd_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@
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
189189
end
190190

libraries/ssh_crypto.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
class 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'

0 commit comments

Comments
 (0)