-
Notifications
You must be signed in to change notification settings - Fork 70
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
Authorized keys custom path #172
Conversation
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.
@lubomir-kacalek hey Lubos :) Thanks for the PR!
-
Could you please add the tests for this option? (see Tests for GH-131 and GH-132 #155 as example)
-
Could you please add the documentation to the README.md?
templates/default/opensshd.conf.erb
Outdated
@@ -96,6 +96,11 @@ MaxStartups 10:30:100 | |||
# Enable public key authentication | |||
PubkeyAuthentication yes | |||
|
|||
<% if @node['ssh-hardening']['ssh']['server']['authorized_keys_path'] != nil %> |
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.
you do not need != nil
here
@lubomir-kacalek I would like to release the next minor version after #173 is merged, do you think you will be able to update this PR in the next days, so we can include it in the release? |
@lubomir-kacalek as discussed, the tests might look like this (in the describe 'customized AuthorizedKeysFile option' do
context 'without customized AuthorizedKeysFile' do
cached(:chef_run) do
ChefSpec::ServerRunner.new.converge(described_recipe)
end
it 'does not have AuthorizedKeysFile configured' do
expect(chef_run).not_to render_file('/etc/ssh/sshd_config').
with_content(/^AuthorizedKeysFile/)
end
end
context 'with customized AuthorizedKeysFile' do
cached(:chef_run) do
ChefSpec::ServerRunner.new do |node|
node.normal['ssh-hardening']['ssh']['server']['authorized_keys_path'] = '/some/authorizedkeysfile'
end.converge(described_recipe)
end
it 'has AuthorizedKeysFile configured' do
expect(chef_run).to render_file('/etc/ssh/sshd_config').
with_content(/^AuthorizedKeysFile /some/authorizedkeysfile/)
end
end
end |
@lubomir-kacalek its also possible to have it a bit simplier: with_content('AuthorizedKeysFile /some/authorizedkeysfile') instead of with_content(/^AuthorizedKeysFile /some/authorizedkeysfile/) and with_content('AuthorizedKeysFile') instead of with_content(/^AuthorizedKeysFile/) |
@lubomir-kacalek can you please sign your pr? |
@lubomir-kacalek @atomic111 means to use the sign-off, e.g. |
Signed-off-by: Lubomir Kacalek <[email protected]>
Hi @artem-sidorenko, @atomic111 : New commit has been signed off as well. Best regards,
|
@lubomir-kacalek I looks better, I resolved the conflicts to master Can you please make the rubocop happy? There are some offenses |
@atomic111 any remarks to this PR? I would like to merge it when rubocop is made happy and release the 2.1 of ssh-hardening |
Signed-off-by: lubomir-kacalek <[email protected]>
Signed-off-by: lubomir-kacalek <[email protected]>
Signed-off-by: lubomir-kacalek <[email protected]>
@lubomir-kacalek thank you! 2.1 will be released today/tomorrow |
Hi,
this propposed change allow to have configured a custom authorized key file path for an ssh server.
Thanks.
Lubomir Kacalek