Skip to content
This repository was archived by the owner on Dec 26, 2020. It is now read-only.

Commit 00df154

Browse files
author
Kostas
committed
feat: Add ability to provide a list of Host Key Algorithms
Signed-off-by: Kostas <kpa@tiatechnology.com>
1 parent 249e3a0 commit 00df154

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Warning: This role disables root-login on the target server! Please make sure yo
2222
|`ssh_client_port` | '22' |port to which ssh-client should connect|
2323
|`ssh_listen_to` | ['0.0.0.0'] |one or more ip addresses, to which ssh-server should listen to. Default is all adresseses, but should be configured to specific addresses for security reasons!|
2424
|`ssh_host_key_files` | [] |Host keys for sshd. If empty ['/etc/ssh/ssh_host_rsa_key', '/etc/ssh/ssh_host_ecdsa_key', '/etc/ssh/ssh_host_ed25519_key'] will be used, as far as supported by the installed sshd version|
25+
|`ssh_host_key_algorithms` | [] | 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|
2526
|`ssh_client_alive_interval` | 600 | specifies an interval for sending keepalive messages |
2627
|`ssh_client_alive_count` | 3 | defines how often keep-alive messages are sent |
2728
|`ssh_permit_tunnel` | false | true if SSH Port Tunneling is required |

defaults/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ ssh_listen_to: ['0.0.0.0'] # sshd
3030
# Host keys to look for when starting sshd.
3131
ssh_host_key_files: [] # sshd
3232

33+
# Specifies the host key algorithms that the server offers
34+
ssh_host_key_algorithms: [] # sshd
35+
3336
# Specifies the maximum number of authentication attempts permitted per connection. Once the number of failures reaches half this value, additional failures are logged.
3437
ssh_max_auth_retries: 2
3538

templates/opensshd.conf.j2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ ListenAddress {{address}}
3535
HostKey {{key}}
3636
{% endfor %}
3737

38+
# Specifies the host key algorithms that the server offers.
39+
{{ "HostKeyAlgorithms "+ssh_host_key_algorithms| join(',') if ssh_host_key_algorithms else "HostKeyAlgorithms"|comment }}
40+
3841
# Security configuration
3942
# ======================
4043

tests/default_custom.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@
7777
ssh_authorized_principals_file: '/etc/ssh/auth_principals/%u'
7878
ssh_authorized_principals:
7979
- { path: '/etc/ssh/auth_principals/root', principals: [ 'root' ], owner: "{{ ssh_owner }}", group: "{{ ssh_group }}", directoryowner: "{{ ssh_owner }}", directorygroup: "{{ ssh_group}}" }
80+
ssh_host_key_algorithms:
81+
- ssh-ed25519
82+
- rsa-sha2-512
83+
- rsa-sha2-256
84+
- ssh-rsa
8085
ssh_macs:
8186
- hmac-sha2-512
8287
- hmac-sha2-256

0 commit comments

Comments
 (0)