Skip to content

Commit 383c057

Browse files
authored
Merge pull request #252 from ansible-lockdown/devel
Final v1.0 release to main
2 parents 89821b8 + 719efaf commit 383c057

6 files changed

Lines changed: 29 additions & 27 deletions

File tree

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ci:
77

88
repos:
99
- repo: https://github.com/pre-commit/pre-commit-hooks
10-
rev: v4.6.0
10+
rev: v5.0.0
1111
hooks:
1212
# Safety
1313
- id: detect-aws-credentials
@@ -36,13 +36,13 @@ repos:
3636
args: [ '--baseline', '.config/.secrets.baseline' ]
3737

3838
- repo: https://github.com/gitleaks/gitleaks
39-
rev: v8.18.4
39+
rev: v8.21.2
4040
hooks:
4141
- id: gitleaks
4242
args: ['--baseline-path', '.config/.gitleaks-report.json']
4343

4444
- repo: https://github.com/ansible-community/ansible-lint
45-
rev: v24.7.0
45+
rev: v24.9.2
4646
hooks:
4747
- id: ansible-lint
4848
name: Ansible-lint

tasks/prelim.yml

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -138,35 +138,32 @@
138138
- always
139139

140140
- name: "PRELIM | PATCH | Ensure auditd is installed"
141-
block:
142-
- name: "PRELIM | PATCH | Ensure auditd is installed"
143-
ansible.builtin.package:
144-
name: ['auditd', 'audispd-plugins']
145-
state: present
146-
when:
147-
- "'auditd' not in ansible_facts.packages or
148-
'auditd-plugins' not in ansible_facts.packages"
149-
150-
- name: "PRELIM | AUDIT | Audit conf and rules files | list files"
151-
ansible.builtin.find:
152-
path: /etc/audit/
153-
file_type: file
154-
recurse: true
155-
patterns: '*.conf,*.rules'
156-
register: auditd_conf_files
157-
141+
ansible.builtin.package:
142+
name: ['auditd', 'audispd-plugins']
143+
state: present
158144
when:
159-
- ubtu22cis_rule_4_1_1_1 or
160-
ubtu22cis_rule_4_1_4_5 or
161-
ubtu22cis_rule_4_1_4_6 or
162-
ubtu22cis_rule_4_1_4_7
145+
- "'auditd' not in ansible_facts.packages or
146+
'auditd-plugins' not in ansible_facts.packages"
147+
- ubtu22cis_rule_4_1_1_1
163148
tags:
164149
- level2-server
165150
- level2-workstation
166151
- patch
167152
- auditd
168153
- always
169154

155+
- name: "PRELIM | AUDIT | Audit conf and rules files | list files"
156+
ansible.builtin.find:
157+
path: /etc/audit/
158+
file_type: file
159+
recurse: true
160+
patterns: '*.conf,*.rules'
161+
register: auditd_conf_files
162+
tags:
163+
- patch
164+
- auditd
165+
- always
166+
170167
- name: "PRELIM | AUDIT | Check if auditd is immutable before changes"
171168
ansible.builtin.shell: auditctl -l | grep -c '-e 2'
172169
changed_when: false

tasks/section_4/cis_4.1.4.x.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"4.1.4.3 | PATCH | Ensure only authorized groups are assigned ownership of audit log files"
2424
ansible.builtin.file:
2525
path: "{{ audit_discovered_logfile.stdout }}"
26-
mode: "{% if auditd_logfile.stat.mode > '0640' %}0640{% endif %}"
26+
mode: 'u-x,g-wx,o-rwx'
2727
owner: root
2828
group: root
2929
when:

tasks/section_4/cis_4.2.3.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
ansible.builtin.file:
1515
path: "{{ item.path }}"
1616
mode: '0640'
17+
failed_when: logfiles_perms_update.state not in '[ file, absent ]'
18+
register: logfiles_perms_update
1719
loop: "{{ logfiles.files }}"
1820
loop_control:
1921
label: "{{ item.path }}"

tasks/section_6/cis_6.1.x.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
owner: root
2222
group: root
2323
mode: '0644'
24+
failed_when: discovered_file_exists.state not in '[ file, absent ]'
25+
register: discovered_file_exists
2426
when:
2527
- ubtu22cis_rule_6_1_2
2628
tags:

vars/audit.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ post_audit_outfile: "{{ audit_log_dir }}/{{ ansible_facts.hostname }}-{{ benchma
2626

2727
### Audit binary settings ###
2828
audit_bin_version:
29-
release: v0.4.4
30-
AMD64_checksum: 'sha256:1c4f54b22fde9d4d5687939abc2606b0660a5d14a98afcd09b04b793d69acdc5'
29+
release: v0.4.8
30+
AMD64_checksum: 'sha256:85d00b7bba5f175bec95de7dfe1f71f8f25204914aad4c6f03c8457868eb6e2f'
31+
ARM64_checksum: 'sha256:bca8c898bfd35b94c51455ece6193c95e2cd7b2b183ac2047b2d76291e73e47d'
3132
audit_bin_path: /usr/local/bin/
3233
audit_bin: "{{ audit_bin_path }}goss"
3334
audit_format: json

0 commit comments

Comments
 (0)