forked from ansible-lockdown/RHEL9-CIS
lint and v2 initial
Signed-off-by: Mark Bolwell <mark.bollyuk@gmail.com>
This commit is contained in:
parent
42aa624d50
commit
a36a84c5ea
5 changed files with 712 additions and 676 deletions
1240
defaults/main.yml
1240
defaults/main.yml
File diff suppressed because it is too large
Load diff
|
|
@ -5,36 +5,36 @@
|
||||||
ansible.builtin.shell: sysctl --system
|
ansible.builtin.shell: sysctl --system
|
||||||
|
|
||||||
- name: Sysctl flush ipv4 route table
|
- name: Sysctl flush ipv4 route table
|
||||||
ansible.posix.sysctl:
|
|
||||||
name: net.ipv4.route.flush
|
|
||||||
value: '1'
|
|
||||||
sysctl_set: true
|
|
||||||
ignore_errors: true # noqa ignore-errors
|
|
||||||
when:
|
when:
|
||||||
- rhel9cis_flush_ipv4_route
|
- rhel9cis_flush_ipv4_route
|
||||||
- not system_is_container
|
- not system_is_container
|
||||||
|
ansible.posix.sysctl:
|
||||||
|
name: net.ipv4.route.flush
|
||||||
|
value: '1'
|
||||||
|
sysctl_set: true
|
||||||
|
ignore_errors: true # noqa ignore-errors
|
||||||
|
|
||||||
- name: Sysctl flush ipv6 route table
|
- name: Sysctl flush ipv6 route table
|
||||||
ansible.posix.sysctl:
|
|
||||||
name: net.ipv6.route.flush
|
|
||||||
value: '1'
|
|
||||||
sysctl_set: true
|
|
||||||
when:
|
when:
|
||||||
- rhel9cis_flush_ipv6_route
|
- rhel9cis_flush_ipv6_route
|
||||||
- not system_is_container
|
- not system_is_container
|
||||||
|
ansible.posix.sysctl:
|
||||||
|
name: net.ipv6.route.flush
|
||||||
|
value: '1'
|
||||||
|
sysctl_set: true
|
||||||
|
|
||||||
- name: Systemd restart tmp.mount
|
- name: Systemd restart tmp.mount
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
name: tmp.mount
|
name: tmp.mount
|
||||||
daemon_reload: true
|
daemon_reload: true
|
||||||
enabled: true
|
enabled: true
|
||||||
masked: false
|
masked: false
|
||||||
state: reloaded
|
state: reloaded
|
||||||
|
|
||||||
- name: Remount tmp
|
- name: Remount tmp
|
||||||
ansible.posix.mount:
|
ansible.posix.mount:
|
||||||
path: /tmp
|
path: /tmp
|
||||||
state: remounted
|
state: remounted
|
||||||
|
|
||||||
- name: Update Crypto Policy
|
- name: Update Crypto Policy
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
|
|
|
||||||
|
|
@ -1,32 +1,32 @@
|
||||||
---
|
---
|
||||||
galaxy_info:
|
galaxy_info:
|
||||||
author: "MindPoint Group"
|
author: "MindPoint Group"
|
||||||
description: "Apply the RHEL 9 CIS"
|
description: "Apply the RHEL 9 CIS"
|
||||||
company: "MindPoint Group"
|
company: "MindPoint Group"
|
||||||
license: MIT
|
license: MIT
|
||||||
role_name: rhel9_cis
|
role_name: rhel9_cis
|
||||||
namespace: mindpointgroup
|
namespace: mindpointgroup
|
||||||
min_ansible_version: 2.10.1
|
min_ansible_version: 2.10.1
|
||||||
platforms:
|
platforms:
|
||||||
- name: EL
|
- name: EL
|
||||||
versions:
|
versions:
|
||||||
- "9"
|
- "9"
|
||||||
galaxy_tags:
|
galaxy_tags:
|
||||||
- system
|
- system
|
||||||
- security
|
- security
|
||||||
- stig
|
- stig
|
||||||
- hardening
|
- hardening
|
||||||
- benchmark
|
- benchmark
|
||||||
- compliance
|
- compliance
|
||||||
- redhat
|
- redhat
|
||||||
- complianceascode
|
- complianceascode
|
||||||
- disa
|
- disa
|
||||||
- rhel9
|
- rhel9
|
||||||
- cis
|
- cis
|
||||||
- rocky
|
- rocky
|
||||||
- alma
|
- alma
|
||||||
collections:
|
collections:
|
||||||
- community.general
|
- community.general
|
||||||
- community.crypto
|
- community.crypto
|
||||||
- ansible.posix
|
- ansible.posix
|
||||||
dependencies: []
|
dependencies: []
|
||||||
|
|
|
||||||
4
site.yml
4
site.yml
|
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- name: Apply RHEL9 CIS hardening
|
- name: Apply ansible-lockdown hardening
|
||||||
hosts: all
|
hosts: all
|
||||||
become: true
|
become: true
|
||||||
roles:
|
roles:
|
||||||
- role: "{{ playbook_dir }}"
|
- role: "{{ playbook_dir }}"
|
||||||
|
|
|
||||||
|
|
@ -2,46 +2,46 @@
|
||||||
|
|
||||||
- name: POST | AUDITD | Apply auditd template will for section 4.1.3 - only required rules will be added | stat file
|
- name: POST | AUDITD | Apply auditd template will for section 4.1.3 - only required rules will be added | stat file
|
||||||
ansible.builtin.stat:
|
ansible.builtin.stat:
|
||||||
path: /etc/audit/rules.d/99_auditd.rules
|
path: /etc/audit/rules.d/99_auditd.rules
|
||||||
register: rhel9cis_auditd_file
|
register: rhel9cis_auditd_file
|
||||||
|
|
||||||
- name: POST | AUDITD | Apply auditd template will for section 4.1.3 - only required rules will be added | setup file
|
- name: POST | AUDITD | Apply auditd template will for section 4.1.3 - only required rules will be added | setup file
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: audit/99_auditd.rules.j2
|
src: audit/99_auditd.rules.j2
|
||||||
dest: /etc/audit/rules.d/99_auditd.rules
|
dest: /etc/audit/rules.d/99_auditd.rules
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: '0640'
|
mode: '0640'
|
||||||
diff: "{{ rhel9cis_auditd_file.stat.exists }}" # Only run diff if not a new file
|
diff: "{{ rhel9cis_auditd_file.stat.exists }}" # Only run diff if not a new file
|
||||||
register: rhel9cis_auditd_template_updated
|
register: rhel9cis_auditd_template_updated
|
||||||
notify:
|
notify:
|
||||||
- Auditd immutable check
|
- Auditd immutable check
|
||||||
- Audit immutable fact
|
- Audit immutable fact
|
||||||
- Restart auditd
|
- Restart auditd
|
||||||
|
|
||||||
- name: POST | AUDITD | Add Warning count for changes to template file | Warn Count # noqa no-handler
|
- name: POST | AUDITD | Add Warning count for changes to template file | Warn Count # noqa no-handler
|
||||||
ansible.builtin.import_tasks:
|
|
||||||
file: warning_facts.yml
|
|
||||||
vars:
|
|
||||||
warn_control_id: 'Auditd template updated, see diff output for details'
|
|
||||||
when:
|
when:
|
||||||
- rhel9cis_auditd_template_updated.changed
|
- rhel9cis_auditd_template_updated.changed
|
||||||
- rhel9cis_auditd_file.stat.exists
|
- rhel9cis_auditd_file.stat.exists
|
||||||
|
ansible.builtin.import_tasks:
|
||||||
|
file: warning_facts.yml
|
||||||
|
vars:
|
||||||
|
warn_control_id: 'Auditd template updated, see diff output for details'
|
||||||
|
|
||||||
- name: POST | AUDITD | Apply auditd template will for section 4.1.3 - only required rules will be added | stat file
|
- name: POST | AUDITD | Apply auditd template will for section 4.1.3 - only required rules will be added | stat file
|
||||||
ansible.builtin.stat:
|
ansible.builtin.stat:
|
||||||
path: /etc/audit/rules.d/98_auditd_exceptions.rules
|
path: /etc/audit/rules.d/98_auditd_exceptions.rules
|
||||||
register: rhel9cis_auditd_exception_file
|
register: rhel9cis_auditd_exception_file
|
||||||
|
|
||||||
- name: POST | Set up auditd user logging exceptions | setup file
|
- name: POST | Set up auditd user logging exceptions | setup file
|
||||||
|
when:
|
||||||
|
- rhel9cis_allow_auditd_uid_user_exclusions
|
||||||
|
- rhel9cis_auditd_uid_exclude | length > 0
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: audit/98_auditd_exception.rules.j2
|
src: audit/98_auditd_exception.rules.j2
|
||||||
dest: /etc/audit/rules.d/98_auditd_exceptions.rules
|
dest: /etc/audit/rules.d/98_auditd_exceptions.rules
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: '0640'
|
mode: '0640'
|
||||||
diff: "{{ rhel9cis_auditd_exception_file.stat.exists }}"
|
diff: "{{ rhel9cis_auditd_exception_file.stat.exists }}"
|
||||||
notify: Restart auditd
|
notify: Restart auditd
|
||||||
when:
|
|
||||||
- rhel9cis_allow_auditd_uid_user_exclusions
|
|
||||||
- rhel9cis_auditd_uid_exclude | length > 0
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue