2022-09-16 11:04:19 +01:00
|
|
|
---
|
2023-02-27 17:25:32 +00:00
|
|
|
|
2023-01-26 15:00:10 +00:00
|
|
|
- name: POST | AUDITD | Apply auditd template will for section 4.1.3 - only required rules will be added | stat file
|
|
|
|
|
ansible.builtin.stat:
|
2023-01-27 14:03:32 +00:00
|
|
|
path: /etc/audit/rules.d/99_auditd.rules
|
2023-03-01 10:17:37 +00:00
|
|
|
register: rhel9cis_auditd_file
|
2022-09-16 11:04:19 +01:00
|
|
|
|
2023-01-26 15:00:10 +00:00
|
|
|
- name: POST | AUDITD | Apply auditd template will for section 4.1.3 - only required rules will be added | setup file
|
2023-01-13 12:10:18 +00:00
|
|
|
ansible.builtin.template:
|
2022-06-20 17:07:39 +01:00
|
|
|
src: audit/99_auditd.rules.j2
|
|
|
|
|
dest: /etc/audit/rules.d/99_auditd.rules
|
|
|
|
|
owner: root
|
|
|
|
|
group: root
|
2023-09-21 16:25:59 +01:00
|
|
|
mode: '0640'
|
2023-03-01 10:17:37 +00:00
|
|
|
diff: "{{ rhel9cis_auditd_file.stat.exists }}" # Only run diff if not a new file
|
|
|
|
|
register: rhel9cis_auditd_template_updated
|
2022-09-16 11:04:19 +01:00
|
|
|
notify:
|
2023-01-25 09:41:32 +00:00
|
|
|
- Auditd immutable check
|
|
|
|
|
- Audit immutable fact
|
2023-01-13 12:10:18 +00:00
|
|
|
- Restart auditd
|
2022-06-20 17:07:39 +01:00
|
|
|
|
2023-07-26 16:58:33 +01:00
|
|
|
- name: POST | AUDITD | Add Warning count for changes to template file | Warn Count # noqa no-handler
|
2023-09-21 15:07:52 +01:00
|
|
|
ansible.builtin.import_tasks:
|
|
|
|
|
file: warning_facts.yml
|
2023-02-28 14:28:48 +00:00
|
|
|
vars:
|
2023-03-01 09:10:39 +00:00
|
|
|
warn_control_id: 'Auditd template updated, see diff output for details'
|
2023-02-28 14:28:48 +00:00
|
|
|
when:
|
2023-03-01 10:17:37 +00:00
|
|
|
- rhel9cis_auditd_template_updated.changed
|
|
|
|
|
- rhel9cis_auditd_file.stat.exists
|
2023-02-28 14:28:48 +00:00
|
|
|
|
2023-01-26 15:00:10 +00:00
|
|
|
- name: POST | AUDITD | Apply auditd template will for section 4.1.3 - only required rules will be added | stat file
|
|
|
|
|
ansible.builtin.stat:
|
2023-01-27 14:03:32 +00:00
|
|
|
path: /etc/audit/rules.d/98_auditd_exceptions.rules
|
2023-03-01 10:17:37 +00:00
|
|
|
register: rhel9cis_auditd_exception_file
|
2023-01-26 15:00:10 +00:00
|
|
|
|
|
|
|
|
- name: POST | Set up auditd user logging exceptions | setup file
|
2023-01-13 12:10:18 +00:00
|
|
|
ansible.builtin.template:
|
2022-09-16 11:04:19 +01:00
|
|
|
src: audit/98_auditd_exception.rules.j2
|
|
|
|
|
dest: /etc/audit/rules.d/98_auditd_exceptions.rules
|
|
|
|
|
owner: root
|
|
|
|
|
group: root
|
2023-09-21 16:25:59 +01:00
|
|
|
mode: '0640'
|
2023-03-01 10:17:37 +00:00
|
|
|
diff: "{{ rhel9cis_auditd_exception_file.stat.exists }}"
|
2023-01-13 12:10:18 +00:00
|
|
|
notify: Restart auditd
|
2022-07-25 15:25:39 +01:00
|
|
|
when:
|
2023-03-01 09:17:38 +00:00
|
|
|
- rhel9cis_allow_auditd_uid_user_exclusions
|
2022-07-25 15:25:39 +01:00
|
|
|
- rhel9cis_auditd_uid_exclude | length > 0
|