source: main/waeup-ansible/roles/openssh/tasks/main.yml @ 14254

Last change on this file since 14254 was 13994, checked in by uli, 8 years ago

Turn (some) tasks from playbook into roles.

File size: 1.7 KB
Line 
1---
2# tasks to enable secure OpenSSH server config
3- name: "sshd_config - disable weak keys"
4  lineinfile:
5    dest=/etc/ssh/sshd_config
6    backrefs=yes
7    line={{ item.line }}
8    regexp={{ item.regexp }}
9  with_items:
10    - { regexp: '^HostKey /etc/ssh/ssh_host_dsa_key',
11        line: '# HostKey /etc/ssh/ssh_host_dsa_key' }
12    - { regexp: '^HostKey /etc/ssh/ssh_host_ecdsa_key',
13        line: '# HostKey /etc/ssh/ssh_host_ecdsa_key' }
14  notify: "restart sshd"
15
16- name: "sshd_config - set key bits to 4096"
17  lineinfile:
18    dest=/etc/ssh/sshd_config
19    backrefs=yes
20    line='ServerKeyBits 4096'
21    regexp='^ServerKeyBits 1024'
22    state=present
23  notify: "restart sshd"
24
25- name: "sshd_config - set secure ciphers from bettercrypto.org"
26  lineinfile:
27    dest=/etc/ssh/sshd_config
28    line='Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes128-ctr'
29    state=present
30  notify: "restart sshd"
31
32- name: "sshd_config - set secure MACs from bettercrypto.org"
33  lineinfile:
34    dest=/etc/ssh/sshd_config
35    line='MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160'
36    state=present
37  notify: "restart sshd"
38
39- name: "sshd_config - set secure kex algos from bettercrypto.org"
40  lineinfile:
41    dest=/etc/ssh/sshd_config
42    line='KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1'
43    state=present
44  notify: "restart sshd"
45
46- name: "remove short moduli (<2048 bits) from /etc/ssh/moduli"
47  replace:
48    dest=/etc/ssh/moduli
49    regexp='^([0-9]+\s){4}(1[0-9]{3}\s)'
50  notify: "restart sshd"
Note: See TracBrowser for help on using the repository browser.