tighten sshd settings (ciphers, kex, macs)
This commit is contained in:
parent
e393ab4f6a
commit
f06707ce6b
1 changed files with 43 additions and 0 deletions
|
@ -14,6 +14,49 @@
|
|||
owner: root
|
||||
group: "{{ ansible_wheel }}"
|
||||
|
||||
# use openbsd kex algorithms but drop ssh-audit errors
|
||||
- name: tighten sshd kex algorithms
|
||||
lineinfile:
|
||||
path: /etc/ssh/sshd_config
|
||||
line: "KexAlgorithms curve25519-sha256,curve25519-sha256@libssh.org,\
|
||||
diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,\
|
||||
diffie-hellman-group14-sha256"
|
||||
regexp: "^KexAlgorithms .*"
|
||||
notify: restart sshd
|
||||
# use openbsd ciphers but in mozilla recommended order (kind of)
|
||||
- name: tighten sshd ciphers
|
||||
lineinfile:
|
||||
path: /etc/ssh/sshd_config
|
||||
line: "Ciphers aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,\
|
||||
aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr"
|
||||
regexp: "^Ciphers .*"
|
||||
notify: restart sshd
|
||||
# use openbsd macs but drop ssh-audit errors
|
||||
- name: tighten sshd macs
|
||||
lineinfile:
|
||||
path: /etc/ssh/sshd_config
|
||||
line: "MACs hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com"
|
||||
regexp: "^MACs .*"
|
||||
notify: restart sshd
|
||||
- name: disable ecdsa key from sshd
|
||||
lineinfile:
|
||||
path: /etc/ssh/sshd_config
|
||||
line: "#HostKey /etc/ssh/ssh_host_ecdsa_key"
|
||||
regexp: "HostKey /etc/ssh/ssh_host_ecdsa_key"
|
||||
notify: restart sshd
|
||||
- name: enable rsa key from sshd
|
||||
lineinfile:
|
||||
path: /etc/ssh/sshd_config
|
||||
line: "HostKey /etc/ssh/ssh_host_rsa_key"
|
||||
regexp: "#?HostKey /etc/ssh/ssh_host_rsa_key"
|
||||
notify: restart sshd
|
||||
- name: enable ed25519 key from sshd
|
||||
lineinfile:
|
||||
path: /etc/ssh/sshd_config
|
||||
line: "HostKey /etc/ssh/ssh_host_ed25519_key"
|
||||
regexp: "#?HostKey /etc/ssh/ssh_host_ed25519_key"
|
||||
notify: restart sshd
|
||||
|
||||
- name: install basic roles
|
||||
include_role:
|
||||
name: "{{ role }}"
|
||||
|
|
Loading…
Add table
Reference in a new issue