-
Notifications
You must be signed in to change notification settings - Fork 75
Use inspec.input to load the attribute #168
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
Conversation
Signed-off-by: Michée Lengronne <[email protected]>
f5c1c19 to
78f35b3
Compare
libraries/ssh_crypto.rb
Outdated
| # 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" } |
There was a problem hiding this comment.
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:
ssh-baseline/controls/sshd_spec.rb
Lines 183 to 190 in fef3eb4
| 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
Signed-off-by: Michée Lengronne <[email protected]>
30d0a05 to
e1769c5
Compare
controls/sshd_spec.rb
Outdated
| 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that code should be part of the control similar to: https://github.com/dev-sec/linux-baseline/blob/master/controls/sysctl_spec.rb#L388-L411
There was a problem hiding this comment.
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]>
chris-rock
left a comment
There was a problem hiding this 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
No description provided.