mirror of
https://github.com/ansible-lockdown/RHEL9-CIS.git
synced 2025-12-24 22:23:06 +00:00
Improve logic for 5.3.3.2.x controls
Signed-off-by: Mark Bolwell <mark.bollyuk@gmail.com>
This commit is contained in:
parent
7d49c0d27c
commit
9f3d8becf0
2 changed files with 32 additions and 21 deletions
|
|
@ -243,13 +243,12 @@
|
|||
mode: 'go-rwx'
|
||||
state: touch
|
||||
|
||||
- name: "PRELIM | AUDIT | Capture pam secuirty related files"
|
||||
- name: "PRELIM | AUDIT | Capture pam security related files"
|
||||
tags: always
|
||||
ansible.builtin.find:
|
||||
paths:
|
||||
- /etc/security/pwquality.conf.d/
|
||||
- /etc/pam.d/
|
||||
patterns: '*-auth,*.conf'
|
||||
patterns: '*.conf'
|
||||
register: prelim_pam_pwquality_confs
|
||||
|
||||
- name: "PRELIM | AUDIT | Gather UID 0 accounts other than root"
|
||||
|
|
|
|||
|
|
@ -14,12 +14,14 @@
|
|||
when:
|
||||
- item != rhel9cis_passwd_difok_file
|
||||
- rhel9cis_disruption_high
|
||||
ansible.builtin.replace:
|
||||
ansible.builtin.lineinfile:
|
||||
path: "{{ item }}"
|
||||
regexp: 'difok\s*=\s*\d+\b'
|
||||
replace: ''
|
||||
state: absent
|
||||
loop:
|
||||
- /etc/security/pwquality.conf
|
||||
- /etc/pam.d/system-auth
|
||||
- /etc/pam.d/password-auth
|
||||
- "{{ prelim_pam_pwquality_confs.files | default([]) }}"
|
||||
|
||||
- name: "5.3.3.2.1 | PATCH | Ensure password number of changed characters is configured | Ensure difok file exists"
|
||||
|
|
@ -69,12 +71,14 @@
|
|||
when:
|
||||
- item != rhel9cis_passwd_minlen_file
|
||||
- rhel9cis_disruption_high
|
||||
ansible.builtin.replace:
|
||||
ansible.builtin.lineinfile:
|
||||
path: "{{ item }}"
|
||||
regexp: 'minlen\s*=\s*\d+\b'
|
||||
replace: ''
|
||||
state: absent
|
||||
loop:
|
||||
- /etc/security/pwquality.conf
|
||||
- /etc/pam.d/system-auth
|
||||
- /etc/pam.d/password-auth
|
||||
- "{{ prelim_pam_pwquality_confs.files | default([]) }}"
|
||||
|
||||
- name: "5.3.3.2.2 | PATCH | Ensure minimum password length is configured | Ensure minlen file exists"
|
||||
|
|
@ -124,12 +128,14 @@
|
|||
when:
|
||||
- item != rhel9cis_passwd_complex_file
|
||||
- rhel9cis_disruption_high
|
||||
ansible.builtin.replace:
|
||||
ansible.builtin.lineinfile:
|
||||
path: "{{ item }}"
|
||||
regexp: '(minclass|[dulo]credit)\s*=\s*(-\d|\d+)\b'
|
||||
replace: ''
|
||||
state: absent
|
||||
loop:
|
||||
- /etc/security/pwquality.conf
|
||||
- /etc/pam.d/system-auth
|
||||
- /etc/pam.d/password-auth
|
||||
- "{{ prelim_pam_pwquality_confs.files | default([]) }}"
|
||||
|
||||
- name: "5.3.3.2.3 | PATCH | Ensure password complexity is configured | Ensure complexity file exists"
|
||||
|
|
@ -177,12 +183,14 @@
|
|||
block:
|
||||
- name: "5.3.3.2.4 | PATCH | Ensure password same consecutive characters is configured | Remove maxrepeat settings from conf files except expected file"
|
||||
when: item != rhel9cis_passwd_maxrepeat_file
|
||||
ansible.builtin.replace:
|
||||
ansible.builtin.lineinfile:
|
||||
path: "{{ item }}"
|
||||
regexp: 'maxrepeat\s*=\s*\d+\b'
|
||||
replace: ''
|
||||
state: absent
|
||||
loop:
|
||||
- /etc/security/pwquality.conf
|
||||
- /etc/pam.d/system-auth
|
||||
- /etc/pam.d/password-auth
|
||||
- "{{ prelim_pam_pwquality_confs.files | default([]) }}"
|
||||
|
||||
- name: "5.3.3.2.4 | PATCH | Ensure password same consecutive characters is configured | Ensure maxrepeat file exists"
|
||||
|
|
@ -232,12 +240,14 @@
|
|||
when:
|
||||
- item != rhel9cis_passwd_maxsequence_file
|
||||
- rhel9cis_disruption_high
|
||||
ansible.builtin.replace:
|
||||
ansible.builtin.lineinfile:
|
||||
path: "{{ item }}"
|
||||
regexp: 'maxsequence\s*=\s*\d+\b'
|
||||
replace: ''
|
||||
state: absent
|
||||
loop:
|
||||
- /etc/security/pwquality.conf
|
||||
- /etc/pam.d/system-auth
|
||||
- /etc/pam.d/password-auth
|
||||
- "{{ prelim_pam_pwquality_confs.files | default([]) }}"
|
||||
|
||||
- name: "5.3.3.2.5 | PATCH | Ensure password maximum sequential characters is configured | Ensure maxsequence file exists"
|
||||
|
|
@ -286,12 +296,14 @@
|
|||
- name: "5.3.3.2.6 | PATCH | Ensure password dictionary check is enabled | Remove dictcheck settings from conf files except expected file"
|
||||
when:
|
||||
- item != rhel9cis_passwd_dictcheck_file
|
||||
ansible.builtin.replace:
|
||||
ansible.builtin.lineinfile:
|
||||
path: "{{ item }}"
|
||||
regexp: 'dictcheck\s*=\s*\d+\b'
|
||||
replace: ''
|
||||
state: absent
|
||||
loop:
|
||||
- /etc/security/pwquality.conf
|
||||
- /etc/pam.d/system-auth
|
||||
- /etc/pam.d/password-auth
|
||||
- "{{ prelim_pam_pwquality_confs.files | default([]) }}"
|
||||
|
||||
- name: "5.3.3.2.6 | PATCH | Ensure password dictionary check is enabled | Ensure dictcheck file exists"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue