Skip to content

Commit 9dadc7f

Browse files
committed
Add AIDE check to CIS playbook
Added a new play to the CIS playbook to ensure existing AIDE installations are cleaned before applying CIS hardening for the first time on Ubuntu Noble. Existing installations can become corrupted during Jammy-Noble Upgrades
1 parent bb6de6f commit 9dadc7f

File tree

2 files changed

+56
-3
lines changed
  • etc/kayobe
    • ansible/maintenance
    • inventory/group_vars/cis-hardening

2 files changed

+56
-3
lines changed

etc/kayobe/ansible/maintenance/cis.yml

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,51 @@
11
---
2-
- name: Security hardening
2+
- name: CIS - Ensure existing AIDE installation is cleaned
3+
hosts: cis-hardening
4+
become: true
5+
tags:
6+
- cis
7+
gather_facts: true
8+
tasks:
9+
- name: Gather package facts
10+
ansible.builtin.package_facts:
11+
manager: auto
12+
13+
- name: Check if AIDE cleanup has already run
14+
ansible.builtin.stat:
15+
path: /opt/kayobe/aide/aide_cleanup_complete.flag
16+
register: aide_cleanup_flag
17+
18+
- name: Cleanup existing AIDE config
19+
when:
20+
- "'aide' in ansible_facts.packages"
21+
- not aide_cleanup_flag.stat.exists
22+
- ansible_facts.distribution == 'Ubuntu'
23+
block:
24+
- name: Ensure AIDE packages is removed
25+
ansible.builtin.apt:
26+
name:
27+
- aide
28+
- aide-common
29+
state: absent
30+
purge: true
31+
32+
- name: Ensure flag directory exists
33+
ansible.builtin.file:
34+
path: /opt/kayobe/aide
35+
state: directory
36+
mode: '0755'
37+
owner: stack
38+
group: stack
39+
40+
- name: Create flag file to prevent re-running cleanup
41+
ansible.builtin.file:
42+
path: /opt/kayobe/aide/aide_cleanup_complete.flag
43+
state: touch
44+
mode: '0644'
45+
owner: stack
46+
group: stack
47+
48+
- name: CIS - General Prerequisites
349
hosts: cis-hardening
450
become: true
551
tags:
@@ -31,6 +77,12 @@
3177
- "{{ kayobe_ansible_user }}"
3278
- "{{ kolla_ansible_user }}"
3379

80+
- name: Security hardening
81+
hosts: cis-hardening
82+
become: true
83+
tags:
84+
- cis
85+
tasks:
3486
- name: Run CIS hardening role (RHEL 9)
3587
ansible.builtin.include_role:
3688
name: ansible-lockdown.rhel9_cis

etc/kayobe/inventory/group_vars/cis-hardening/cis

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ ubtu24cis_syslog_service: journald
9898
# Allow rsync server
9999
ubtu24cis_rsync_server: true
100100

101+
# AIDE is very slow to init, especially on an AIO in CI
102+
ubtu24cis_aide_init_async: 1800
103+
101104
# Do not change Chrony Time servers
102105
ubtu24cis_rule_2_3_3_1: false
103106
ubtu24cis_rule_2_3_3_2: false
@@ -152,8 +155,6 @@ ubtu24cis_ownership_adjust: false
152155
ubtu24cis_no_world_write_adjust: false
153156
ubtu24cis_suid_sgid_adjust: false
154157

155-
# Prevent hardening from recursivley changing permissions on log files
156-
157158
# Configure log rotation to prevent audit logs from filling the disk
158159
ubtu24cis_auditd:
159160
action_mail_acct: root

0 commit comments

Comments
 (0)