auditd, sysctl, become tidy up

Signed-off-by: Mark Bolwell <mark.bollyuk@gmail.com>
This commit is contained in:
Mark Bolwell 2022-06-20 17:07:39 +01:00
parent b934cbef3f
commit 4336bbf6b6
No known key found for this signature in database
GPG key ID: F734FDFC154B83FB
3 changed files with 49 additions and 57 deletions

25
tasks/auditd.yml Normal file
View file

@ -0,0 +1,25 @@
- name: POST | AUDITD | Apply auditd template will for section 4.1.3 - only required rules will be added
template:
src: audit/99_auditd.rules.j2
dest: /etc/audit/rules.d/99_auditd.rules
owner: root
group: root
mode: 0600
register: audit_rules_updated
notify: restart auditd
- name: POST | AUDITD | Discover if auditd immutable - Set reboot required if auditd immutable
block:
- name: POST | AUDITD | Discover if auditd immutable - will require reboot if auditd template applied
shell: grep -c "^-e 2" /etc/audit/rules.d/99_auditd.rules
changed_when: false
register: auditd_immutable_check
- name: POST | AUDITD | Set reboot required if auditd immutable
debug:
msg: "Reboot required for auditd to apply new rules as immutable set"
notify: change_requires_reboot
when:
- auditd_immutable_check.stdout == '1'
when:
- audit_rules_updated.changed