Skip to content

Commit bb1b6e3

Browse files
authored
Merge pull request #10 from ansible-lockdown/devel
V1R1 release - April24
2 parents 83a3cc5 + cadaf4d commit bb1b6e3

File tree

5 files changed

+28
-22
lines changed

5 files changed

+28
-22
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ci:
88

99
repos:
1010
- repo: https://github.com/pre-commit/pre-commit-hooks
11-
rev: v4.5.0
11+
rev: v4.6.0
1212
hooks:
1313
# Safety
1414
- id: detect-aws-credentials
@@ -36,12 +36,12 @@ repos:
3636
- id: detect-secrets
3737

3838
- repo: https://github.com/gitleaks/gitleaks
39-
rev: v8.18.0
39+
rev: v8.18.2
4040
hooks:
4141
- id: gitleaks
4242

4343
- repo: https://github.com/ansible-community/ansible-lint
44-
rev: v6.21.1
44+
rev: v24.2.2
4545
hooks:
4646
- id: ansible-lint
4747
name: Ansible-lint
@@ -60,6 +60,6 @@ repos:
6060
- ansible-core>=2.10.1
6161

6262
- repo: https://github.com/adrienverge/yamllint.git
63-
rev: v1.32.0 # or higher tag
63+
rev: v1.35.1 # or higher tag
6464
hooks:
6565
- id: yamllint

tasks/Cat2/RHEL-09-21xxxx.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,7 @@
808808
- name: "MEDIUM | RHEL-09-213115 | PATCH | The kdump service on RHEL 9 must be disabled."
809809
when:
810810
- rhel_09_213115
811+
- "'kexec-tools' in ansible_facts.packages"
811812
tags:
812813
- RHEL-09-213115
813814
- CAT2

tasks/Cat2/RHEL-09-25xxxx.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,16 +195,18 @@
195195
- name: "MEDIUM | RHEL-09-251040 | PATCH | RHEL 9 network interfaces must not be in promiscuous mode."
196196
when:
197197
- not rhel9stig_disruption_high
198-
- item not in rhel9stig_promisc_if
198+
- item in rhel9stig_promisc_if
199199
ansible.builtin.debug:
200200
msg: "Warning!! You have interfaces set to promicious mode no in the exception list"
201+
loop: "{{ ansible_facts.interfaces }}"
201202

202203
- name: "MEDIUM | RHEL-09-251040 | PATCH | RHEL 9 network interfaces must not be in promiscuous mode."
203204
when:
204205
- not rhel9stig_disruption_high
205-
- item not in rhel9stig_promisc_if
206-
ansible.builtin.import_tasks:
206+
- item in rhel9stig_promisc_if
207+
ansible.builtin.include_tasks:
207208
file: warning_facts.yml
209+
loop: "{{ ansible_facts.interfaces }}"
208210

209211
- name: "MEDIUM | RHEL-09-251045 | PATCH | RHEL 9 must enable hardening for the Berkeley Packet Filter just-in-time compiler."
210212
when:

tasks/Cat2/RHEL-09-65xxxx.yml

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@
177177

178178
- name: "MEDIUM | RHEL-09-652025 | PATCH | RHEL 9 must be configured so that the rsyslog daemon does not accept log messages from other servers unless the server is being used for log aggregation."
179179
when:
180-
- rhel9stig_rsyslog_conf.matched > 0
180+
- rhel9stig_rsyslog_conf.matched > 1
181181
ansible.builtin.lineinfile:
182182
backrefs: true
183183
line: '#\1\2\3'
@@ -635,7 +635,8 @@
635635
msg:
636636
- "WARNING!! Below is the path and size of the partition for the audit logs."
637637
- "Please make sure there is enough disk space for 1 week of logs"
638-
- "Path: {{ rhel9stig_audit_conf.logfile }}"
638+
- "Munt: {{ rhel9stig_audit_log_filesystem }}"
639+
- "Logfile: {{ discovered_auditd_logfile.stdout }}"
639640
- "Disk Space remaining: {{ audit_filesystem_space_left }}MB"
640641

641642
- name: "MEDIUM | RHEL-09-653030 | WARN | RHEL 9 must allocate audit record storage capacity to store at least one week's worth of audit records."
@@ -850,7 +851,7 @@
850851
- auditd
851852
ansible.builtin.file:
852853
owner: root
853-
path: "{{ rhel9stig_audit_log_filesystem }}"
854+
path: "{{ discovered_auditd_logfile.stdout }}"
854855

855856
- name: "MEDIUM | RHEL-09-653090 | PATCH | RHEL 9 audit logs file must have mode 0600 or less permissive to prevent unauthorized access to the audit log."
856857
when:
@@ -869,18 +870,9 @@
869870
- NIST800-53R4_AU-9
870871
- NIST800-53R4_SI-11
871872
- auditd
872-
block:
873-
- name: "MEDIUM | RHEL-09-653090 | PATCH | RHEL 9 audit logs file must have mode 0600 or less permissive to prevent unauthorized access to the audit log."
874-
ansible.builtin.file:
875-
mode: '0600'
876-
path: "{{ rhel9stig_audit_conf.logfile }}"
877-
878-
- name: "MEDIUM | RHEL-09-653090 | PATCH | RHEL 9 audit logs file must have mode 0600 or less permissive to prevent unauthorized access to the audit log."
879-
ansible.builtin.file:
880-
mode: '0440'
881-
path: "{{ item }}"
882-
with_fileglob:
883-
- "{{ rhel9stig_audit_conf.logfile }}*"
873+
ansible.builtin.file:
874+
mode: go-rwx
875+
path: "{{ discovered_auditd_logfile.stdout }}"
884876

885877
- name: "MEDIUM | RHEL-09-653095 | PATCH | RHEL 9 must periodically flush audit records to disk to prevent the loss of audit records."
886878
when:

tasks/prelim.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,17 @@
158158
- SRG-OS-000475-GPOS-00220
159159
- auditd
160160

161+
- name: "PRELIM | Discover auditd_logfile_path"
162+
when:
163+
- rhel_09_653085 or
164+
rhel_09_653085 or
165+
rhel_09_653090
166+
tags:
167+
- always
168+
ansible.builtin.shell: grep ^log_file /etc/audit/auditd.conf | awk '{ print $NF }'
169+
changed_when: false
170+
register: discovered_auditd_logfile
171+
161172
# - name: "PRELIM | Audit conf and rules files | list files"
162173
# ansible.builtin.find:
163174
# path: /etc/audit

0 commit comments

Comments
 (0)