updated ssh-hardening.yml

This commit is contained in:
transatoshi
2025-01-11 19:20:19 -08:00
parent fd450665aa
commit af716be0b0

View File

@@ -22,14 +22,21 @@
- name: Replace PermitRootLogin
ansible.builtin.replace:
path: /etc/ssh/sshd_config
regexp: PermitRootLogin yes
replace: PermitRootLogin prohibit-password
regexp: 'PermitRootLogin yes'
replace: 'PermitRootLogin prohibit-password'
- name: Replace PasswordAuthentication
ansible.builtin.replace:
path: /etc/ssh/sshd_config
regexp: PasswordAuthentication yes
replace: PasswordAuthentication no
regexp: '#PasswordAuthentication yes'
replace: 'PasswordAuthentication no'
- name: Replace PasswordAuthentication
ansible.builtin.replace:
path: /etc/ssh/sshd_config
regexp: 'PasswordAuthentication yes'
replace: 'PasswordAuthentication no'
- name: Restart SSH
ansible.builtin.shell: