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

Commit 9502103

Browse files
committed
Merge pull request #31 from hardening-io/max_auth_tries
Make MaxAuthTries configurable
2 parents 4dcf553 + 2bc353b commit 9502103

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

roles/ansible-ssh-hardening/defaults/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ ssh_listen_to: ['0.0.0.0'] # sshd
2929
# Host keys to look for when starting sshd.
3030
ssh_host_key_files: ['/etc/ssh/ssh_host_rsa_key', '/etc/ssh/ssh_host_dsa_key', '/etc/ssh/ssh_host_ecdsa_key'] # sshd
3131

32+
# Specifies the maximum number of authentication attempts permitted per connection. Once the number of failures reaches half this value, additional failures are logged.
33+
ssh_max_auth_retries: 2
34+
3235
ssh_client_alive_interval: 600 # sshd
3336
ssh_client_alive_count: 3 # sshd
3437
# one or more hosts, to which ssh-client can connect to. Default is empty, but should be configured for security reasons!

roles/ansible-ssh-hardening/templates/opensshd.conf.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ UsePrivilegeSeparation {% if (ansible_distribution == 'Debian' and ansible_distr
121121

122122
PermitUserEnvironment no
123123
LoginGraceTime 30s
124-
MaxAuthTries 2
124+
MaxAuthTries {{ssh_max_auth_retries}}
125125
MaxSessions 10
126126
MaxStartups 10:30:100
127127

0 commit comments

Comments
 (0)