Skip to content

Commit

Permalink
fix(harden_os): Fix 'notify is no a valid attribute for a Block' erro…
Browse files Browse the repository at this point in the history
…r message
  • Loading branch information
jhampson-dbre committed Dec 27, 2020
1 parent 119800c commit 6e40096
Showing 1 changed file with 34 additions and 30 deletions.
64 changes: 34 additions & 30 deletions roles/harden_os/tasks/ssh.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,40 @@
---
- name: Harden SSH
block:
- name: Disable root SSH login
lineinfile:
path: /etc/ssh/sshd_config
regexp: '^PermitRootLogin'
line: 'PermitRootLogin no'
state: present
validate: /usr/sbin/sshd -T -f %s
- name: Disable root SSH login
lineinfile:
path: /etc/ssh/sshd_config
regexp: '^PermitRootLogin'
line: 'PermitRootLogin no'
state: present
validate: /usr/sbin/sshd -T -f %s
notify:
- restart sshd

- name: Disable SSH password authentication
lineinfile:
path: /etc/ssh/sshd_config
regexp: '^PasswordAuthentication'
line: 'PasswordAuthentication no'
state: present
validate: /usr/sbin/sshd -T -f %s
- name: Disable SSH password authentication
lineinfile:
path: /etc/ssh/sshd_config
regexp: '^PasswordAuthentication'
line: 'PasswordAuthentication no'
state: present
validate: /usr/sbin/sshd -T -f %s
notify:
- restart sshd

- name: Enable sandbox for SSH privilege seperation
lineinfile:
path: /etc/ssh/sshd_config
regex: '^UsePrivilegeSeparation'
line: 'UsePrivilegeSeparation sandbox'
state: present
validate: /usr/sbin/sshd -T -f %s
- name: Enable sandbox for SSH privilege seperation
lineinfile:
path: /etc/ssh/sshd_config
regex: '^UsePrivilegeSeparation'
line: 'UsePrivilegeSeparation sandbox'
state: present
validate: /usr/sbin/sshd -T -f %s
notify:
- restart sshd

- name: Only allow SSH key authentication
lineinfile:
path: /etc/ssh/sshd_config
regex: '^AuthenticationMethods'
line: 'AuthenticationMethods publickey'
state: present
validate: /usr/sbin/sshd -T -f %s
- name: Only allow SSH key authentication
lineinfile:
path: /etc/ssh/sshd_config
regex: '^AuthenticationMethods'
line: 'AuthenticationMethods publickey'
state: present
validate: /usr/sbin/sshd -T -f %s
notify:
- restart sshd

0 comments on commit 6e40096

Please sign in to comment.