Skip to content

Commit 7f918c0

Browse files
Merge pull request #322 from ansible-lockdown/dec25_pub
Dec25 pub
2 parents c921e98 + a08e346 commit 7f918c0

5 files changed

Lines changed: 65 additions & 19 deletions

File tree

Changelog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44

55
### Do not migrate
66

7+
# Dec 25 update
8+
pre-commits
9+
10+
4.1.5 updated variables, loop and added ntp
11+
6.3.4.1/2/3 separated the tasks
12+
prelim check for pwquality changed_when logic update thanks to @FrsECM #318
13+
714
# Sept 25 updates
815

916
- 5.4.2.5 improved thanks to @numericillustration

defaults/main.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -791,9 +791,16 @@ ubtu22cis_ufw_use_sysctl: true
791791
# If you want to allow outbound traffic on all ports, set the variable to `all`, e.g.,
792792
# `ubtu22cis_ufw_allow_out_ports: "all"`.
793793
ubtu22cis_ufw_allow_out_ports:
794-
- 53
795-
- 80
796-
- 443
794+
- port: 53
795+
proto: tcp
796+
- port: 53
797+
proto: udp
798+
- port: 80
799+
proto: tcp
800+
- port: 123
801+
proto: udp
802+
- port: 443
803+
proto: tcp
797804

798805
## Controls 4.2.x - nftables
799806
# Nftables is not supported in this role. Some tasks have parts of them commented out, this is one example

tasks/prelim.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@
168168
modification_time: preserve
169169
access_time: preserve
170170
register: prelim_pwquality_dummy
171-
changed_when: prelim_pwquality_dummy.diff == "absent"
171+
changed_when: prelim_pwquality_dummy.changed
172172
loop:
173173
- { path: '/etc/security/pwquality.conf.d', state: 'directory' }
174174
- { path: '/etc/security/pwquality.conf.d/cis_dummy.conf', state: 'touch' }

tasks/section_4/cis_4.1.x.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,11 @@
110110
community.general.ufw:
111111
rule: allow
112112
direction: out
113-
to_port: '{{ item }}'
114-
with_items:
115-
- "{{ ubtu22cis_ufw_allow_out_ports }}"
113+
proto: "{{ item.proto }}"
114+
to_port: '{{ item.port }}'
115+
loop: "{{ ubtu22cis_ufw_allow_out_ports }}"
116+
loop_control:
117+
label: "{{ item.port }}"
116118
notify: Reload ufw
117119

118120
- name: "4.1.5 | PATCH | Ensure ufw outbound connections are configured | Allow all"

tasks/section_6/cis_6.3.4.x.yml

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,57 @@
11
---
22

3-
- name: |
4-
"6.3.4.1 | PATCH | Ensure audit log files mode is configured"
5-
"6.3.4.2 | PATCH | Ensure audit log files owner is configured"
6-
"6.3.4.3 | PATCH | Ensure audit log files group owner is configured"
7-
when:
8-
- ubtu22cis_rule_6_3_4_1 or
9-
ubtu22cis_rule_6_3_4_2 or
10-
ubtu22cis_rule_6_3_4_3
3+
- name: "6.3.4.1 | PATCH | Ensure audit log files mode is configured"
4+
when: ubtu22cis_rule_6_3_4_1
115
tags:
126
- level1-server
137
- level1-workstation
148
- patch
159
- auditd
1610
- rule_6.3.4.1
11+
- NIST800-53R5_AU-3
12+
ansible.builtin.file:
13+
path: "{{ prelim_auditd_logfile.stdout | dirname }}"
14+
recurse: true
15+
mode: 'u-x,g-wx,o-rwx'
16+
17+
- name: "6.3.4.2 | PATCH | Ensure audit log files owner is configured"
18+
when: ubtu22cis_rule_6_3_4_2
19+
tags:
20+
- level1-server
21+
- level1-workstation
22+
- patch
23+
- auditd
1724
- rule_6.3.4.2
18-
- rule_6.3.4.3
1925
- NIST800-53R5_AU-3
2026
ansible.builtin.file:
21-
path: "{{ prelim_auditd_logfile.stdout }}"
27+
path: "{{ prelim_auditd_logfile.stdout | dirname }}"
28+
recurse: true
2229
owner: root
23-
group: root
24-
mode: 'u-x,g-wx,o-rwx'
30+
31+
- name: "6.3.4.3 | PATCH | Ensure audit log files group owner is configured"
32+
when: ubtu22cis_rule_6_3_4_3
33+
tags:
34+
- level1-server
35+
- level1-workstation
36+
- patch
37+
- auditd
38+
- rule_6.3.4.3
39+
- NIST800-53R5_AU-3
40+
block:
41+
- name: "6.3.4.3 | AUDIT | Ensure audit log files group owner is configured | stat logfile"
42+
ansible.builtin.find:
43+
path: "{{ prelim_auditd_logfile.stdout | dirname }}"
44+
file_type: file
45+
register: discovered_auditd_logs
46+
47+
- name: "6.3.4.3 | PATCH | Ensure audit log files group owner is configured"
48+
when: item.gr_name not in [ 'root', 'adm' ]
49+
ansible.builtin.file:
50+
path: "{{ item.path }}"
51+
group: root
52+
loop: "{{ discovered_auditd_logs.files }}"
53+
loop_control:
54+
label: "{{ item.path }}"
2555

2656
- name: "6.3.4.4 | PATCH | Ensure the audit log file directory mode is configured"
2757
when: ubtu22cis_rule_6_3_4_4

0 commit comments

Comments
 (0)