2022-12-22 19:18:27 +00:00
|
|
|
# vim: ft=yaml.ansible
|
|
|
|
---
|
|
|
|
- name: Allow SSH login with public keys
|
2023-03-22 18:31:21 +00:00
|
|
|
ansible.builtin.lineinfile:
|
2023-04-17 14:03:32 +00:00
|
|
|
path: /etc/ssh/sshd_config
|
2022-12-22 19:18:27 +00:00
|
|
|
regexp: '^#?PubkeyAuthentication '
|
|
|
|
line: PubkeyAuthentication yes
|
2023-04-17 14:03:32 +00:00
|
|
|
state: present
|
2023-05-28 16:46:01 +00:00
|
|
|
notify: Restart sshd
|
2022-12-22 19:18:27 +00:00
|
|
|
|
|
|
|
- name: Disallow SSH login with password
|
2023-03-22 18:31:21 +00:00
|
|
|
ansible.builtin.lineinfile:
|
2023-04-17 14:03:32 +00:00
|
|
|
path: /etc/ssh/sshd_config
|
2022-12-22 19:18:27 +00:00
|
|
|
regexp: '^#?PasswordAuthentication '
|
|
|
|
line: PasswordAuthentication no
|
2023-04-17 14:03:32 +00:00
|
|
|
state: present
|
2023-05-28 16:46:01 +00:00
|
|
|
notify: Restart sshd
|
2022-12-22 19:18:27 +00:00
|
|
|
|
|
|
|
- name: Disallow root login over SSH
|
2023-03-22 18:31:21 +00:00
|
|
|
ansible.builtin.lineinfile:
|
2023-04-17 14:03:32 +00:00
|
|
|
path: /etc/ssh/sshd_config
|
2022-12-22 19:18:27 +00:00
|
|
|
regexp: '^#?PermitRootLogin '
|
|
|
|
line: PermitRootLogin no
|
2023-04-17 14:03:32 +00:00
|
|
|
state: present
|
2023-05-28 16:46:01 +00:00
|
|
|
notify: Restart sshd
|