mirror of
https://github.com/ansible-lockdown/RHEL9-CIS.git
synced 2026-05-09 23:33:53 +00:00
QA, lint, standards, var naming, title aming aligned
Signed-off-by: Mark Bolwell <mark.bollyuk@gmail.com>
This commit is contained in:
parent
69bef1f371
commit
201edf02e4
39 changed files with 478 additions and 608 deletions
|
|
@ -4,7 +4,7 @@
|
|||
when: rhel9cis_rule_6_2_2_2
|
||||
tags:
|
||||
- level1-server
|
||||
- level2-workstation
|
||||
- level1-workstation
|
||||
- patch
|
||||
- journald
|
||||
- rule_6.2.2.2
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
|
||||
- name: "6.2.3.1 | PATCH | Ensure rsyslog installed"
|
||||
- name: "6.2.3.1 | PATCH | Ensure rsyslog is installed"
|
||||
when:
|
||||
- "'rsyslog' not in ansible_facts.packages"
|
||||
- rhel9cis_rule_6_2_3_1
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
name: rsyslog
|
||||
state: present
|
||||
|
||||
- name: "6.2.3.2 | PATCH | Ensure rsyslog Service is enabled and active"
|
||||
- name: "6.2.3.2 | PATCH | Ensure rsyslog service is enabled and active"
|
||||
when: rhel9cis_rule_6_2_3_2
|
||||
tags:
|
||||
- level1-server
|
||||
|
|
@ -68,7 +68,7 @@
|
|||
line: '$FileCreateMode 0640'
|
||||
notify: Restart rsyslog
|
||||
|
||||
- name: "6.2.3.5 | PATCH | Ensure logging is configured"
|
||||
- name: "6.2.3.5 | PATCH | Ensure rsyslog logging is configured"
|
||||
when: rhel9cis_rule_6_2_3_5
|
||||
tags:
|
||||
- level1-server
|
||||
|
|
@ -93,7 +93,7 @@
|
|||
- "These are the current logging configurations for rsyslog, please review:"
|
||||
- "{{ discovered_configured_rsyslog.stdout_lines }}"
|
||||
|
||||
- name: "6.2.3.5 | PATCH | Ensure logging is configured | mail.* log setting"
|
||||
- name: "6.2.3.5 | PATCH | Ensure rsyslog logging is configured | mail.* log setting"
|
||||
when: rhel9cis_rsyslog_ansiblemanaged
|
||||
ansible.builtin.blockinfile:
|
||||
path: /etc/rsyslog.conf
|
||||
|
|
@ -107,7 +107,7 @@
|
|||
insertafter: '# Log all the mail messages in one place.'
|
||||
notify: Restart rsyslog
|
||||
|
||||
- name: "6.2.3.5 | PATCH | Ensure logging is configured | news.crit log setting"
|
||||
- name: "6.2.3.5 | PATCH | Ensure rsyslog logging is configured | news.crit log setting"
|
||||
when: rhel9cis_rsyslog_ansiblemanaged
|
||||
ansible.builtin.blockinfile:
|
||||
path: /etc/rsyslog.conf
|
||||
|
|
@ -120,7 +120,7 @@
|
|||
insertafter: '# Save news errors of level crit and higher in a special file.'
|
||||
notify: Restart rsyslog
|
||||
|
||||
- name: "6.2.3.5 | PATCH | Ensure logging is configured | Misc. log setting"
|
||||
- name: "6.2.3.5 | PATCH | Ensure rsyslog logging is configured | Misc. log setting"
|
||||
when: rhel9cis_rsyslog_ansiblemanaged
|
||||
ansible.builtin.blockinfile:
|
||||
path: /etc/rsyslog.conf
|
||||
|
|
@ -134,7 +134,7 @@
|
|||
insertbefore: '# ### sample forwarding rule ###'
|
||||
notify: Restart rsyslog
|
||||
|
||||
- name: "6.2.3.5 | PATCH | Ensure logging is configured | Local log settings"
|
||||
- name: "6.2.3.5 | PATCH | Ensure rsyslog logging is configured | Local log settings"
|
||||
ansible.builtin.blockinfile:
|
||||
path: /etc/rsyslog.conf
|
||||
state: present
|
||||
|
|
@ -149,7 +149,7 @@
|
|||
insertafter: '#### RULES ####'
|
||||
notify: Restart rsyslog
|
||||
|
||||
- name: "6.2.3.5 | PATCH | Ensure logging is configured | Auth Settings"
|
||||
- name: "6.2.3.5 | PATCH | Ensure rsyslog logging is configured | Auth Settings"
|
||||
ansible.builtin.blockinfile:
|
||||
path: /etc/rsyslog.conf
|
||||
state: present
|
||||
|
|
@ -160,7 +160,7 @@
|
|||
insertafter: '#### RULES ####'
|
||||
notify: Restart rsyslog
|
||||
|
||||
- name: "6.2.3.5 | PATCH | Ensure logging is configured | Cron Settings"
|
||||
- name: "6.2.3.5 | PATCH | Ensure rsyslog logging is configured | Cron Settings"
|
||||
ansible.builtin.blockinfile:
|
||||
path: /etc/rsyslog.conf
|
||||
state: present
|
||||
|
|
@ -208,7 +208,7 @@
|
|||
- NIST800-53R5_AU-12
|
||||
- NIST800-53R5_CM-6
|
||||
block:
|
||||
- name: "6.2.3.7 | PATCH | Ensure rsyslog is not configured to receive logs from a remote client. | When not log host"
|
||||
- name: "6.2.3.7 | PATCH | Ensure rsyslog is not configured to receive logs from a remote client | When not log host"
|
||||
when: not rhel9cis_system_is_log_server
|
||||
ansible.builtin.replace:
|
||||
path: /etc/rsyslog.conf
|
||||
|
|
@ -221,7 +221,7 @@
|
|||
- '^(module\(load="imtcp"\))'
|
||||
- '^(input\(type="imtcp")'
|
||||
|
||||
- name: "6.2.3.7 | PATCH | Ensure rsyslog is not configured to receive logs from a remote clients. | When log host"
|
||||
- name: "6.2.3.7 | PATCH | Ensure rsyslog is not configured to receive logs from a remote client | When log host"
|
||||
when: rhel9cis_system_is_log_server
|
||||
ansible.builtin.replace:
|
||||
path: /etc/rsyslog.conf
|
||||
|
|
@ -254,7 +254,7 @@
|
|||
state: started
|
||||
enabled: true
|
||||
|
||||
- name: "6.2.3.8 | PATCH | Ensure logrotate is configured | set rsyslog conf"
|
||||
- name: "6.2.3.8 | PATCH | Ensure rsyslog logrotate is configured | set rsyslog conf"
|
||||
ansible.builtin.template:
|
||||
src: etc/logrotate.d/rsyslog_log.j2
|
||||
dest: /etc/logrotate.d/rsyslog_log
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
|
||||
- name: "6.3.1.1 | PATCH | Ensure auditd is installed"
|
||||
- name: "6.3.1.1 | PATCH | Ensure auditd packages are installed"
|
||||
when: rhel9cis_rule_6_3_1_1
|
||||
tags:
|
||||
- level2-server
|
||||
|
|
@ -13,13 +13,13 @@
|
|||
- NIST800-53R5_AU-12
|
||||
- NIST800-53R5_SI-5
|
||||
block:
|
||||
- name: "6.3.1.1 | PATCH | Ensure auditd is installed | Install auditd packages"
|
||||
- name: "6.3.1.1 | PATCH | Ensure auditd packages are installed | Install auditd packages"
|
||||
when: '"auditd" not in ansible_facts.packages'
|
||||
ansible.builtin.package:
|
||||
name: audit
|
||||
state: present
|
||||
|
||||
- name: "6.3.1.1 | PATCH | Ensure auditd is installed | Install auditd-lib packages"
|
||||
- name: "6.3.1.1 | PATCH | Ensure auditd packages are installed | Install auditd-lib packages"
|
||||
when: '"auditd-lib" not in ansible_facts.packages'
|
||||
ansible.builtin.package:
|
||||
name: audit-libs
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@
|
|||
update_audit_template: true
|
||||
|
||||
# All changes selected are managed by the POST audit and handlers to update
|
||||
- name: "6.3.3.6 | PATCH | Ensure use of privileged commands is collected"
|
||||
- name: "6.3.3.6 | PATCH | Ensure use of privileged commands are collected"
|
||||
when: rhel9cis_rule_6_3_3_6
|
||||
tags:
|
||||
- level2-server
|
||||
|
|
@ -77,14 +77,14 @@
|
|||
- rule_6.3.3.6
|
||||
- NIST800-53R5_AU-3
|
||||
block:
|
||||
- name: "6.3.3.6 | PATCH | Ensure use of privileged commands is collected"
|
||||
- name: "6.3.3.6 | PATCH | Ensure use of privileged commands are collected"
|
||||
ansible.builtin.shell: for i in $(df | grep '^/dev' | awk '{ print $NF }'); do find $i -xdev -type f -perm /6000 2>/dev/null; done
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
check_mode: false
|
||||
register: discovered_priv_procs
|
||||
|
||||
- name: "6.3.3.6 | PATCH | Ensure use of privileged commands is collected"
|
||||
- name: "6.3.3.6 | PATCH | Ensure use of privileged commands are collected"
|
||||
ansible.builtin.set_fact:
|
||||
update_audit_template: true
|
||||
notify: update auditd
|
||||
|
|
@ -197,11 +197,11 @@
|
|||
update_audit_template: true
|
||||
|
||||
# All changes selected are managed by the POST audit and handlers to update
|
||||
- name: "6.3.3.15 | PATCH | Ensure successful and unsuccessful attempts to use the chcon command are recorded"
|
||||
- name: "6.3.3.15 | PATCH | Ensure successful and unsuccessful attempts to use the chcon command are collected"
|
||||
when: rhel9cis_rule_6_3_3_15
|
||||
tags:
|
||||
- level2-server
|
||||
- level2- workstation
|
||||
- level2-workstation
|
||||
- patch
|
||||
- auditd
|
||||
- rule_6.3.3.15
|
||||
|
|
@ -212,7 +212,7 @@
|
|||
update_audit_template: true
|
||||
|
||||
# All changes selected are managed by the POST audit and handlers to update
|
||||
- name: "6.3.3.16 | PATCH | Ensure successful and unsuccessful attempts to use the setfacl command are recorded"
|
||||
- name: "6.3.3.16 | PATCH | Ensure successful and unsuccessful attempts to use the setfacl command are collected"
|
||||
when: rhel9cis_rule_6_3_3_16
|
||||
tags:
|
||||
- level2-server
|
||||
|
|
@ -227,7 +227,7 @@
|
|||
update_audit_template: true
|
||||
|
||||
# All changes selected are managed by the POST audit and handlers to update
|
||||
- name: "6.3.3.17 | PATCH | Ensure successful and unsuccessful attempts to use the chacl command are recorded"
|
||||
- name: "6.3.3.17 | PATCH | Ensure successful and unsuccessful attempts to use the chacl command are collected"
|
||||
when: rhel9cis_rule_6_3_3_17
|
||||
tags:
|
||||
- level2-server
|
||||
|
|
@ -242,7 +242,7 @@
|
|||
update_audit_template: true
|
||||
|
||||
# All changes selected are managed by the POST audit and handlers to update
|
||||
- name: "6.3.3.18 | PATCH | Ensure successful and unsuccessful attempts to use the usermod command are recorded"
|
||||
- name: "6.3.3.18 | PATCH | Ensure successful and unsuccessful attempts to use the usermod command are collected"
|
||||
when: rhel9cis_rule_6_3_3_18
|
||||
tags:
|
||||
- level2-server
|
||||
|
|
@ -257,7 +257,7 @@
|
|||
update_audit_template: true
|
||||
|
||||
# All changes selected are managed by the POST audit and handlers to update
|
||||
- name: "6.3.3.19 | PATCH | Ensure kernel module loading and unloading and modification is collected"
|
||||
- name: "6.3.3.19 | PATCH | Ensure kernel module loading unloading and modification is collected"
|
||||
when: rhel9cis_rule_6_3_3_19
|
||||
tags:
|
||||
- level2-server
|
||||
|
|
@ -295,9 +295,9 @@
|
|||
- auditd
|
||||
- rule_6.3.3.21
|
||||
- NIST800-53R5_AU-3
|
||||
ansible.builtin.debug:
|
||||
msg:
|
||||
- "Please run augenrules --load if you suspect there is a configuration that is not active"
|
||||
ansible.builtin.command: augenrules --check
|
||||
changed_when: false
|
||||
register: discovered_augenrules_check
|
||||
|
||||
- name: Auditd | 6.3.3.x | Auditd controls updated
|
||||
when: update_audit_template
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue