-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(harden_os): Fix 'notify is no a valid attribute for a Block' erro…
…r message
- Loading branch information
1 parent
119800c
commit 6e40096
Showing
1 changed file
with
34 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |