forked from ansible-lockdown/RHEL9-CIS
renamed variables
Signed-off-by: Mark Bolwell <mark.bollyuk@gmail.com>
This commit is contained in:
parent
c58c4eb4e8
commit
14d038e8eb
14 changed files with 113 additions and 113 deletions
|
|
@ -129,22 +129,22 @@
|
|||
changed_when: false
|
||||
failed_when: false
|
||||
check_mode: false
|
||||
register: rhel9cis_5_4_1_5_inactive_settings
|
||||
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: rhel9cis_5_4_1_5_inactive_settings.stdout | length == 0
|
||||
when: discovered_passwdlck_inactive_settings.stdout | length == 0
|
||||
|
||||
- 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"
|
||||
changed_when: false
|
||||
check_mode: false
|
||||
register: rhel9cis_5_4_1_5_user_list
|
||||
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 }}"
|
||||
loop: "{{ rhel9cis_5_4_1_5_user_list.stdout_lines }}"
|
||||
loop: "{{ discovered_passwdlck_user_list.stdout_lines }}"
|
||||
|
||||
- name: "5.4.1.6 | PATCH | Ensure all users last password change date is in the past"
|
||||
when:
|
||||
|
|
@ -162,32 +162,32 @@
|
|||
changed_when: false
|
||||
failed_when: false
|
||||
check_mode: false
|
||||
register: rhel9cis_5_4_1_6_currentut
|
||||
register: discovered_passwdlck_currentunixtime
|
||||
|
||||
- name: "5.4.1.6 | AUDIT | Ensure all users last password change date is in the past | Get list of users with last changed pw date in the future"
|
||||
ansible.builtin.shell: "cat /etc/shadow | awk -F: '{if($3>{{ rhel9cis_5_4_1_6_currentut.stdout }})print$1}'"
|
||||
ansible.builtin.shell: "cat /etc/shadow | awk -F: '{if($3>{{ discovered_passwdlck_currentunixtime.stdout }})print$1}'"
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
check_mode: false
|
||||
register: rhel9cis_5_4_1_6_user_list
|
||||
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"
|
||||
ansible.builtin.debug:
|
||||
msg: "Warning!! The following accounts have the last PW change date in the future: {{ rhel9cis_5_4_1_6_user_list.stdout_lines }}"
|
||||
msg: "Warning!! The following accounts have the last PW change date in the future: {{ discovered_passwdlck_user_future.stdout_lines }}"
|
||||
when:
|
||||
- rhel9cis_5_4_1_6_user_list.stdout | length > 0
|
||||
- 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:
|
||||
- rhel9cis_5_4_1_6_user_list.stdout | length > 0
|
||||
- discovered_passwdlck_user_future.stdout | length > 0
|
||||
- not rhel9cis_futurepwchgdate_autofix
|
||||
|
||||
- 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 }}
|
||||
when:
|
||||
- rhel9cis_5_4_1_5_user_list.stdout | length > 0
|
||||
- discovered_passwdlck_user_future.stdout | length > 0
|
||||
- rhel9cis_futurepwchgdate_autofix
|
||||
loop: "{{ rhel9cis_5_4_1_6_user_list.stdout_lines }}"
|
||||
loop: "{{ discovered_passwdlck_user_future.stdout_lines }}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue