Compare commits
2 Commits
2bb018a40c
...
b600141e89
Author | SHA1 | Date | |
---|---|---|---|
b600141e89
|
|||
4be98d1a33
|
@@ -1,6 +1,8 @@
|
|||||||
---
|
---
|
||||||
- name: Zero .ssh/authorized_keys for provisioning user
|
- name: Zero .ssh/authorized_keys for provisioning user
|
||||||
ansible.builtin.file: dest={{ provisioning_user.home }}/.ssh/authorized_keys state=absent
|
ansible.builtin.file:
|
||||||
|
dest: "{{ provisioning_user.home }}/.ssh/authorized_keys"
|
||||||
|
state: absent
|
||||||
|
|
||||||
- name: Add public keys to authorized_keys
|
- name: Add public keys to authorized_keys
|
||||||
ansible.posix.authorized_key: { user: "{{ provisioning_user.name }}", key: "{{ lookup('file',item) }}" }
|
ansible.posix.authorized_key: { user: "{{ provisioning_user.name }}", key: "{{ lookup('file',item) }}" }
|
||||||
|
@@ -1,9 +1,12 @@
|
|||||||
---
|
---
|
||||||
# SSH configs don't change in Debian minor versions
|
# SSH configs don't change in Debian minor versions
|
||||||
- name: Reconfigure /etc/ssh/sshd_config
|
- name: Reconfigure /etc/ssh/sshd_config
|
||||||
ansible.builtin.template: src=sshd_config_{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.j2 dest=/etc/ssh/sshd_config owner=root group=root
|
ansible.builtin.template:
|
||||||
mode=0600
|
src: "sshd_config_{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.j2"
|
||||||
when: ansible_distribution == 'Debian'
|
dest: /etc/ssh/sshd_config
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0600
|
||||||
notify: reload sshd
|
notify: reload sshd
|
||||||
|
|
||||||
# See: WeakDH (2015): https://weakdh.org/sysadmin.html
|
# See: WeakDH (2015): https://weakdh.org/sysadmin.html
|
||||||
@@ -17,23 +20,25 @@
|
|||||||
register: check_unsafe_moduli
|
register: check_unsafe_moduli
|
||||||
|
|
||||||
- name: Extract safe Diffie-Hellman SSH moduli
|
- name: Extract safe Diffie-Hellman SSH moduli
|
||||||
|
when: check_unsafe_moduli.stdout | length > 0
|
||||||
ansible.builtin.shell:
|
ansible.builtin.shell:
|
||||||
cmd: awk '$5 >= 3071' moduli > moduli.safe
|
cmd: awk '$5 >= 3071' moduli > moduli.safe
|
||||||
chdir: /etc/ssh
|
chdir: /etc/ssh
|
||||||
creates: moduli.safe
|
creates: moduli.safe
|
||||||
when: check_unsafe_moduli.stdout | length > 0
|
|
||||||
register: extract_safe_moduli
|
register: extract_safe_moduli
|
||||||
|
|
||||||
- name: Replace unsafe Diffie-Hellman SSH moduli
|
- name: Replace unsafe Diffie-Hellman SSH moduli
|
||||||
|
when: extract_safe_moduli is changed
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: mv moduli.safe moduli
|
cmd: mv moduli.safe moduli
|
||||||
chdir: /etc/ssh
|
chdir: /etc/ssh
|
||||||
register: replace_small_moduli
|
register: replace_small_moduli
|
||||||
when: extract_safe_moduli is changed
|
|
||||||
notify: reload sshd
|
notify: reload sshd
|
||||||
|
|
||||||
- name: Remove DSA and ECDSA host keys
|
- name: Remove DSA and ECDSA host keys
|
||||||
ansible.builtin.file: name=/etc/ssh/{{ item }} state=absent
|
ansible.builtin.file:
|
||||||
|
name: "/etc/ssh/{{ item }}"
|
||||||
|
state: absent
|
||||||
loop:
|
loop:
|
||||||
- ssh_host_dsa_key
|
- ssh_host_dsa_key
|
||||||
- ssh_host_dsa_key.pub
|
- ssh_host_dsa_key.pub
|
||||||
|
Reference in New Issue
Block a user