2022-01-01 19:24:52 +01:00
|
|
|
---
|
|
|
|
- name: Disable root authentication
|
2023-03-05 19:00:38 +01:00
|
|
|
ansible.builtin.replace:
|
2022-01-01 19:24:52 +01:00
|
|
|
path: /etc/ssh/sshd_config
|
|
|
|
regexp: '#PermitRootLogin prohibit-password'
|
|
|
|
replace: 'PermitRootLogin no'
|
|
|
|
|
|
|
|
- name: Disable X11 forwarding
|
2023-03-05 19:00:38 +01:00
|
|
|
ansible.builtin.replace:
|
2022-01-01 19:24:52 +01:00
|
|
|
path: /etc/ssh/sshd_config
|
|
|
|
regexp: 'X11Forwarding yes'
|
|
|
|
replace: 'X11Forwarding no'
|
|
|
|
|
|
|
|
- name: Explicitly only listen on ipv4
|
2023-03-05 19:00:38 +01:00
|
|
|
ansible.builtin.replace:
|
2022-01-01 19:24:52 +01:00
|
|
|
path: /etc/ssh/sshd_config
|
|
|
|
regexp: '#AddressFamily any'
|
|
|
|
replace: 'AddressFamily inet'
|
|
|
|
|
2022-04-16 21:03:00 +02:00
|
|
|
- name: "Restart sshd"
|
2023-03-05 19:00:38 +01:00
|
|
|
ansible.builtin.service:
|
2022-04-16 21:03:00 +02:00
|
|
|
name: sshd
|
2022-04-16 21:05:42 +02:00
|
|
|
state: restarted
|
2022-04-16 19:55:29 +02:00
|
|
|
...
|