forked from ansible-lockdown/RHEL9-CIS
idempontency improvements
Signed-off-by: Mark Bolwell <mark.bollyuk@gmail.com>
This commit is contained in:
parent
969ee917ba
commit
7459f1d445
1 changed files with 11 additions and 5 deletions
|
|
@ -8,7 +8,13 @@
|
||||||
block:
|
block:
|
||||||
- name: "4.1.4.1 | AUDIT | Ensure audit log files are mode 0640 or less permissive | discover file"
|
- name: "4.1.4.1 | AUDIT | Ensure audit log files are mode 0640 or less permissive | discover file"
|
||||||
ansible.builtin.shell: grep ^log_file /etc/audit/auditd.conf | awk '{ print $NF }'
|
ansible.builtin.shell: grep ^log_file /etc/audit/auditd.conf | awk '{ print $NF }'
|
||||||
register: audit_logfile
|
register: audit_discovered_logfile
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
- name: "4.1.4.1 | AUDIT | Ensure audit log files are mode 0640 or less permissive | stat file"
|
||||||
|
ansible.builtin.stat:
|
||||||
|
path: "{{ audit_discovered_logfile.stdout }}"
|
||||||
|
register: auditd_logfile
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
- name: |
|
- name: |
|
||||||
|
|
@ -16,8 +22,8 @@
|
||||||
"4.1.4.2 | PATCH | Ensure only authorized users own audit log files"
|
"4.1.4.2 | PATCH | Ensure only authorized users own audit log files"
|
||||||
"4.1.4.3 | PATCH | Ensure only authorized groups are assigned ownership of audit log files"
|
"4.1.4.3 | PATCH | Ensure only authorized groups are assigned ownership of audit log files"
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ audit_logfile.stdout }}"
|
path: "{{ audit_discovered_logfile.stdout }}"
|
||||||
mode: 0640
|
mode: "{% if auditd_logfile.stat.mode != '0600' %}0640{% endif %}"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
when:
|
when:
|
||||||
|
|
@ -37,12 +43,12 @@
|
||||||
block:
|
block:
|
||||||
- name: "4.1.4.4 | AUDIT | Ensure the audit log directory is 0750 or more restrictive | get current permissions"
|
- name: "4.1.4.4 | AUDIT | Ensure the audit log directory is 0750 or more restrictive | get current permissions"
|
||||||
ansible.builtin.stat:
|
ansible.builtin.stat:
|
||||||
path: "{{ audit_logfile.stdout | dirname }}"
|
path: "{{ audit_discovered_logfile.stdout | dirname }}"
|
||||||
register: auditlog_dir
|
register: auditlog_dir
|
||||||
|
|
||||||
- name: "4.1.4.4 | PATCH | Ensure the audit log directory is 0750 or more restrictive | set"
|
- name: "4.1.4.4 | PATCH | Ensure the audit log directory is 0750 or more restrictive | set"
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ audit_logfile.stdout | dirname }}"
|
path: "{{ audit_discovered_logfile.stdout | dirname }}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: 0750
|
mode: 0750
|
||||||
when: not auditlog_dir.stat.mode is match('07(0|5)0')
|
when: not auditlog_dir.stat.mode is match('07(0|5)0')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue