SSH Hardening, gnah.

This commit is contained in:
Julien Palard 2021-12-01 11:58:25 +01:00
parent 0e1c4b80f9
commit 35dffb2648
Signed by: mdk
GPG Key ID: 0EFC1AC1006886F8
1 changed files with 24 additions and 0 deletions

View File

@ -63,6 +63,27 @@
}
}
# From https://infosec.mozilla.org/guidelines/openssh
- name: SSHd hardening
blockinfile:
marker: "# {mark} ANSIBLE MANAGED BLOCK (KexAlgorithms, Ciphers, MACs)"
path: /etc/ssh/sshd_config
state: present
create: true
block: |
KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,umac-128@openssh.com
HostKey /etc/ssh/ssh_host_ed25519_key
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
AuthenticationMethods publickey
LogLevel VERBOSE
notify: restart sshd
tags: ssh
- name: Setup letsencrypt
include_role: name=julienpalard.nginx_letsencrypt
tags: always
@ -77,3 +98,6 @@
handlers:
- name: reload fail2ban
service: name=fail2ban state=reloaded
- name: reload sshd
service: name=sshd state=restarted