- name: XCCDF Value var_password_pam_lcredit # promote to variable
set_fact:
var_password_pam_lcredit: !!str <xccdf-1.2:sub xmlns:xccdf-1.2="http://checklists.nist.gov/xccdf/1.2" idref="xccdf_org.ssgproject.content_value_var_password_pam_lcredit" use="legacy"/>
tags:
- always
- name: Set control_flag fact set_fact:
control_flag: requisite
tags:
- CCE-85676-5
- DISA-STIG-SLES-15-020140
- NIST-800-53-IA-5(1)(a)
- NIST-800-53-IA-5(1).1(v)
- PCI-DSS-Req-8.2.3
- PCI-DSSv4-8.3
- PCI-DSSv4-8.3.6
- cracklib_accounts_password_pam_lcredit
- low_complexity
- low_disruption
- medium_severity
- no_reboot_needed
- restrict_strategy
- name: Check to see if 'pam_cracklib.so' module is configured in '/etc/pam.d/common-password'
shell: |
set -o pipefail
grep -E '^\s*password\s+\S+\s+pam_cracklib.so' /etc/pam.d/common-password || true
register: check_pam_module_result
tags:
- CCE-85676-5
- DISA-STIG-SLES-15-020140
- NIST-800-53-IA-5(1)(a)
- NIST-800-53-IA-5(1).1(v)
- PCI-DSS-Req-8.2.3
- PCI-DSSv4-8.3
- PCI-DSSv4-8.3.6
- cracklib_accounts_password_pam_lcredit
- low_complexity
- low_disruption
- medium_severity
- no_reboot_needed
- restrict_strategy
- name: Configure 'pam_cracklib.so' module in '/etc/pam.d/common-password'
lineinfile:
path: /etc/pam.d/common-password
line: password requisite pam_cracklib.so
state: present
when: check_pam_module_result.stdout is defined and '"pam_cracklib.so" not in check_pam_module_result.stdout'
tags:
- CCE-85676-5
- DISA-STIG-SLES-15-020140
- NIST-800-53-IA-5(1)(a)
- NIST-800-53-IA-5(1).1(v)
- PCI-DSS-Req-8.2.3
- PCI-DSSv4-8.3
- PCI-DSSv4-8.3.6
- cracklib_accounts_password_pam_lcredit
- low_complexity
- low_disruption
- medium_severity
- no_reboot_needed
- restrict_strategy
- name: Ensure 'pam_cracklib.so' module has conforming control flag
lineinfile:
path: /etc/pam.d/common-password
regexp: ^(\s*password\s+)\S+(\s+pam_cracklib.so\s+.*)
line: \g<1>requisite\g<2>
backrefs: true
when: control_flag|length
tags:
- CCE-85676-5
- DISA-STIG-SLES-15-020140
- NIST-800-53-IA-5(1)(a)
- NIST-800-53-IA-5(1).1(v)
- PCI-DSS-Req-8.2.3
- PCI-DSSv4-8.3
- PCI-DSSv4-8.3.6
- cracklib_accounts_password_pam_lcredit
- low_complexity
- low_disruption
- medium_severity
- no_reboot_needed
- restrict_strategy
- name: Ensure "pam_cracklib.so" module has argument "lcredit={{ var_password_pam_lcredit
}}"
lineinfile:
path: /etc/pam.d/common-password
regexp: ^(\s*password\s+requisite\s+pam_cracklib.so(?:\s+\S+)*\s+lcredit=)(?:\S+)((\s+\S+)*\s*\\*\s*)$
line: \g<1>{{ var_password_pam_lcredit }}\g<2>
backrefs: true
tags:
- CCE-85676-5
- DISA-STIG-SLES-15-020140
- NIST-800-53-IA-5(1)(a)
- NIST-800-53-IA-5(1).1(v)
- PCI-DSS-Req-8.2.3
- PCI-DSSv4-8.3
- PCI-DSSv4-8.3.6
- cracklib_accounts_password_pam_lcredit
- low_complexity
- low_disruption
- medium_severity
- no_reboot_needed
- restrict_strategy
- name: Check the presence of "lcredit" argument in "pam_cracklib.so" module
shell: |
set -o pipefail
grep -E '^\s*password\s+requisite\s+pam_cracklib.so.*\s+lcredit(=|\s|\s*$)' /etc/pam.d/common-password || true
register: check_pam_module_argument_result
tags:
- CCE-85676-5
- DISA-STIG-SLES-15-020140
- NIST-800-53-IA-5(1)(a)
- NIST-800-53-IA-5(1).1(v)
- PCI-DSS-Req-8.2.3
- PCI-DSSv4-8.3
- PCI-DSSv4-8.3.6
- cracklib_accounts_password_pam_lcredit
- low_complexity
- low_disruption
- medium_severity
- no_reboot_needed
- restrict_strategy
- name: Add "lcredit" argument to "pam_cracklib.so" module
lineinfile:
path: /etc/pam.d/common-password
regexp: ^(\s*password\s+requisite\s+pam_cracklib.so)((\s+\S+)*\s*(\\)*$)
line: \g<1> lcredit={{ var_password_pam_lcredit }}\g<2>
backrefs: true
when: check_pam_module_argument_result is not skipped and '"lcredit" not in check_pam_module_argument_result.stdout'
tags:
- CCE-85676-5
- DISA-STIG-SLES-15-020140
- NIST-800-53-IA-5(1)(a)
- NIST-800-53-IA-5(1).1(v)
- PCI-DSS-Req-8.2.3
- PCI-DSSv4-8.3
- PCI-DSSv4-8.3.6
- cracklib_accounts_password_pam_lcredit
- low_complexity
- low_disruption
- medium_severity
- no_reboot_needed
- restrict_strategy