forked from ansible-lockdown/RHEL9-CIS
loop improvememts
Signed-off-by: Mark Bolwell <mark.bollyuk@gmail.com>
This commit is contained in:
parent
c18151e158
commit
a85902ef2f
1 changed files with 27 additions and 27 deletions
|
|
@ -57,25 +57,16 @@
|
||||||
- rule_4.1.4.4
|
- rule_4.1.4.4
|
||||||
|
|
||||||
- name: "4.1.4.5 | PATCH | Ensure audit configuration files are 640 or more restrictive"
|
- name: "4.1.4.5 | PATCH | Ensure audit configuration files are 640 or more restrictive"
|
||||||
block:
|
ansible.builtin.file:
|
||||||
|
path: "{{ item.path }}"
|
||||||
- name: "4.1.4.5 | PATCH | Ensure audit configuration files are 640 or more restrictive | get permissions"
|
state: file
|
||||||
ansible.builtin.stat:
|
mode: 0640
|
||||||
path: "{{ item.path }}"
|
loop: "{{ auditd_conf_files.files }}"
|
||||||
register: item_file
|
loop_control:
|
||||||
loop: "{{ audit_conf_files.results | map(attribute='files') | flatten }}"
|
label: "{{ item.path }}"
|
||||||
loop_control:
|
|
||||||
label: "{{ item.path }}"
|
|
||||||
|
|
||||||
- name: "4.1.4.5 | PATCH | Ensure audit configuration files are 640 or more restrictive | set permissions"
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: "{{ audit_logfile.stdout | dirname }}"
|
|
||||||
state: file
|
|
||||||
mode: 0640
|
|
||||||
loop: "{{ audit_config_files }}"
|
|
||||||
when: not item_file.stat.mode is match('06(0|4)0')
|
|
||||||
when:
|
when:
|
||||||
- rhel9cis_rule_4_1_4_5
|
- item.mode != '06(0|4)0'
|
||||||
|
- rhel9cis_rule_4_1_4_5
|
||||||
tags:
|
tags:
|
||||||
- level2-server
|
- level2-server
|
||||||
- level2-workstation
|
- level2-workstation
|
||||||
|
|
@ -85,10 +76,12 @@
|
||||||
|
|
||||||
- name: "4.1.4.6 | PATCH | Ensure audit configuration files are owned by root"
|
- name: "4.1.4.6 | PATCH | Ensure audit configuration files are owned by root"
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ audit_logfile.stdout | dirname }}"
|
path: "{{ item.path }}"
|
||||||
state: file
|
state: file
|
||||||
owner: root
|
owner: root
|
||||||
loop: "{{ audit_config_files }}"
|
loop: "{{ auditd_conf_files.files }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.path }}"
|
||||||
when:
|
when:
|
||||||
- rhel9cis_rule_4_1_4_6
|
- rhel9cis_rule_4_1_4_6
|
||||||
tags:
|
tags:
|
||||||
|
|
@ -100,10 +93,12 @@
|
||||||
|
|
||||||
- name: "4.1.4.7 | PATCH | Ensure audit configuration files belong to group root"
|
- name: "4.1.4.7 | PATCH | Ensure audit configuration files belong to group root"
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ audit_logfile.stdout | dirname }}"
|
path: "{{ item.path }}"
|
||||||
state: file
|
state: file
|
||||||
group: root
|
group: root
|
||||||
loop: "{{ audit_config_files }}"
|
loop: "{{ auditd_conf_files.files }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.path }}"
|
||||||
when:
|
when:
|
||||||
- rhel9cis_rule_4_1_4_7
|
- rhel9cis_rule_4_1_4_7
|
||||||
tags:
|
tags:
|
||||||
|
|
@ -115,7 +110,7 @@
|
||||||
|
|
||||||
- name: "4.1.4.8 | PATCH | Ensure audit tools are 755 or more restrictive"
|
- name: "4.1.4.8 | PATCH | Ensure audit tools are 755 or more restrictive"
|
||||||
block:
|
block:
|
||||||
- name: "PRELIM | 4.1.4.8 | Get audit binarty file stat | get current mode"
|
- name: "PRELIM | 4.1.4.8 | Get audit binary file stat | get current mode"
|
||||||
ansible.builtin.stat:
|
ansible.builtin.stat:
|
||||||
path: "{{ item }}"
|
path: "{{ item }}"
|
||||||
register: "audit_bins"
|
register: "audit_bins"
|
||||||
|
|
@ -127,14 +122,19 @@
|
||||||
- /sbin/auditd
|
- /sbin/auditd
|
||||||
- /sbin/augenrules
|
- /sbin/augenrules
|
||||||
|
|
||||||
|
- debug:
|
||||||
|
msg: "{{ audit_bins }}"
|
||||||
|
|
||||||
- name: "4.1.4.8 | PATCH | Ensure audit tools are 755 or more restrictive | set if required"
|
- name: "4.1.4.8 | PATCH | Ensure audit tools are 755 or more restrictive | set if required"
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ item }}"
|
path: "{{ item.item }}"
|
||||||
state: file
|
state: file
|
||||||
mode: 0750
|
mode: 0750
|
||||||
register: "audit_bins"
|
register: "audit_bins"
|
||||||
loop: "{{ audit_bins.results.stat.path }}"
|
loop: "{{ audit_bins.results }}"
|
||||||
when: not audit_bins.stat.mode is match('07(0|5)(0|5)')
|
loop_control:
|
||||||
|
label: "{{ item.item }}"
|
||||||
|
when: not item.stat.mode is match('07(0|5)0')
|
||||||
when:
|
when:
|
||||||
- rhel9cis_rule_4_1_4_8
|
- rhel9cis_rule_4_1_4_8
|
||||||
tags:
|
tags:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue