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

ssh: Client HostKeyAlgorithms configuration variable #442

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
5 changes: 4 additions & 1 deletion roles/ssh_hardening/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ Warning: This role disables root-login on the target server! Please make sure yo
- Description: Specifies the number of bits in the private host RSA key to create.
- `ssh_host_key_algorithms`
- Default: `[]`
- Description: Host key algorithms that the server offers. If empty the [default list](https://man.openbsd.org/sshd_config#HostKeyAlgorithms) will be used, otherwise overrides the setting with specified list of algorithms.
- Description: Host key algorithms that the server offers. If empty the default list will be used. Otherwise overrides the setting with specified list of algorithms. Check `man sshd_config`, `ssh -Q HostKeyAlgorithms` or other sources for supported algorithms - make sure you check the correct version!
- `ssh_client_host_key_algorithms`
- Default: `[]`
- Description: Specifies the host key algorithms that the client wants to use in order of preference. If empty the default list will be used. Otherwise overrides the setting with specified list of algorithms. Check `man ssh_config`, `ssh -Q HostKeyAlgorithms` or other sources for supported algorithms - make sure you check the correct version!.
- `ssh_client_alive_interval`
- Default: `600`
- Description: specifies an interval for sending keepalive messages.
Expand Down
3 changes: 3 additions & 0 deletions roles/ssh_hardening/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ ssh_host_certificates: [] # sshd
# Specifies the host key algorithms that the server offers
ssh_host_key_algorithms: [] # sshd

# Specifies the host key algorithms order the client will try
ssh_client_host_key_algorithms: [] # ssh

# specifies the time allowed for successful authentication to the SSH server
ssh_login_grace_time: 30s

Expand Down
3 changes: 3 additions & 0 deletions roles/ssh_hardening/templates/openssh.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ StrictHostKeyChecking ask
{# This outputs 'KexAlgorithms <list-of-algos>' if ssh_kex is defined or '#KexAlgorithms' if ssh_kex is undefined #}
{{ 'KexAlgorithms ' ~ ssh_kex|join(',') if ssh_kex else 'KexAlgorithms'|comment }}

# Specifies the host key algorithms that the client wants to use in order of preference.
{{ "HostKeyAlgorithms " ~ ssh_client_host_key_algorithms|join(',') if ssh_client_host_key_algorithms else "HostKeyAlgorithms"|comment }}

{% if sshd_version is version('5.9', '<') %}
# Alternative setting, if OpenSSH version is below v5.9
#MACs hmac-ripemd160
Expand Down