2022-01-07 09:06:18 +00:00
---
2023-01-13 10:04:33 +00:00
- name : "6.2.1 | AUDIT | Ensure accounts in /etc/passwd use shadowed passwords"
block :
- name : "6.2.1 | AUDIT | Ensure accounts in /etc/passwd use shadowed passwords | discover"
ansible.builtin.shell : awk -F':' '($2 != "x" ) { print $1 " is not set to shadowed passwords "}' /etc/passwd
register : shadow_passwd
- name : "6.2.1 | AUDIT | Ensure accounts in /etc/passwd use shadowed passwords | Output"
ansible.builtin.debug :
msg : |
- "Warning!! Below are the accounts that do not have shadowed passwords set"
- "{{ shadow_passwd.stdout_line }}"
when : shadow_passwd.stdout | length > 0
- name : "6.2.1 | AUDIT | Ensure accounts in /etc/passwd use shadowed passwords | warning fact"
ansible.builtin.import_tasks : warning_facts.yml
vars :
warn_control_id : '6.2.1'
when : shadow_passwd.stdout | length >= 1
when :
- rhel9cis_rule_6_2_1
tags :
- level1-server
- level1-workstation
- patch
- accounts
- rule_6.2.1
- name : "6.2.2 | PATCH | Ensure password fields are not empty"
ansible.builtin.shell : passwd -l {{ item }}
2022-01-07 09:06:18 +00:00
changed_when : false
failed_when : false
with_items : "{{ empty_password_accounts.stdout_lines }}"
when :
- empty_password_accounts.rc
2023-01-13 10:04:33 +00:00
- rhel9cis_rule_6_2_2
2022-01-07 09:06:18 +00:00
tags :
- level1-server
- level1-workstation
- patch
2022-03-30 16:18:11 +01:00
- accounts
2023-01-13 10:04:33 +00:00
- rule_6.2.2
2022-03-30 16:18:11 +01:00
2023-01-13 10:04:33 +00:00
- name : "6.2.3 | AUDIT | Ensure all groups in /etc/passwd exist in /etc/group"
2022-03-30 16:18:11 +01:00
block :
2023-01-13 10:04:33 +00:00
- name : "6.2.3 | AUDIT | Ensure all groups in /etc/passwd exist in /etc/group | Check /etc/passwd entries"
ansible.builtin.shell : pwck -r | grep 'no group' | awk '{ gsub("[:\47]",""); print $2}'
2022-03-30 16:18:11 +01:00
changed_when : false
failed_when : false
check_mode : false
2023-01-13 10:04:33 +00:00
register : rhel9cis_6_2_3_passwd_gid_check
2022-03-30 16:18:11 +01:00
2023-01-13 10:04:33 +00:00
- name : "6.2.3 | AUDIT | Ensure all groups in /etc/passwd exist in /etc/group | Print message that all groups match between passwd and group files"
ansible.builtin.debug :
2022-03-30 16:18:11 +01:00
msg : "Good News! There are no users that have non-existent GUIDs (Groups)"
2023-01-13 10:04:33 +00:00
when : rhel9cis_6_2_3_passwd_gid_check.stdout | length == 0
2022-03-30 16:18:11 +01:00
2023-01-13 10:04:33 +00:00
- 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 :
2022-07-20 17:13:33 +01:00
msg : "Warning!! The following users have non-existent GIDs (Groups): {{ rhel9cis_6_2_2_passwd_gid_check.stdout_lines | join (', ') }}"
2023-01-13 10:04:33 +00:00
when : rhel9cis_6_2_3_passwd_gid_check.stdout | length >= 1
2022-07-20 17:13:33 +01:00
2023-01-13 10:04:33 +00:00
- name : "6.2.3 | AUDIT | Ensure all groups in /etc/passwd exist in /etc/group | warning count"
ansible.builtin.import_tasks : warning_facts.yml
vars :
warn_control_id : '6.2.3'
when : rhel9cis_6_2_3_passwd_gid_check.stdout | length >= 1
2022-01-07 09:06:18 +00:00
when :
- rhel9cis_rule_6_2_2
tags :
- level1-server
- level1-workstation
2022-03-30 16:18:11 +01:00
- audit
- accounts
- groups
2022-01-07 09:06:18 +00:00
- rule_6.2.2
2023-01-13 10:04:33 +00:00
- name : "6.2.4 | AUDIT Ensure no duplicate UIDs exist"
2022-01-07 09:06:18 +00:00
block :
2023-01-13 10:04:33 +00:00
- name : "6.2.4 | AUDIT | Ensure no duplicate UIDs exist | Check for duplicate UIDs"
ansible.builtin.shell : "pwck -r | awk -F: '{if ($3 in uid) print $1 ; else uid[$3]}' /etc/passwd"
2022-03-30 16:18:11 +01:00
changed_when : false
failed_when : false
2023-01-13 10:04:33 +00:00
register : rhel9cis_6_2_4_user_uid_check
2022-01-07 09:06:18 +00:00
2023-01-13 10:04:33 +00:00
- name : "6.2.4 | AUDIT | Ensure no duplicate UIDs exist | Print warning about users with duplicate UIDs"
ansible.builtin.debug :
msg : "Warning!! The following users have UIDs that are duplicates: {{ rhel9cis_6_2_4_user_uid_check.stdout_lines }}"
when : rhel9cis_6_2_4_user_uid_check.stdout | length >= 1
- name : "6.2.4 | AUDIT| Ensure no duplicate UIDs exist | warning count"
ansible.builtin.import_tasks : warning_facts.yml
when : rhel9cis_6_2_4_user_uid_check.stdout | length >= 1
2023-01-13 11:05:25 +00:00
vars :
warn_control_id : '6.2.4'
2022-01-07 09:06:18 +00:00
when :
2023-01-13 10:04:33 +00:00
- rhel9cis_rule_6_2_4
2022-01-07 09:06:18 +00:00
tags :
- level1-server
- level1-workstation
2022-03-30 16:18:11 +01:00
- audit
- accounts
- users
2023-01-13 10:04:33 +00:00
- rule_6.2.4
2022-01-07 09:06:18 +00:00
2023-01-13 10:04:33 +00:00
- name : "6.2.5 | AUDIT | Ensure no duplicate GIDs exist"
2022-03-30 16:18:11 +01:00
block :
2023-01-13 10:04:33 +00:00
- name : "6.2.5 | AUDIT | Ensure no duplicate GIDs exist | Check for duplicate GIDs"
ansible.builtin.shell : "pwck -r | awk -F: '{if ($3 in users) print $1 ; else users[$3]}' /etc/group"
2022-03-30 16:18:11 +01:00
changed_when : false
failed_when : false
2023-01-13 10:04:33 +00:00
register : rhel9cis_6_2_5_user_user_check
2022-03-30 16:18:11 +01:00
2023-01-13 10:04:33 +00:00
- name : "6.2.5 | AUDIT | Ensure no duplicate GIDs exist | Print warning about users with duplicate GIDs"
ansible.builtin.debug :
msg : "Warning!! The following groups have duplicate GIDs: {{ rhel9cis_6_2_5_user_user_check.stdout_lines }}"
when : rhel9cis_6_2_5_user_user_check.stdout | length >= 1
2022-07-20 17:13:33 +01:00
2023-01-13 10:04:33 +00:00
- name : "6.2.5 | AUDIT | Ensure no duplicate GIDs exist | warning count"
ansible.builtin.import_tasks : warning_facts.yml
vars :
warn_control_id : '6.2.5'
when : rhel9cis_6_2_5_user_user_check.stdout_lines | length >= 1
2022-07-20 17:13:33 +01:00
2022-01-07 09:06:18 +00:00
when :
2023-01-13 10:04:33 +00:00
- rhel9cis_rule_6_2_5
2022-01-07 09:06:18 +00:00
tags :
- level1-server
- level1-workstation
2022-03-30 16:18:11 +01:00
- audit
- accounts
- groups
2023-01-13 10:04:33 +00:00
- rule_6.2.5
2022-01-07 09:06:18 +00:00
2023-01-13 10:04:33 +00:00
- name : "6.2.6 | AUDIT | Ensure no duplicate user names exist"
2022-03-30 16:18:11 +01:00
block :
2023-01-13 10:04:33 +00:00
- name : "6.2.6 | AUDIT | Ensure no duplicate user names exist | Check for duplicate User Names"
ansible.builtin.shell : "pwck -r | awk -F: '{if ($1 in users) print $1 ; else users[$1]}' /etc/passwd"
2022-03-30 16:18:11 +01:00
changed_when : false
failed_when : false
2023-01-13 10:04:33 +00:00
register : rhel9cis_6_2_6_user_username_check
2022-03-30 16:18:11 +01:00
2023-01-13 10:04:33 +00:00
- name : "6.2.6 | AUDIT | Ensure no duplicate user names exist | Print warning about users with duplicate User Names"
ansible.builtin.debug :
2022-07-20 17:13:33 +01:00
msg : "Warning!! The following user names are duplicates: {{ rhel9cis_6_2_5_user_username_check.stdout_lines }}"
2023-01-13 10:04:33 +00:00
when : rhel9cis_6_2_6_user_username_check.stdout | length >= 1
2022-07-20 17:13:33 +01:00
2023-01-13 10:04:33 +00:00
- name : "6.2.6 | AUDIT | Ensure no duplicate user names exist | warning count"
ansible.builtin.import_tasks : warning_facts.yml
vars :
warn_control_id : '6.2.6'
when : rhel9cis_6_2_6_user_username_check.stdout | length >= 1
2022-01-07 09:06:18 +00:00
when :
2023-01-13 10:04:33 +00:00
- rhel9cis_rule_6_2_6
2022-01-07 09:06:18 +00:00
tags :
- level1-server
- level1-workstation
2022-03-30 16:18:11 +01:00
- audit
- accounts
- users
2023-01-13 10:04:33 +00:00
- rule_6.2.6
2022-01-07 09:06:18 +00:00
2023-01-13 10:04:33 +00:00
- name : "6.2.7 | AUDIT | Ensure no duplicate group names exist"
2022-03-30 16:18:11 +01:00
block :
2023-01-13 10:04:33 +00:00
- name : "6.2.7 | AUDIT | Ensure no duplicate group names exist | Check for duplicate group names"
ansible.builtin.shell: 'getent passwd | cut -d : -f1 | sort -n | uniq -d'
2022-03-30 16:18:11 +01:00
changed_when : false
failed_when : false
2022-09-16 11:34:42 +01:00
check_mode : false
2023-01-13 10:04:33 +00:00
register : rhel9cis_6_2_7_group_group_check
- name : "6.2.7 | AUDIT | Ensure no duplicate group names exist | Print warning about users with duplicate group names"
ansible.builtin.debug :
msg : "Warning!! The following group names are duplicates: {{ rhel9cis_6_2_7_group_group_check.stdout_lines }}"
when : rhel9cis_6_2_7_group_group_check.stdout is not defined
- name : "6.2.7 | AUDIT | Ensure no duplicate group names exist | warning count"
ansible.builtin.import_tasks : warning_facts.yml
vars :
warn_control_id : '6.2.7'
when : rhel9cis_6_2_7_group_group_check.stdout is not defined
2022-03-30 16:18:11 +01:00
when :
2023-01-13 10:04:33 +00:00
- rhel9cis_rule_6_2_7
2022-03-30 16:18:11 +01:00
tags :
- level1-server
- level1-workstation
- audit
- accounts
- groups
2023-01-13 10:04:33 +00:00
- rule_6.2.7
2022-03-30 16:18:11 +01:00
2023-01-13 10:04:33 +00:00
- name : "6.2.8 | PATCH | Ensure root PATH Integrity"
2022-03-30 16:18:11 +01:00
block :
2023-01-13 10:04:33 +00:00
- name : "6.2.8 | AUDIT | Ensure root PATH Integrity | Determine empty value"
ansible.builtin.shell : 'echo $PATH | grep ::'
2022-09-16 11:34:42 +01:00
changed_when : false
2023-01-13 10:04:33 +00:00
failed_when : rhel9cis_6_2_8_path_colon.rc == 0
2022-09-16 11:34:42 +01:00
check_mode : false
2023-01-13 10:04:33 +00:00
register : rhel9cis_6_2_8_path_colon
2022-03-30 16:18:11 +01:00
2023-01-13 10:04:33 +00:00
- name : "6.2.8 | AUDIT | Ensure root PATH Integrity | Determin colon end"
ansible.builtin.shell : 'echo $PATH | grep :$'
2022-09-16 11:34:42 +01:00
changed_when : false
2023-01-13 10:04:33 +00:00
failed_when : rhel9cis_6_2_8_path_colon_end.rc == 0
2022-09-16 11:34:42 +01:00
check_mode : false
2023-01-13 10:04:33 +00:00
register : rhel9cis_6_2_8_path_colon_end
2022-03-30 16:18:11 +01:00
2023-01-13 10:04:33 +00:00
- name : "6.2.8 | AUDIT | Ensure root PATH Integrity | Determine dot in path"
ansible.builtin.shell : "/bin/bash --login -c 'env | grep ^PATH=' | sed -e 's/PATH=//' -e 's/::/:/' -e 's/:$//' -e 's/:/\\n/g'"
2022-09-16 11:34:42 +01:00
changed_when : false
2023-01-13 10:04:33 +00:00
failed_when : '"." in rhel9cis_6_2_8_dot_in_path.stdout_lines'
2022-09-16 11:34:42 +01:00
check_mode : false
2023-01-13 10:04:33 +00:00
register : rhel9cis_6_2_8_dot_in_path
2022-03-30 16:18:11 +01:00
2023-01-13 10:04:33 +00:00
- name : "6.2.8 | AUDIT | Ensure root PATH Integrity | Alert on empty value, colon end, and dot in path"
ansible.builtin.debug :
2022-03-30 16:18:11 +01:00
msg :
2023-01-13 10:04:33 +00:00
- "Warning!!"
- "The following paths have an empty value: {{ rhel9cis_6_2_8_path_colon.stdout_lines }}"
- "The following paths have colon end: {{ rhel9cis_6_2_8_path_colon_end.stdout_lines }}"
- "The following paths have a dot in the path: {{ rhel9cis_6_2_8_dot_in_path.stdout_lines }}"
2022-03-30 16:18:11 +01:00
2023-01-13 10:04:33 +00:00
- name : "6.2.8 | PATCH | Ensure root PATH Integrity | Determine rights and owner"
ansible.builtin.file : >
2022-03-30 16:18:11 +01:00
path='{{ item }}'
follow=yes
state=directory
owner=root
mode='o-w,g-w'
2023-01-13 10:04:33 +00:00
with_items : "{{ rhel9cis_6_2_8_dot_in_path.stdout_lines }}"
2022-03-30 16:18:11 +01:00
when :
2023-01-13 10:04:33 +00:00
- rhel9cis_rule_6_2_8
2022-03-30 16:18:11 +01:00
tags :
- level1-server
- level1-workstation
- patch
- paths
2023-01-13 10:04:33 +00:00
- rule_6.2.8
2022-03-30 16:18:11 +01:00
2023-01-13 10:04:33 +00:00
- name : "6.2.9 | PATCH | Ensure root is the only UID 0 account"
ansible.builtin.shell : passwd -l {{ item }}
2022-01-07 09:06:18 +00:00
changed_when : false
failed_when : false
2022-03-30 16:18:11 +01:00
with_items : "{{ rhel9cis_uid_zero_accounts_except_root.stdout_lines }}"
2022-01-07 09:06:18 +00:00
when :
2022-03-30 16:18:11 +01:00
- rhel9cis_uid_zero_accounts_except_root.rc
2023-01-13 10:04:33 +00:00
- rhel9cis_rule_6_2_9
2022-01-07 09:06:18 +00:00
tags :
- level1-server
- level1-workstation
- patch
2022-03-30 16:18:11 +01:00
- accounts
- users
2023-01-13 10:04:33 +00:00
- rule_6.2.9
2022-01-07 09:06:18 +00:00
2023-01-13 10:04:33 +00:00
- name : "6.2.10 | PATCH | Ensure local interactive user home directories exist"
2022-01-07 09:06:18 +00:00
block :
2023-01-13 10:04:33 +00:00
- name : "6.2.10 | AUDIT | Ensure local interactive user home directories exist"
ansible.builtin.stat :
2022-01-07 09:06:18 +00:00
path : "{{ item }}"
2023-01-13 10:04:33 +00:00
register : rhel_08_6_2_10_audit
2022-07-20 17:13:33 +01:00
with_items : "{{ rhel9cis_passwd | selectattr('uid', '>=', min_int_uid | int ) | selectattr('uid', '<=', max_int_uid | int ) | map(attribute='dir') | list }}"
2022-02-02 11:34:50 +00:00
2023-01-13 10:04:33 +00:00
- 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
2022-01-07 09:06:18 +00:00
check_mode : false
2023-01-13 10:04:33 +00:00
changed_when : rhel_08_6_2_10_patch_audit.stdout | length > 0
register : rhel_08_6_2_10_patch_audit
2022-01-07 09:06:18 +00:00
when :
- ansible_check_mode
- item.1.exists
with_together :
2023-01-13 10:04:33 +00:00
- "{{ rhel_08_6_2_10_audit.results | map(attribute='item') | list }}"
- "{{ rhel_08_6_2_10_audit.results | map(attribute='stat') | list }}"
2022-01-07 09:06:18 +00:00
loop_control :
label : "{{ item.0 }}"
2023-01-13 10:04:33 +00:00
- name : "6.2.10 | PATCH | Ensure local interactive user home directories exist"
ansible.builtin.file :
2022-01-07 09:06:18 +00:00
path : "{{ item.0 }}"
2022-09-16 11:34:42 +01:00
recurse : true
2022-01-07 09:06:18 +00:00
mode : a-st,g-w,o-rwx
2023-01-13 10:04:33 +00:00
register : rhel_08_6_2_10_patch
2022-01-07 09:06:18 +00:00
when :
- not ansible_check_mode
- item.1.exists
with_together :
2023-01-13 10:04:33 +00:00
- "{{ rhel_08_6_2_10_audit.results | map(attribute='item') | list }}"
- "{{ rhel_08_6_2_10_audit.results | map(attribute='stat') | list }}"
2022-01-07 09:06:18 +00:00
loop_control :
label : "{{ item.0 }}"
# set default ACLs so the homedir has an effective umask of 0027
2023-01-13 10:04:33 +00:00
- name : "6.2.10 | PATCH | Ensure local interactive user home directories exist"
ansible.posix.acl :
2022-01-07 09:06:18 +00:00
path : "{{ item.0 }}"
2022-09-16 11:34:42 +01:00
default : true
2022-01-07 09:06:18 +00:00
state : present
2022-09-16 11:34:42 +01:00
recursive : true
2022-01-07 09:06:18 +00:00
etype : "{{ item.1.etype }}"
permissions : "{{ item.1.mode }}"
2022-09-16 11:34:42 +01:00
when :
2022-07-20 17:13:33 +01:00
- not system_is_container
2022-01-07 09:06:18 +00:00
with_nested :
2023-01-13 10:04:33 +00:00
- "{{ (ansible_check_mode | ternary(rhel_08_6_2_10_patch_audit, rhel_08_6_2_10_patch)).results |
2022-01-07 09:06:18 +00:00
rejectattr('skipped', 'defined') | map(attribute='item') | map('first') | list }}"
-
- etype : group
mode : rx
- etype : other
mode : '0'
when :
2023-01-13 10:04:33 +00:00
- rhel9cis_rule_6_2_10
2022-01-07 09:06:18 +00:00
tags :
- level1-server
- level1-workstation
- patch
2022-03-30 16:18:11 +01:00
- users
2023-01-13 10:04:33 +00:00
- rule_6.2.10
2022-01-07 09:06:18 +00:00
2023-01-13 10:04:33 +00:00
- name : "6.2.11 | PATCH | Ensure local interactive users own their home directories"
ansible.builtin.file :
2022-01-07 09:06:18 +00:00
path : "{{ item.dir }}"
owner : "{{ item.id }}"
state : directory
with_items : "{{ rhel9cis_passwd }}"
loop_control :
label : "{{ rhel9cis_passwd_label }}"
when :
2022-07-20 17:13:33 +01:00
- item.uid >= min_int_uid | int
- item.id != 'nobody'
2022-09-27 17:15:49 +02:00
- (item.id != 'tss' and item.dir != '/dev/null')
2023-01-19 16:29:44 +00:00
- item.shell != '/sbin/nologin'
2023-01-13 10:04:33 +00:00
- rhel9cis_rule_6_2_11
2022-01-07 09:06:18 +00:00
tags :
- level1-server
- level1-workstation
- patch
2022-03-30 16:18:11 +01:00
- users
2023-01-19 16:29:44 +00:00
- rule_6.2.11
2022-01-07 09:06:18 +00:00
2023-01-13 10:04:33 +00:00
- name : "6.2.12 | PATCH | Ensure local interactive user home directories are mode 750 or more restrictive"
2022-01-07 09:06:18 +00:00
block :
2023-01-13 10:04:33 +00:00
- name : "6.2.12 | AUDIT | Ensure local interactive user home directories are mode 750 or more restrictive"
ansible.builtin.stat :
2022-03-30 16:18:11 +01:00
path : "{{ item }}"
2022-07-20 17:13:33 +01:00
with_items : "{{ rhel9cis_passwd | selectattr('uid', '>=', min_int_uid | int) | selectattr('uid', '<=', max_int_uid | int) | map(attribute='dir') | list }}"
2023-01-13 10:04:33 +00:00
register : rhel_08_6_2_12_audit
2022-01-07 09:06:18 +00:00
2023-01-13 10:04:33 +00:00
- 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
2022-03-30 16:18:11 +01:00
check_mode : false
2023-01-13 10:04:33 +00:00
changed_when : rhel_08_6_2_12_patch_audit.stdout | length > 0
register : rhel_08_6_2_12_patch_audit
2022-01-07 09:06:18 +00:00
when :
2022-03-30 16:18:11 +01:00
- ansible_check_mode
- item.1.exists
with_together :
2023-01-13 10:04:33 +00:00
- "{{ rhel_08_6_2_12_audit.results | map(attribute='item') | list }}"
- "{{ rhel_08_6_2_12_audit.results | map(attribute='stat') | list }}"
2022-03-30 16:18:11 +01:00
loop_control :
label : "{{ item.0 }}"
2022-01-07 09:06:18 +00:00
2023-01-13 10:04:33 +00:00
- name : "6.2.12 | PATCH | Ensure local interactive user home directories are mode 750 or more restrictive"
ansible.builtin.file :
2022-03-30 16:18:11 +01:00
path : "{{ item.0 }}"
2022-09-16 11:34:42 +01:00
recurse : true
2022-03-30 16:18:11 +01:00
mode : a-st,g-w,o-rwx
2023-01-13 10:04:33 +00:00
register : rhel_08_6_2_12_patch
2022-01-07 09:06:18 +00:00
when :
2022-03-30 16:18:11 +01:00
- not ansible_check_mode
- item.1.exists
with_together :
2023-01-13 10:04:33 +00:00
- "{{ rhel_08_6_2_12_audit.results | map(attribute='item') | list }}"
- "{{ rhel_08_6_2_12_audit.results | map(attribute='stat') | list }}"
2022-03-30 16:18:11 +01:00
loop_control :
label : "{{ item.0 }}"
2022-01-07 09:06:18 +00:00
2022-03-30 16:18:11 +01:00
# set default ACLs so the homedir has an effective umask of 0027
2023-01-13 10:04:33 +00:00
- name : "6.2.12 | PATCH | Ensure local interactive user home directories are mode 750 or more restrictive"
ansible.posix.acl :
2022-03-30 16:18:11 +01:00
path : "{{ item.0 }}"
2022-09-16 11:34:42 +01:00
default : true
2022-03-30 16:18:11 +01:00
state : present
2022-09-16 11:34:42 +01:00
recursive : true
2022-03-30 16:18:11 +01:00
etype : "{{ item.1.etype }}"
permissions : "{{ item.1.mode }}"
2022-09-16 11:34:42 +01:00
when :
2022-07-20 17:13:33 +01:00
- not system_is_container
2022-03-30 16:18:11 +01:00
with_nested :
2023-01-13 10:04:33 +00:00
- "{{ (ansible_check_mode | ternary(rhel_08_6_2_12_patch_audit, rhel_08_6_2_12_patch)).results |
2022-03-30 16:18:11 +01:00
rejectattr('skipped', 'defined') | map(attribute='item') | map('first') | list }}"
-
- etype : group
mode : rx
- etype : other
mode : '0'
2022-01-07 09:06:18 +00:00
when :
- rhel9cis_rule_6_2_12
tags :
- level1-server
- level1-workstation
- patch
2022-03-30 16:18:11 +01:00
- users
- permissions
2022-01-07 09:06:18 +00:00
- rule_6.2.12
2023-01-13 10:04:33 +00:00
- name : "6.2.13 | PATCH | Ensure no local interactive user has .netrc files"
ansible.builtin.file :
2023-01-19 16:29:44 +00:00
path : "{{ item }}/.netrc"
2023-01-13 10:04:33 +00:00
state : absent
with_items :
2023-01-19 16:29:44 +00:00
- "{{ interactive_users_home.stdout_lines }}"
2022-01-07 09:06:18 +00:00
when :
- rhel9cis_rule_6_2_13
tags :
- level1-server
- level1-workstation
- patch
2022-03-30 16:18:11 +01:00
- users
- permissions
2022-01-07 09:06:18 +00:00
- rule_6.2.13
2023-01-13 10:04:33 +00:00
- name : "6.2.14 | PATCH | Ensure no local interactive user has .forward files"
ansible.builtin.file :
2023-01-19 16:29:44 +00:00
path : "{{ item }}/.forward"
2022-03-30 16:18:11 +01:00
state : absent
with_items :
2023-01-19 16:29:44 +00:00
- "{{ interactive_users_home.stdout_lines }}"
2022-01-07 09:06:18 +00:00
when :
- rhel9cis_rule_6_2_14
tags :
- level1-server
- level1-workstation
2022-03-30 16:18:11 +01:00
- patch
- users
- files
2022-01-07 09:06:18 +00:00
- rule_6.2.14
2023-01-19 16:29:44 +00:00
- name : "6.2.15 | PATCH | Ensure no local interactive user has .rhosts files"
2023-01-13 10:04:33 +00:00
ansible.builtin.file :
path : "~{{ item }}/.rhosts"
2022-03-30 16:18:11 +01:00
state : absent
with_items :
2023-01-19 16:29:44 +00:00
- "{{ interactive_users_home.stdout_lines }}"
2022-01-07 09:06:18 +00:00
when :
- rhel9cis_rule_6_2_15
tags :
- level1-server
- level1-workstation
- patch
2022-03-30 16:18:11 +01:00
- users
- files
2022-01-07 09:06:18 +00:00
- rule_6.2.15
2023-01-13 10:04:33 +00:00
- name : "6.2.16 | PATCH | Ensure local interactive user dot files are not group or world writable"
block :
2023-01-19 16:29:44 +00:00
- name : "6.2.16 | AUDIT | Ensure local interactive user dot files are not group or world writable | Check for files"
ansible.builtin.find :
2023-01-19 16:55:12 +00:00
path : /home
2023-01-19 16:29:44 +00:00
depth : 3
patterns : ".*"
hidden : true
recurse : true
file_type : file
register : user_dot_files
2023-01-13 10:04:33 +00:00
2023-01-19 16:29:44 +00:00
- name : "6.2.16 | AUDIT | Ensure local interactive user dot files are not group or world writable | update permissions"
2023-01-13 10:04:33 +00:00
ansible.builtin.file :
2023-01-19 16:29:44 +00:00
path : "{{ item.path }}"
2023-01-13 10:04:33 +00:00
mode : go-w
2023-01-19 16:29:44 +00:00
loop : "{{ user_dot_files.files }}"
loop_control :
label : "{{ item.path }}"
2022-01-07 09:06:18 +00:00
when :
- rhel9cis_rule_6_2_16
tags :
- level1-server
- level1-workstation
- patch
2022-03-30 16:18:11 +01:00
- users
2023-01-13 10:04:33 +00:00
- permissions
2022-03-30 16:18:11 +01:00
- rule_6.2.16