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

Commit 21bec11

Browse files
authored
Merge pull request #287 from dev-sec/chris-rock/customize-ssh-params
allow customization of login gracetime and max sessins
2 parents f1b5f61 + 09a655a commit 21bec11

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ Warning: This role disables root-login on the target server! Please make sure yo
6161
|`ssh_client_port` | `'22'` | Specifies the port number to connect on the remote host. |
6262
|`ssh_client_compression` | `false` | Specifies whether the client requests compression. |
6363
|`ssh_compression` | `false` | Specifies whether server-side compression is enabled after the user has authenticated successfully. |
64+
|`ssh_login_grace_time` | `30s` | specifies the time allowed for successful authentication to the SSH server |
6465
|`ssh_max_auth_retries` | `2` | Specifies the maximum number of authentication attempts permitted per connection. |
66+
|`ssh_max_sessions` | `10` | Specifies the maximum number of open sessions permitted from a given connection. |
6567
|`ssh_print_debian_banner` | `false` | `true` to print debian specific banner |
6668
|`ssh_server_enabled` | `true` | `false` to disable the opensshd server |
6769
|`ssh_server_hardening` | `true` | `false` to stop harden the server |

defaults/main.yml

+6
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,15 @@ ssh_host_key_files: [] # sshd
3434
# Specifies the host key algorithms that the server offers
3535
ssh_host_key_algorithms: [] # sshd
3636

37+
# specifies the time allowed for successful authentication to the SSH server
38+
ssh_login_grace_time: 30s
39+
3740
# Specifies the maximum number of authentication attempts permitted per connection. Once the number of failures reaches half this value, additional failures are logged.
3841
ssh_max_auth_retries: 2
3942

43+
# Specifies the maximum number of open sessions permitted from a given connection
44+
ssh_max_sessions: 10
45+
4046
ssh_client_alive_interval: 300 # sshd
4147
ssh_client_alive_count: 3 # sshd
4248

templates/opensshd.conf.j2

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ UseLogin no
9595
UsePrivilegeSeparation {% if (ansible_facts.distribution == 'Debian' and ansible_facts.distribution_major_version <= '6') or (ansible_facts.os_family in ['Oracle Linux', 'RedHat'] and ansible_facts.distribution_major_version <= '6' and not ansible_facts.distribution == 'Amazon') -%}{{ssh_ps53}}{% else %}{{ssh_ps59}}{% endif %}
9696
{% endif %}
9797

98-
LoginGraceTime 30s
98+
LoginGraceTime {{ssh_login_grace_time}}
9999
MaxAuthTries {{ssh_max_auth_retries}}
100-
MaxSessions 10
100+
MaxSessions {{ssh_max_sessions}}
101101
MaxStartups {{ssh_max_startups}}
102102

103103
# Enable public key authentication

0 commit comments

Comments
 (0)