forked from ansible-lockdown/RHEL9-CIS
Lint updates
Signed-off-by: Mark Bolwell <mark.bollyuk@gmail.com>
This commit is contained in:
parent
fcf9eb674f
commit
88ac5c3d65
19 changed files with 127 additions and 84 deletions
|
|
@ -96,7 +96,8 @@
|
|||
- discovered_warn_days.stdout_lines | length > 0
|
||||
- item in prelim_interactive_usernames.stdout
|
||||
- rhel9cis_force_user_warnage
|
||||
ansible.builtin.shell: "chage --warndays {{ rhel9cis_pass['warn_age'] }} {{ item }}"
|
||||
ansible.builtin.command: "chage --warndays {{ rhel9cis_pass['warn_age'] }} {{ item }}"
|
||||
changed_when: true
|
||||
loop: "{{ discovered_warn_days.stdout_lines }}"
|
||||
|
||||
- name: "5.4.1.4 | PATCH | Ensure strong password hashing algorithm is configured"
|
||||
|
|
@ -125,25 +126,29 @@
|
|||
- rule_5.4.1.5
|
||||
block:
|
||||
- name: "5.4.1.5 | AUDIT | Ensure inactive password lock is configured | Check current settings"
|
||||
ansible.builtin.shell: useradd -D | grep INACTIVE={{ rhel9cis_inactivelock.lock_days }} | cut -f2 -d=
|
||||
ansible.builtin.shell: |
|
||||
useradd -D | grep INACTIVE={{ rhel9cis_inactivelock.lock_days }} | cut -f2 -d=
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
check_mode: false
|
||||
register: discovered_passwdlck_inactive_settings
|
||||
|
||||
- name: "5.4.1.5 | PATCH | Ensure inactive password lock is configured | Set default inactive setting"
|
||||
ansible.builtin.shell: useradd -D -f {{ rhel9cis_inactivelock.lock_days }}
|
||||
when: discovered_passwdlck_inactive_settings.stdout | length == 0
|
||||
ansible.builtin.command: useradd -D -f {{ rhel9cis_inactivelock.lock_days }}
|
||||
changed_when: true
|
||||
|
||||
- name: "5.4.1.5 | AUDIT | Ensure inactive password lock is 30 days or less | Getting user list"
|
||||
ansible.builtin.shell: "awk -F: '/^[^#:]+:[^\\!\\*:]*:[^:]*:[^:]*:[^:]*:[^:]*:(\\s*|-1|3[1-9]|[4-9][0-9]|[1-9][0-9][0-9]+):[^:]*:[^:]*\\s*$/ {print $1}' /etc/shadow"
|
||||
ansible.builtin.shell: |
|
||||
"awk -F: '/^[^#:]+:[^\\!\\*:]*:[^:]*:[^:]*:[^:]*:[^:]*:(\\s*|-1|3[1-9]|[4-9][0-9]|[1-9][0-9][0-9]+):[^:]*:[^:]*\\s*$/ {print $1}' /etc/shadow"
|
||||
changed_when: false
|
||||
check_mode: false
|
||||
register: discovered_passwdlck_user_list
|
||||
|
||||
- name: "5.4.1.5 | PATCH | Ensure inactive password lock is 30 days or less | Apply Inactive setting to existing accounts"
|
||||
when: item in prelim_interactive_usernames.stdout
|
||||
ansible.builtin.shell: chage --inactive {{ rhel9cis_inactivelock.lock_days }} "{{ item }}"
|
||||
ansible.builtin.command: chage --inactive {{ rhel9cis_inactivelock.lock_days }} "{{ item }}"
|
||||
changed_when: true
|
||||
loop: "{{ discovered_passwdlck_user_list.stdout_lines }}"
|
||||
|
||||
- name: "5.4.1.6 | PATCH | Ensure all users last password change date is in the past"
|
||||
|
|
@ -172,22 +177,23 @@
|
|||
register: discovered_passwdlck_user_future
|
||||
|
||||
- name: "5.4.1.6 | AUDIT | Ensure all users last password change date is in the past | Alert on accounts with pw change in the future"
|
||||
when:
|
||||
- discovered_passwdlck_user_future.stdout | length > 0
|
||||
- not rhel9cis_futurepwchgdate_autofix
|
||||
ansible.builtin.debug:
|
||||
msg: "Warning!! The following accounts have the last PW change date in the future: {{ discovered_passwdlck_user_future.stdout_lines }}"
|
||||
when:
|
||||
- discovered_passwdlck_user_future.stdout | length > 0
|
||||
- not rhel9cis_futurepwchgdate_autofix
|
||||
|
||||
- name: "5.4.1.6 | AUDIT | Ensure all users last password change date is in the past | warning count"
|
||||
ansible.builtin.import_tasks:
|
||||
file: warning_facts.yml
|
||||
when:
|
||||
- discovered_passwdlck_user_future.stdout | length > 0
|
||||
- not rhel9cis_futurepwchgdate_autofix
|
||||
ansible.builtin.import_tasks:
|
||||
file: warning_facts.yml
|
||||
|
||||
- name: "5.4.1.6 | PATCH | Ensure all users last password change date is in the past | Fix accounts with pw change in the future"
|
||||
ansible.builtin.shell: passwd --expire {{ item }}
|
||||
changed_when: true
|
||||
when:
|
||||
- discovered_passwdlck_user_future.stdout | length > 0
|
||||
- rhel9cis_futurepwchgdate_autofix
|
||||
loop: "{{ discovered_passwdlck_user_future.stdout_lines }}"
|
||||
ansible.builtin.command: passwd --expire {{ item }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue