Skip to content

Commit

Permalink
Updated tasks/main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
ComplianceAsCode development team authored and dmc5179 committed Oct 5, 2022
1 parent c066a5a commit 306b050
Showing 1 changed file with 42 additions and 37 deletions.
79 changes: 42 additions & 37 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -886,17 +886,18 @@
- name: Limit Password Reuse - Ensure the required PAM module line is included in {{ pam_file_path }}
ansible.builtin.lineinfile:
dest: '{{ pam_file_path }}'
insertafter: ^password.*requisite.*pam_pwquality.so
insertafter: ^password.*requisite.*pam_pwquality\.so
line: password requisite pam_pwhistory.so
register: result_pam_module_add
when:
- result_pam_line_other_control_present.found == 0 or result_pam_line_other_control_present.found > 1
- name: Limit Password Reuse - Ensure authselect changes are applied
ansible.builtin.command:
cmd: authselect apply-changes -b
when:
- result_authselect_present.stat.exists
- (result_pam_module_add is defined and result_pam_module_add.changed) or (result_pam_module_edit is defined and result_pam_module_edit.changed)
when: 'result_authselect_present is defined and result_authselect_present.stat.exists and ((result_pam_module_add is
defined and result_pam_module_add.changed) or (result_pam_module_edit is defined and result_pam_module_edit.changed))
'
when:
- result_pam_line_present.found is defined
- result_pam_line_present.found == 0
Expand Down Expand Up @@ -1123,17 +1124,18 @@
- name: Limit Password Reuse - Ensure the required PAM module line is included in {{ pam_file_path }}
ansible.builtin.lineinfile:
dest: '{{ pam_file_path }}'
insertafter: ^password.*requisite.*pam_pwquality.so
insertafter: ^password.*requisite.*pam_pwquality\.so
line: password requisite pam_pwhistory.so
register: result_pam_module_add
when:
- result_pam_line_other_control_present.found == 0 or result_pam_line_other_control_present.found > 1
- name: Limit Password Reuse - Ensure authselect changes are applied
ansible.builtin.command:
cmd: authselect apply-changes -b
when:
- result_authselect_present.stat.exists
- (result_pam_module_add is defined and result_pam_module_add.changed) or (result_pam_module_edit is defined and result_pam_module_edit.changed)
when: 'result_authselect_present is defined and result_authselect_present.stat.exists and ((result_pam_module_add is
defined and result_pam_module_add.changed) or (result_pam_module_edit is defined and result_pam_module_edit.changed))
'
when:
- result_pam_line_present.found is defined
- result_pam_line_present.found == 0
Expand Down Expand Up @@ -1319,7 +1321,7 @@
- name: Lock Accounts After Failed Password Attempts - Check if pam_faillock.so is already enabled
ansible.builtin.lineinfile:
path: /etc/pam.d/system-auth
regexp: .*auth.*pam_faillock.so (preauth|authfail)
regexp: .*auth.*pam_faillock\.so (preauth|authfail)
state: absent
check_mode: true
changed_when: false
Expand All @@ -1328,7 +1330,7 @@
ansible.builtin.lineinfile:
path: '{{ item }}'
line: auth required pam_faillock.so preauth
insertbefore: ^auth.*sufficient.*pam_unix.so.*
insertbefore: ^auth.*sufficient.*pam_unix\.so.*
state: present
loop:
- /etc/pam.d/system-auth
Expand All @@ -1339,7 +1341,7 @@
ansible.builtin.lineinfile:
path: '{{ item }}'
line: auth required pam_faillock.so authfail
insertbefore: ^auth.*required.*pam_deny.so.*
insertbefore: ^auth.*required.*pam_deny\.so.*
state: present
loop:
- /etc/pam.d/system-auth
Expand All @@ -1350,7 +1352,7 @@
ansible.builtin.lineinfile:
path: '{{ item }}'
line: account required pam_faillock.so
insertbefore: ^account.*required.*pam_unix.so.*
insertbefore: ^account.*required.*pam_unix\.so.*
state: present
loop:
- /etc/pam.d/system-auth
Expand Down Expand Up @@ -1738,7 +1740,7 @@
files
ansible.builtin.lineinfile:
path: /etc/pam.d/system-auth
regexp: .*auth.*pam_faillock.so (preauth|authfail).*deny
regexp: .*auth.*pam_faillock\.so (preauth|authfail).*deny
state: absent
check_mode: true
changed_when: false
Expand Down Expand Up @@ -1940,7 +1942,7 @@
- name: Configure the root Account for Failed Password Attempts - Check if pam_faillock.so is already enabled
ansible.builtin.lineinfile:
path: /etc/pam.d/system-auth
regexp: .*auth.*pam_faillock.so (preauth|authfail)
regexp: .*auth.*pam_faillock\.so (preauth|authfail)
state: absent
check_mode: true
changed_when: false
Expand All @@ -1949,7 +1951,7 @@
ansible.builtin.lineinfile:
path: '{{ item }}'
line: auth required pam_faillock.so preauth
insertbefore: ^auth.*sufficient.*pam_unix.so.*
insertbefore: ^auth.*sufficient.*pam_unix\.so.*
state: present
loop:
- /etc/pam.d/system-auth
Expand All @@ -1960,7 +1962,7 @@
ansible.builtin.lineinfile:
path: '{{ item }}'
line: auth required pam_faillock.so authfail
insertbefore: ^auth.*required.*pam_deny.so.*
insertbefore: ^auth.*required.*pam_deny\.so.*
state: present
loop:
- /etc/pam.d/system-auth
Expand All @@ -1971,7 +1973,7 @@
ansible.builtin.lineinfile:
path: '{{ item }}'
line: account required pam_faillock.so
insertbefore: ^account.*required.*pam_unix.so.*
insertbefore: ^account.*required.*pam_unix\.so.*
state: present
loop:
- /etc/pam.d/system-auth
Expand Down Expand Up @@ -2361,7 +2363,7 @@
enabled in pam files
ansible.builtin.lineinfile:
path: /etc/pam.d/system-auth
regexp: .*auth.*pam_faillock.so (preauth|authfail).*even_deny_root
regexp: .*auth.*pam_faillock\.so (preauth|authfail).*even_deny_root
state: absent
check_mode: true
changed_when: false
Expand Down Expand Up @@ -2532,7 +2534,7 @@
- name: Set Interval For Counting Failed Password Attempts - Check if pam_faillock.so is already enabled
ansible.builtin.lineinfile:
path: /etc/pam.d/system-auth
regexp: .*auth.*pam_faillock.so (preauth|authfail)
regexp: .*auth.*pam_faillock\.so (preauth|authfail)
state: absent
check_mode: true
changed_when: false
Expand All @@ -2541,7 +2543,7 @@
ansible.builtin.lineinfile:
path: '{{ item }}'
line: auth required pam_faillock.so preauth
insertbefore: ^auth.*sufficient.*pam_unix.so.*
insertbefore: ^auth.*sufficient.*pam_unix\.so.*
state: present
loop:
- /etc/pam.d/system-auth
Expand All @@ -2552,7 +2554,7 @@
ansible.builtin.lineinfile:
path: '{{ item }}'
line: auth required pam_faillock.so authfail
insertbefore: ^auth.*required.*pam_deny.so.*
insertbefore: ^auth.*required.*pam_deny\.so.*
state: present
loop:
- /etc/pam.d/system-auth
Expand All @@ -2563,7 +2565,7 @@
ansible.builtin.lineinfile:
path: '{{ item }}'
line: account required pam_faillock.so
insertbefore: ^account.*required.*pam_unix.so.*
insertbefore: ^account.*required.*pam_unix\.so.*
state: present
loop:
- /etc/pam.d/system-auth
Expand Down Expand Up @@ -2946,7 +2948,7 @@
enabled in pam files
ansible.builtin.lineinfile:
path: /etc/pam.d/system-auth
regexp: .*auth.*pam_faillock.so (preauth|authfail).*fail_interval
regexp: .*auth.*pam_faillock\.so (preauth|authfail).*fail_interval
state: absent
check_mode: true
changed_when: false
Expand Down Expand Up @@ -3149,7 +3151,7 @@
- name: Set Lockout Time for Failed Password Attempts - Check if pam_faillock.so is already enabled
ansible.builtin.lineinfile:
path: /etc/pam.d/system-auth
regexp: .*auth.*pam_faillock.so (preauth|authfail)
regexp: .*auth.*pam_faillock\.so (preauth|authfail)
state: absent
check_mode: true
changed_when: false
Expand All @@ -3158,7 +3160,7 @@
ansible.builtin.lineinfile:
path: '{{ item }}'
line: auth required pam_faillock.so preauth
insertbefore: ^auth.*sufficient.*pam_unix.so.*
insertbefore: ^auth.*sufficient.*pam_unix\.so.*
state: present
loop:
- /etc/pam.d/system-auth
Expand All @@ -3169,7 +3171,7 @@
ansible.builtin.lineinfile:
path: '{{ item }}'
line: auth required pam_faillock.so authfail
insertbefore: ^auth.*required.*pam_deny.so.*
insertbefore: ^auth.*required.*pam_deny\.so.*
state: present
loop:
- /etc/pam.d/system-auth
Expand All @@ -3180,7 +3182,7 @@
ansible.builtin.lineinfile:
path: '{{ item }}'
line: account required pam_faillock.so
insertbefore: ^account.*required.*pam_unix.so.*
insertbefore: ^account.*required.*pam_unix\.so.*
state: present
loop:
- /etc/pam.d/system-auth
Expand Down Expand Up @@ -3570,7 +3572,7 @@
in pam files
ansible.builtin.lineinfile:
path: /etc/pam.d/system-auth
regexp: .*auth.*pam_faillock.so (preauth|authfail).*unlock_time
regexp: .*auth.*pam_faillock\.so (preauth|authfail).*unlock_time
state: absent
check_mode: true
changed_when: false
Expand Down Expand Up @@ -4136,9 +4138,10 @@
- name: Set PAM's Password Hashing Algorithm - Ensure authselect changes are applied
ansible.builtin.command:
cmd: authselect apply-changes -b
when:
- result_authselect_present.stat.exists
- (result_pam_module_add is defined and result_pam_module_add.changed) or (result_pam_module_edit is defined and result_pam_module_edit.changed)
when: 'result_authselect_present is defined and result_authselect_present.stat.exists and ((result_pam_module_add is
defined and result_pam_module_add.changed) or (result_pam_module_edit is defined and result_pam_module_edit.changed))
'
when:
- result_pam_line_present.found is defined
- result_pam_line_present.found == 0
Expand Down Expand Up @@ -4447,9 +4450,10 @@
- name: Set number of Password Hashing Rounds - password-auth - Ensure authselect changes are applied
ansible.builtin.command:
cmd: authselect apply-changes -b
when:
- result_authselect_present.stat.exists
- (result_pam_module_add is defined and result_pam_module_add.changed) or (result_pam_module_edit is defined and result_pam_module_edit.changed)
when: 'result_authselect_present is defined and result_authselect_present.stat.exists and ((result_pam_module_add is
defined and result_pam_module_add.changed) or (result_pam_module_edit is defined and result_pam_module_edit.changed))
'
when:
- result_pam_line_present.found is defined
- result_pam_line_present.found == 0
Expand Down Expand Up @@ -4703,9 +4707,10 @@
- name: Set number of Password Hashing Rounds - system-auth - Ensure authselect changes are applied
ansible.builtin.command:
cmd: authselect apply-changes -b
when:
- result_authselect_present.stat.exists
- (result_pam_module_add is defined and result_pam_module_add.changed) or (result_pam_module_edit is defined and result_pam_module_edit.changed)
when: 'result_authselect_present is defined and result_authselect_present.stat.exists and ((result_pam_module_add is
defined and result_pam_module_add.changed) or (result_pam_module_edit is defined and result_pam_module_edit.changed))
'
when:
- result_pam_line_present.found is defined
- result_pam_line_present.found == 0
Expand Down

0 comments on commit 306b050

Please sign in to comment.