Skip to content

Conversation

@micheelengronne
Copy link
Member

No description provided.

# returns the hostkeys value based on valid_algorithms
def valid_hostkeys
hostkeys = valid_algorithms.map { |alg| "#{sshd_custom_path}/ssh_host_#{alg}_key" }
hostkeys = valid_algorithms.map { |alg| "#{inspec.input('sshd_custom_path')}/ssh_host_#{alg}_key" }
Copy link
Member

@chris-rock chris-rock May 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since only one test is affected we should probably move that logic directly to the control:

control 'sshd-14' do
impact 1.0
title 'Server: Specify SSH HostKeys'
desc 'Specify HostKey for protection against Man-In-The-Middle Attacks'
describe sshd_config(sshd_custom_path + '/sshd_config') do
its('HostKey') { should cmp ssh_crypto.valid_hostkeys }
end
end

It will also be easier for the reader of the control to understand what the control is actually doing

@micheelengronne micheelengronne force-pushed the micheelengronne-patch-2 branch from 30d0a05 to e1769c5 Compare May 20, 2020 08:20
end

sshd_valid_hostkeys = ssh_crypto.valid_algorithms.map { |alg| "#{sshd_custom_path}/ssh_host_#{alg}_key" }
sshd_valid_hostkeys = sshd_valid_hostkeys[0] if sshd_valid_hostkeys.length == 1
Copy link
Member

@chris-rock chris-rock May 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is normally solved in the last commit.

Signed-off-by: Michée Lengronne <[email protected]>
Copy link
Member

@chris-rock chris-rock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great fix. Thank you for the quick turn-around @micheelengronne

@chris-rock chris-rock merged commit 3849c52 into master May 20, 2020
@chris-rock chris-rock deleted the micheelengronne-patch-2 branch May 20, 2020 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants