Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UseLogin is deprecated #114

Merged
merged 1 commit into from
Oct 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions controls/ssh_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
command('ssh').exist?
end

ssh_version = command('ssh -V 2>&1 | cut -f1 -d" " | cut -f2 -d"_"').stdout.to_f

control 'ssh-01' do
impact 1.0
title 'client: Check ssh_config owner, group and permissions.'
Expand Down Expand Up @@ -156,7 +154,7 @@
impact 1.0
title 'Client: Disable rhosts-based authentication'
desc 'Avoid rhosts-based authentication, as it opens more ways for an attacker to enter a system.'
only_if { ssh_version < 7.6 }
only_if { ssh_crypto.ssh_version < 7.6 }
describe ssh_config do
its('RhostsRSAAuthentication') { should eq('no') }
end
Expand All @@ -166,7 +164,7 @@
impact 1.0
title 'Client: Enable RSA authentication'
desc 'Make sure RSA authentication is used by default.'
only_if { ssh_version < 7.6 }
only_if { ssh_crypto.ssh_version < 7.6 }
describe ssh_config do
its('RSAAuthentication') { should eq('yes') }
end
Expand Down
2 changes: 1 addition & 1 deletion controls/sshd_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
title 'Server: Specify UseLogin to NO'
desc 'Disable legacy login mechanism and do not use login for interactive login sessions.'
describe sshd_config do
its('UseLogin') { should eq('no') }
its('UseLogin') { should eq(ssh_crypto.ssh_version < 7.4 ? 'no' : nil) }
end
end

Expand Down
4 changes: 4 additions & 0 deletions libraries/ssh_crypto.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
class SshCrypto < Inspec.resource(1) # rubocop:disable Metrics/ClassLength
name 'ssh_crypto'

def ssh_version
inspec.command('ssh -V 2>&1 | cut -f1 -d" " | cut -f2 -d"_"').stdout.to_f
end

def valid_ciphers # rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength
# define a set of default ciphers
ciphers53 = 'aes256-ctr,aes192-ctr,aes128-ctr'
Expand Down