mirror of
https://github.com/ansible-lockdown/RHEL9-CIS.git
synced 2025-12-24 14:23:05 +00:00
rhel_09 updates
Signed-off-by: Mark Bolwell <mark.bollyuk@gmail.com>
This commit is contained in:
parent
b5c57abc33
commit
0350e234fe
4 changed files with 43 additions and 43 deletions
|
|
@ -31,20 +31,20 @@
|
|||
changed_when: false
|
||||
failed_when: false
|
||||
check_mode: false
|
||||
register: rhel_08_nmcli_available
|
||||
register: rhel_09_nmcli_available
|
||||
|
||||
- name: "3.1.2 | AUDIT | Ensure wireless interfaces are disabled | Check if wifi is enabled"
|
||||
ansible.builtin.shell: nmcli radio wifi
|
||||
register: rhel_08_wifi_enabled
|
||||
changed_when: rhel_08_wifi_enabled.stdout != "disabled"
|
||||
register: rhel_09_wifi_enabled
|
||||
changed_when: rhel_09_wifi_enabled.stdout != "disabled"
|
||||
failed_when: false
|
||||
when: rhel_08_nmcli_available.rc == 0
|
||||
when: rhel_09_nmcli_available.rc == 0
|
||||
|
||||
- name: "3.1.2 | PATCH | Ensure wireless interfaces are disabled | Disable wifi if enabled"
|
||||
ansible.builtin.shell: nmcli radio all off
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
when: rhel_08_wifi_enabled is changed
|
||||
when: rhel_09_wifi_enabled is changed
|
||||
when:
|
||||
- rhel9cis_rule_3_1_2
|
||||
tags:
|
||||
|
|
|
|||
|
|
@ -64,13 +64,13 @@
|
|||
changed_when: false
|
||||
failed_when: false
|
||||
check_mode: false
|
||||
register: rhel_08_4_2_1_5_audit
|
||||
register: rhel_09_4_2_1_5_audit
|
||||
|
||||
- name: "4.2.1.5 | AUDIT | Ensure logging is configured | rsyslog current config message out"
|
||||
ansible.builtin.debug:
|
||||
msg:
|
||||
- "These are the current logging configurations for rsyslog, please review:"
|
||||
- "{{ rhel_08_4_2_1_5_audit.stdout_lines }}"
|
||||
- "{{ rhel_09_4_2_1_5_audit.stdout_lines }}"
|
||||
|
||||
- name: "4.2.1.5 | PATCH | Ensure logging is configured | mail.* log setting"
|
||||
ansible.builtin.blockinfile:
|
||||
|
|
|
|||
|
|
@ -126,16 +126,16 @@
|
|||
ansible.builtin.shell: df --local -P | awk {'if (NR!=1) print $6'} | xargs -I '{}' find '{}' -xdev -type f -perm -0002
|
||||
failed_when: false
|
||||
changed_when: false
|
||||
register: rhel_08_6_1_9_perms_results
|
||||
register: rhel_09_6_1_9_perms_results
|
||||
|
||||
- name: "6.1.9 | PATCH | Ensure no world writable files exist | Adjust world-writable files if they exist (Configurable)"
|
||||
ansible.builtin.file:
|
||||
path: '{{ item }}'
|
||||
mode: o-w
|
||||
state: touch
|
||||
with_items: "{{ rhel_08_6_1_9_perms_results.stdout_lines }}"
|
||||
with_items: "{{ rhel_09_6_1_9_perms_results.stdout_lines }}"
|
||||
when:
|
||||
- rhel_08_6_1_9_perms_results.stdout_lines is defined
|
||||
- rhel_09_6_1_9_perms_results.stdout_lines is defined
|
||||
- rhel9cis_no_world_write_adjust
|
||||
when:
|
||||
- rhel9cis_rule_6_1_9
|
||||
|
|
@ -154,7 +154,7 @@
|
|||
changed_when: false
|
||||
failed_when: false
|
||||
check_mode: false
|
||||
register: rhel_08_6_1_10_audit
|
||||
register: rhel_09_6_1_10_audit
|
||||
with_items: "{{ ansible_mounts }}"
|
||||
loop_control:
|
||||
label: "{{ item.mount }}"
|
||||
|
|
@ -163,7 +163,7 @@
|
|||
- name: "6.1.10 | AUDIT | Ensure no unowned files or directories exist | Displaying any unowned files or directories"
|
||||
ansible.builtin.debug:
|
||||
msg: "Warning !! Manual intervention is required -- missing owner on items in {{ item.item.mount }}: {{ item.stdout_lines | join(', ') }}"
|
||||
with_items: "{{ rhel_08_6_1_10_audit.results }}"
|
||||
with_items: "{{ rhel_09_6_1_10_audit.results }}"
|
||||
when:
|
||||
- item.stdout_lines is defined
|
||||
- item.stdout_lines | length > 0
|
||||
|
|
@ -193,7 +193,7 @@
|
|||
check_mode: false
|
||||
failed_when: false
|
||||
changed_when: false
|
||||
register: rhel_08_6_1_11_audit
|
||||
register: rhel_09_6_1_11_audit
|
||||
with_items: "{{ ansible_mounts }}"
|
||||
loop_control:
|
||||
label: "{{ item.mount }}"
|
||||
|
|
@ -202,7 +202,7 @@
|
|||
- name: "6.1.11 | AUDIT | Ensure no ungrouped files or directories exist | Displaying all ungrouped files or directories"
|
||||
ansible.builtin.debug:
|
||||
msg: "Warning !! Manual intervention is required -- missing group on items in {{ item.item.mount }}: {{ item.stdout_lines | join(', ') }}"
|
||||
with_items: "{{ rhel_08_6_1_11_audit.results }}"
|
||||
with_items: "{{ rhel_09_6_1_11_audit.results }}"
|
||||
when:
|
||||
- item.stdout_lines is defined
|
||||
- item.stdout_lines | length > 0
|
||||
|
|
@ -244,7 +244,7 @@
|
|||
ansible.builtin.shell: df {{ item.mount }} -P | awk {'if (NR!=1) print $6'} | xargs -I '{}' find '{}' -xdev -type f -perm -4000
|
||||
failed_when: false
|
||||
changed_when: false
|
||||
register: rhel_08_6_1_13_perms_results
|
||||
register: rhel_09_6_1_13_perms_results
|
||||
with_items: "{{ ansible_mounts }}"
|
||||
loop_control:
|
||||
label: "{{ item.mount }}"
|
||||
|
|
@ -252,16 +252,16 @@
|
|||
- name: "6.1.13 | AUDIT | Audit SUID executables | Alert SUID executables exist"
|
||||
ansible.builtin.debug:
|
||||
msg: "Warning!! Manual intervention is required -- SUID set on items in {{ item.item.mount }}: {{ item.stout_lines | join(', ') }}"
|
||||
with_items: "{{ rhel_08_6_1_13_perms_results.stdout_lines }}"
|
||||
with_items: "{{ rhel_09_6_1_13_perms_results.stdout_lines }}"
|
||||
when:
|
||||
- rhel_08_6_1_13_perms_results.stdout is defined
|
||||
- rhel_09_6_1_13_perms_results.stdout is defined
|
||||
|
||||
- name: "6.1.13 | AUDIT | Audit SUID executables | Alert SUID executables exist | warning"
|
||||
ansible.builtin.import_tasks: warning_facts.yml
|
||||
vars:
|
||||
warn_control_id: '6.1.13'
|
||||
when:
|
||||
- rhel_08_6_1_13_perms_results.stdout is defined
|
||||
- rhel_09_6_1_13_perms_results.stdout is defined
|
||||
when:
|
||||
- rhel9cis_rule_6_1_13
|
||||
tags:
|
||||
|
|
@ -278,7 +278,7 @@
|
|||
ansible.builtin.shell: df {{ item.mount }} -P | awk {'if (NR!=1) print $6'} | xargs -I '{}' find '{}' -xdev -type f -perm -2000
|
||||
failed_when: false
|
||||
changed_when: false
|
||||
register: rhel_08_6_1_14_perms_results
|
||||
register: rhel_09_6_1_14_perms_results
|
||||
with_items: "{{ ansible_mounts }}"
|
||||
loop_control:
|
||||
label: "{{ item.mount }}"
|
||||
|
|
@ -286,16 +286,16 @@
|
|||
- name: "6.1.14 | AUDIT | Audit SGID executables | Alert SGID executables exist"
|
||||
ansible.builtin.debug:
|
||||
msg: "Manual intervention is required -- SGID set on items in {{ item.item.mount }}: {{ item.stout_lines | join(', ') }}"
|
||||
with_items: "{{ rhel_08_6_1_14_perms_results.stdout_lines }}"
|
||||
with_items: "{{ rhel_09_6_1_14_perms_results.stdout_lines }}"
|
||||
when:
|
||||
- rhel_08_6_1_14_perms_results.stdout is defined
|
||||
- rhel_09_6_1_14_perms_results.stdout is defined
|
||||
|
||||
- name: "6.1.14 | AUDIT | Audit SGID executables| warning"
|
||||
ansible.builtin.import_tasks: warning_facts.yml
|
||||
vars:
|
||||
warn_control_id: '6.1.14'
|
||||
when:
|
||||
- rhel_08_6_1_14_perms_results.stdout is defined
|
||||
- rhel_09_6_1_14_perms_results.stdout is defined
|
||||
when:
|
||||
- rhel9cis_rule_6_1_14
|
||||
tags:
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@
|
|||
|
||||
- name: "6.2.3 | AUDIT | Ensure all groups in /etc/passwd exist in /etc/group | Print warning about users with invalid GIDs missing GID entries in /etc/group"
|
||||
ansible.builtin.debug:
|
||||
msg: "Warning!! The following users have non-existent GIDs (Groups): {{ rhel9cis_6_2_2_passwd_gid_check.stdout_lines | join (', ') }}"
|
||||
msg: "Warning!! The following users have non-existent GIDs (Groups): {{ rhel9cis_6_2_3_passwd_gid_check.stdout_lines | join (', ') }}"
|
||||
when: rhel9cis_6_2_3_passwd_gid_check.stdout | length >= 1
|
||||
|
||||
- name: "6.2.3 | AUDIT | Ensure all groups in /etc/passwd exist in /etc/group | warning count"
|
||||
|
|
@ -64,7 +64,7 @@
|
|||
warn_control_id: '6.2.3'
|
||||
when: rhel9cis_6_2_3_passwd_gid_check.stdout | length >= 1
|
||||
when:
|
||||
- rhel9cis_rule_6_2_2
|
||||
- rhel9cis_rule_6_2_3
|
||||
tags:
|
||||
- level1-server
|
||||
- level1-workstation
|
||||
|
|
@ -140,7 +140,7 @@
|
|||
|
||||
- name: "6.2.6 | AUDIT | Ensure no duplicate user names exist | Print warning about users with duplicate User Names"
|
||||
ansible.builtin.debug:
|
||||
msg: "Warning!! The following user names are duplicates: {{ rhel9cis_6_2_5_user_username_check.stdout_lines }}"
|
||||
msg: "Warning!! The following user names are duplicates: {{ rhel9cis_6_2_6_user_username_check.stdout_lines }}"
|
||||
when: rhel9cis_6_2_6_user_username_check.stdout | length >= 1
|
||||
|
||||
- name: "6.2.6 | AUDIT | Ensure no duplicate user names exist | warning count"
|
||||
|
|
@ -256,20 +256,20 @@
|
|||
- name: "6.2.10 | AUDIT | Ensure local interactive user home directories exist"
|
||||
ansible.builtin.stat:
|
||||
path: "{{ item }}"
|
||||
register: rhel_08_6_2_10_audit
|
||||
register: rhel_09_6_2_10_audit
|
||||
with_items: "{{ rhel9cis_passwd | selectattr('uid', '>=', min_int_uid | int ) | selectattr('uid', '<=', max_int_uid | int ) | map(attribute='dir') | list }}"
|
||||
|
||||
- name: "6.2.10 | AUDIT | Ensure local interactive user home directories exist"
|
||||
ansible.builtin.shell: find -H {{ item.0 | quote }} -not -type l -perm /027
|
||||
check_mode: false
|
||||
changed_when: rhel_08_6_2_10_patch_audit.stdout | length > 0
|
||||
register: rhel_08_6_2_10_patch_audit
|
||||
changed_when: rhel_09_6_2_10_patch_audit.stdout | length > 0
|
||||
register: rhel_09_6_2_10_patch_audit
|
||||
when:
|
||||
- ansible_check_mode
|
||||
- item.1.exists
|
||||
with_together:
|
||||
- "{{ rhel_08_6_2_10_audit.results | map(attribute='item') | list }}"
|
||||
- "{{ rhel_08_6_2_10_audit.results | map(attribute='stat') | list }}"
|
||||
- "{{ rhel_09_6_2_10_audit.results | map(attribute='item') | list }}"
|
||||
- "{{ rhel_09_6_2_10_audit.results | map(attribute='stat') | list }}"
|
||||
loop_control:
|
||||
label: "{{ item.0 }}"
|
||||
|
||||
|
|
@ -278,13 +278,13 @@
|
|||
path: "{{ item.0 }}"
|
||||
recurse: true
|
||||
mode: a-st,g-w,o-rwx
|
||||
register: rhel_08_6_2_10_patch
|
||||
register: rhel_09_6_2_10_patch
|
||||
when:
|
||||
- not ansible_check_mode
|
||||
- item.1.exists
|
||||
with_together:
|
||||
- "{{ rhel_08_6_2_10_audit.results | map(attribute='item') | list }}"
|
||||
- "{{ rhel_08_6_2_10_audit.results | map(attribute='stat') | list }}"
|
||||
- "{{ rhel_09_6_2_10_audit.results | map(attribute='item') | list }}"
|
||||
- "{{ rhel_09_6_2_10_audit.results | map(attribute='stat') | list }}"
|
||||
loop_control:
|
||||
label: "{{ item.0 }}"
|
||||
|
||||
|
|
@ -300,7 +300,7 @@
|
|||
when:
|
||||
- not system_is_container
|
||||
with_nested:
|
||||
- "{{ (ansible_check_mode | ternary(rhel_08_6_2_10_patch_audit, rhel_08_6_2_10_patch)).results |
|
||||
- "{{ (ansible_check_mode | ternary(rhel_09_6_2_10_patch_audit, rhel_09_6_2_10_patch)).results |
|
||||
rejectattr('skipped', 'defined') | map(attribute='item') | map('first') | list }}"
|
||||
-
|
||||
- etype: group
|
||||
|
|
@ -343,19 +343,19 @@
|
|||
ansible.builtin.stat:
|
||||
path: "{{ item }}"
|
||||
with_items: "{{ rhel9cis_passwd | selectattr('uid', '>=', min_int_uid | int) | selectattr('uid', '<=', max_int_uid | int) | map(attribute='dir') | list }}"
|
||||
register: rhel_08_6_2_12_audit
|
||||
register: rhel_09_6_2_12_audit
|
||||
|
||||
- name: "6.2.12 | AUDIT | Ensure users' home directories permissions are 750 or more restrictive"
|
||||
ansible.builtin.shell: find -H {{ item.0 | quote }} -not -type l -perm /027
|
||||
check_mode: false
|
||||
changed_when: rhel_08_6_2_12_patch_audit.stdout | length > 0
|
||||
register: rhel_08_6_2_12_patch_audit
|
||||
changed_when: rhel_09_6_2_12_patch_audit.stdout | length > 0
|
||||
register: rhel_09_6_2_12_patch_audit
|
||||
when:
|
||||
- ansible_check_mode
|
||||
- item.1.exists
|
||||
with_together:
|
||||
- "{{ rhel_08_6_2_12_audit.results | map(attribute='item') | list }}"
|
||||
- "{{ rhel_08_6_2_12_audit.results | map(attribute='stat') | list }}"
|
||||
- "{{ rhel_09_6_2_12_audit.results | map(attribute='item') | list }}"
|
||||
- "{{ rhel_09_6_2_12_audit.results | map(attribute='stat') | list }}"
|
||||
loop_control:
|
||||
label: "{{ item.0 }}"
|
||||
|
||||
|
|
@ -364,13 +364,13 @@
|
|||
path: "{{ item.0 }}"
|
||||
recurse: true
|
||||
mode: a-st,g-w,o-rwx
|
||||
register: rhel_08_6_2_12_patch
|
||||
register: rhel_09_6_2_12_patch
|
||||
when:
|
||||
- not ansible_check_mode
|
||||
- item.1.exists
|
||||
with_together:
|
||||
- "{{ rhel_08_6_2_12_audit.results | map(attribute='item') | list }}"
|
||||
- "{{ rhel_08_6_2_12_audit.results | map(attribute='stat') | list }}"
|
||||
- "{{ rhel_09_6_2_12_audit.results | map(attribute='item') | list }}"
|
||||
- "{{ rhel_09_6_2_12_audit.results | map(attribute='stat') | list }}"
|
||||
loop_control:
|
||||
label: "{{ item.0 }}"
|
||||
|
||||
|
|
@ -386,7 +386,7 @@
|
|||
when:
|
||||
- not system_is_container
|
||||
with_nested:
|
||||
- "{{ (ansible_check_mode | ternary(rhel_08_6_2_12_patch_audit, rhel_08_6_2_12_patch)).results |
|
||||
- "{{ (ansible_check_mode | ternary(rhel_09_6_2_12_patch_audit, rhel_09_6_2_12_patch)).results |
|
||||
rejectattr('skipped', 'defined') | map(attribute='item') | map('first') | list }}"
|
||||
-
|
||||
- etype: group
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue