2022-12-21 22:56:39 -05:00
|
|
|
---
|
|
|
|
- name: Block root and password authentication
|
|
|
|
lineinfile:
|
|
|
|
path: /etc/ssh/sshd_config
|
|
|
|
regexp: '{{ item.regexp }}'
|
|
|
|
line: '{{ item.line }}'
|
|
|
|
validate: 'sshd -T -f %s'
|
|
|
|
state: present
|
|
|
|
with_items:
|
|
|
|
- regexp: '^PasswordAuthentication'
|
|
|
|
line: 'PasswordAuthentication no'
|
2023-10-15 22:55:26 -04:00
|
|
|
- regexp: '^#PermitRootLogin'
|
2022-12-21 22:56:39 -05:00
|
|
|
line: 'PermitRootLogin no'
|
|
|
|
notify: Restart ssh
|