mirror of
https://github.com/ansible-lockdown/RHEL9-CIS.git
synced 2025-12-24 22:23:06 +00:00
added warning count
Signed-off-by: Mark Bolwell <mark.bollyuk@gmail.com>
This commit is contained in:
parent
c494559882
commit
6b6a4a32c8
17 changed files with 219 additions and 71 deletions
|
|
@ -1,11 +1,30 @@
|
|||
---
|
||||
|
||||
- name: "1.1.2.1 | PATCH | Ensure /tmp is a separate partition"
|
||||
debug:
|
||||
msg: "Warning! /tmp is not mounted on a separate partition"
|
||||
block:
|
||||
- name: "1.1.2.1 | PATCH | Ensure /tmp is a separate partition | Absent"
|
||||
debug:
|
||||
msg: "Warning!! /tmp is not mounted on a separate partition"
|
||||
when:
|
||||
- required_mount not in mount_names
|
||||
|
||||
- name: "1.1.2.1 | PATCH | Ensure /tmp is a separate partition | Warn Count"
|
||||
set_fact:
|
||||
control_number: "{{ control_number }} + [ 'rule_1.1.2.1' ]"
|
||||
warn_count: "{{ warn_count|int + 1 }}"
|
||||
when:
|
||||
- required_mount not in mount_names
|
||||
|
||||
- name: "1.1.3.1 | AUDIT | Ensure separate partition exists for /var | Present"
|
||||
debug:
|
||||
msg: "Congratulations: {{ required_mount }} exists."
|
||||
register: var_mount_present
|
||||
when:
|
||||
- required_mount in mount_names
|
||||
vars:
|
||||
required_mount: '/tmp'
|
||||
when:
|
||||
- rhel9cis_rule_1_1_2_1
|
||||
- ansible_mounts | selectattr('mount', 'match', '^/tmp$') | list | length == 0
|
||||
tags:
|
||||
- level1-server
|
||||
- level1-workstation
|
||||
|
|
@ -68,7 +87,6 @@
|
|||
tags:
|
||||
- level1-server
|
||||
- level1-workstation
|
||||
- scored
|
||||
- patch
|
||||
- mounts
|
||||
- rule_1.1.2.1
|
||||
|
|
|
|||
|
|
@ -4,12 +4,19 @@
|
|||
block:
|
||||
- name: "1.1.3.1 | AUDIT | Ensure separate partition exists for /var | Absent"
|
||||
debug:
|
||||
msg: "Warning! {{ required_mount }} doesn't exist. This is a manual task"
|
||||
msg: "Warning!! {{ required_mount }} doesn't exist. This is a manual task"
|
||||
register: var_mount_absent
|
||||
changed_when: var_mount_absent.skipped is undefined
|
||||
when:
|
||||
- required_mount not in mount_names
|
||||
|
||||
- name: "1.1.3.1 | AUDIT | Ensure separate partition exists for /var | Warn Count"
|
||||
set_fact:
|
||||
control_number: "{{ control_number }} + [ 'rule_1.1.3.1' ]"
|
||||
warn_count: "{{ warn_count|int + 1 }}"
|
||||
when:
|
||||
- required_mount not in mount_names
|
||||
|
||||
- name: "1.1.3.1 | AUDIT | Ensure separate partition exists for /var | Present"
|
||||
debug:
|
||||
msg: "Congratulations: {{ required_mount }} exists."
|
||||
|
|
@ -38,7 +45,7 @@
|
|||
src: "{{ item.device }}"
|
||||
fstype: "{{ item.fstype }}"
|
||||
state: present
|
||||
opts: defaults,{% if rhel9cis_rule_1_1_3_2 %}nodev,{% endif %}{% if rhel9cis_rule_1_1_3_3 %}noexec,{% endif %}{% if rhel9cis_rule_1_1_3_4 %}nosuid{% endif %}
|
||||
opts: defaults,{% if rhel9cis_rule_1_1_3_3 %}noexec,{% endif %}{% if rhel9cis_rule_1_1_3_2 %}nodev,{% endif %}{% if rhel9cis_rule_1_1_3_4 %}nosuid{% endif %}
|
||||
with_items:
|
||||
- "{{ ansible_mounts }}"
|
||||
loop_control:
|
||||
|
|
|
|||
|
|
@ -5,12 +5,19 @@
|
|||
block:
|
||||
- name: "1.1.4.1 | AUDIT | Ensure separate partition exists for /var/tmp | Absent"
|
||||
debug:
|
||||
msg: "Warning! {{ required_mount }} doesn't exist. This is a manual task"
|
||||
msg: "Warning!! {{ required_mount }} doesn't exist. This is a manual task"
|
||||
register: var_tmp_mount_absent
|
||||
changed_when: var_tmp_mount_absent.skipped is undefined
|
||||
when:
|
||||
- required_mount not in mount_names
|
||||
|
||||
- name: "1.1.4.1 | AUDIT | Ensure separate partition exists for /var/tmp | Warn Count"
|
||||
set_fact:
|
||||
control_number: "{{ control_number }} + [ 'rule_1.1.4.1' ]"
|
||||
warn_count: "{{ warn_count|int + 1 }}"
|
||||
when:
|
||||
- required_mount not in mount_names
|
||||
|
||||
- name: "1.1.4.1 | AUDIT | Ensure separate partition exists for /var/tmp | Present"
|
||||
debug:
|
||||
msg: "Congratulations: {{ required_mount }} exists."
|
||||
|
|
@ -39,7 +46,7 @@
|
|||
src: "{{ item.device }}"
|
||||
fstype: "{{ item.fstype }}"
|
||||
state: present
|
||||
opts: defaults,{% if rhel9cis_rule_1_1_4_2 %}noexec,{% endif %}{% if rhel9cis_rule_1_1_4_3 %}nosuid,{% endif %}{% if rhel9cis_rule_1_1_4_4 %}nodev{% endif %}
|
||||
opts: defaults,{% if rhel9cis_rule_1_1_4_2 %}noexec,{% endif %}{% if rhel9cis_rule_1_1_4_4 %}nodev,{% endif %}{% if rhel9cis_rule_1_1_4_3 %}nosuid{% endif %}
|
||||
with_items:
|
||||
- "{{ ansible_mounts }}"
|
||||
loop_control:
|
||||
|
|
@ -61,4 +68,4 @@
|
|||
- skip_ansible_lint
|
||||
- rule_1.1.4.2
|
||||
- rule_1.1.4.3
|
||||
- rule_1.1.4.4
|
||||
- rule_1.1.4.4
|
||||
|
|
@ -4,11 +4,19 @@
|
|||
block:
|
||||
- name: "1.1.5.1 | AUDIT | Ensure separate partition exists for /var/log | Absent"
|
||||
debug:
|
||||
msg: "Warning! {{ required_mount }} doesn't exist. This is a manual task"
|
||||
msg: "Warning!! {{ required_mount }} doesn't exist. This is a manual task"
|
||||
register: var_log_mount_absent
|
||||
changed_when: var_log_mount_absent.skipped is undefined
|
||||
when:
|
||||
- required_mount not in mount_names
|
||||
|
||||
- name: "1.1.5.1 | AUDIT | Ensure separate partition exists for /var/log | Warn Count"
|
||||
set_fact:
|
||||
control_number: "{{ control_number }} + [ 'rule_1.1.5.1' ]"
|
||||
warn_count: "{{ warn_count|int + 1 }}"
|
||||
when:
|
||||
- required_mount not in mount_names
|
||||
|
||||
- name: "1.1.5.1 | AUDIT | Ensure separate partition exists for /var/log | Present"
|
||||
debug:
|
||||
msg: "Congratulations: {{ required_mount }} exists."
|
||||
|
|
@ -37,7 +45,7 @@
|
|||
src: "{{ item.device }}"
|
||||
fstype: "{{ item.fstype }}"
|
||||
state: present
|
||||
opts: defaults,{% if rhel9cis_rule_1_1_5_2 %}nodev,{% endif %}{% if rhel9cis_rule_1_1_5_3 %}noexec,{% endif %}{% if rhel9cis_rule_1_1_5_4 %}nosuid{% endif %}
|
||||
opts: defaults,{% if rhel9cis_rule_1_1_5_3 %}noexec,{% endif %}{% if rhel9cis_rule_1_1_5_2 %}nodev,{% endif %}{% if rhel9cis_rule_1_1_5_4 %}nosuid{% endif %}
|
||||
with_items:
|
||||
- "{{ ansible_mounts }}"
|
||||
loop_control:
|
||||
|
|
|
|||
|
|
@ -4,11 +4,19 @@
|
|||
block:
|
||||
- name: "1.1.6.1 | AUDIT | Ensure separate partition exists for /var/log/audit | Absent"
|
||||
debug:
|
||||
msg: "Warning! {{ required_mount }} doesn't exist. This is a manual task"
|
||||
msg: "Warning!! {{ required_mount }} doesn't exist. This is a manual task"
|
||||
register: var_log_audit_mount_absent
|
||||
changed_when: var_log_audit_mount_absent.skipped is undefined
|
||||
when:
|
||||
- required_mount not in mount_names
|
||||
|
||||
- name: "1.1.6.1 | AUDIT | Ensure separate partition exists for /var/log/audit | Warn Count"
|
||||
set_fact:
|
||||
control_number: "{{ control_number }} + [ 'rule_1.1.6.1' ]"
|
||||
warn_count: "{{ warn_count|int + 1 }}"
|
||||
when:
|
||||
- required_mount not in mount_names
|
||||
|
||||
- name: "1.1.6.1 | AUDIT | Ensure separate partition exists for /var/log/audit | Present"
|
||||
debug:
|
||||
msg: "Congratulations: {{ required_mount }} exists."
|
||||
|
|
@ -58,4 +66,4 @@
|
|||
- skip_ansible_lint
|
||||
- rule_1.1.6.2
|
||||
- rule_1.1.6.3
|
||||
- rule_1.1.6.4
|
||||
- rule_1.1.6.4
|
||||
|
|
@ -4,11 +4,19 @@
|
|||
block:
|
||||
- name: "1.1.7.1 | AUDIT | Ensure separate partition exists for /home | Absent"
|
||||
debug:
|
||||
msg: "Warning! {{ required_mount }} doesn't exist. This is a manual task"
|
||||
msg: "Warning!! {{ required_mount }} doesn't exist. This is a manual task"
|
||||
register: home_mount_absent
|
||||
changed_when: home_mount_absent.skipped is undefined
|
||||
when:
|
||||
- required_mount not in mount_names
|
||||
|
||||
- name: "1.1.7.1 | AUDIT | Ensure separate partition exists for /home | Warn Count"
|
||||
set_fact:
|
||||
control_number: "{{ control_number }} + [ 'rule_1.1.7.1' ]"
|
||||
warn_count: "{{ warn_count|int + 1 }}"
|
||||
when:
|
||||
- required_mount not in mount_names
|
||||
|
||||
- name: "1.1.7.1 | AUDIT | Ensure separate partition exists for /home | Present"
|
||||
debug:
|
||||
msg: "Congratulations: {{ required_mount }} exists."
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
src: tmpfs
|
||||
fstype: tmpfs
|
||||
state: mounted
|
||||
opts: defaults,{% if rhel9cis_rule_1_1_8_1 %}nodev,{% endif %}{% if rhel9cis_rule_1_1_8_2 %}noexec,{% endif %}{% if rhel9cis_rule_1_1_8_3 %}nosuid{% endif %}
|
||||
opts: defaults,{% if rhel9cis_rule_1_1_8_2 %}noexec,{% endif %}{% if rhel9cis_rule_1_1_8_1 %}nodev,{% endif %}{% if rhel9cis_rule_1_1_8_3 %}nosuid{% endif %}
|
||||
when: "'dev/shm' in rhel9cis_1_1_8_x_dev_shm_status.stdout"
|
||||
notify: change_requires_reboot
|
||||
when:
|
||||
|
|
|
|||
|
|
@ -25,7 +25,8 @@
|
|||
when:
|
||||
- rhel9cis_rule_1_2_2
|
||||
- ansible_distribution == "RedHat" or
|
||||
ansible_distribution == "Rocky"
|
||||
ansible_distribution == "Rocky" or
|
||||
ansible_distribution == "AlmaLinux"
|
||||
tags:
|
||||
- level1-server
|
||||
- level1-workstation
|
||||
|
|
@ -45,7 +46,7 @@
|
|||
- name: "1.2.3 | PATCH | Ensure gpgcheck is globally activated | Update yum.repos"
|
||||
replace:
|
||||
name: "{{ item.path }}"
|
||||
regexp: '^gpgcheck\s+=\s+0'
|
||||
regexp: "^gpgcheck=0"
|
||||
replace: "gpgcheck=1"
|
||||
with_items:
|
||||
- "{{ yum_repos.files }}"
|
||||
|
|
@ -74,8 +75,13 @@
|
|||
- name: "1.2.4 | AUDIT | Ensure package manager repositories are configured | Display repo list"
|
||||
debug:
|
||||
msg:
|
||||
- "Warning! Below are the configured repos. Please review and make sure all align with site policy"
|
||||
- "Warning!! Below are the configured repos. Please review and make sure all align with site policy"
|
||||
- "{{ dnf_configured.stdout_lines }}"
|
||||
|
||||
- name: "1.2.4 | AUDIT | Ensure package manager repositories are configured | Warn Count"
|
||||
set_fact:
|
||||
control_number: "{{ control_number }} + ['rule_1.2.4']"
|
||||
warn_count: "{{ warn_count|int + 1 }}"
|
||||
when:
|
||||
- rhel9cis_rule_1_2_4
|
||||
tags:
|
||||
|
|
|
|||
|
|
@ -80,6 +80,12 @@
|
|||
debug:
|
||||
msg: "Warning! You have unconfined services: {{ rhelcis_1_6_1_5_unconf_services.stdout_lines }}"
|
||||
when: rhelcis_1_6_1_5_unconf_services.stdout | length > 0
|
||||
|
||||
- name: "1.6.1.5 | AUDIT | Ensure no unconfined services exist | warning count"
|
||||
set_fact:
|
||||
control_number: "{{ control_number }} + [ 'rule_1.6.1.5 ]"
|
||||
warn_count: "{{ warn_count|int + 1 }}"
|
||||
when: rhelcis_1_6_1_5_unconf_services.stdout | length > 0
|
||||
when:
|
||||
- rhel9cis_rule_1_6_1_5
|
||||
tags:
|
||||
|
|
@ -115,4 +121,4 @@
|
|||
- level1-workstation
|
||||
- automated
|
||||
- patch
|
||||
- rule_1.6.1.7
|
||||
- rule_1.6.1.7
|
||||
Loading…
Add table
Add a link
Reference in a new issue