diff --git a/docs/templates/template_reference.md b/docs/templates/template_reference.md index 65bc439225e..fef4679be39 100644 --- a/docs/templates/template_reference.md +++ b/docs/templates/template_reference.md @@ -2,17 +2,20 @@ #### accounts_password - Checks if PAM enforces password quality requirements. Checks the - configuration in `/etc/pam.d/system-auth` (for RHEL 6 systems) or - `/etc/security/pwquality.conf` (on other systems). + configuration in `/etc/security/pwquality.conf`. - Parameters: - - **variable** - PAM `pam_cracklib` (on RHEL 6) or `pam_pwquality` - (on other systems) module name, eg. `ucredit`, `ocredit` + - **variable** - PAM `pam_pwquality` password quality + requirement, eg. `ucredit`, `ocredit` - **operation** - OVAL operation, eg. `less than or equal` -- Languages: OVAL + - **zero_comparison_operation** - (optional) OVAL operation, eg. `greater than`. + When set, it will test if the **variable** value matches the OVAL operation + when compared to zero. + +- Languages: Ansible, Bash, OVAL #### auditd_lineinfile - Checks configuration options of the Audit Daemon in diff --git a/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_maxclassrepeat/rule.yml b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_maxclassrepeat/rule.yml index 912c783650a..9a829ac5119 100644 --- a/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_maxclassrepeat/rule.yml +++ b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_maxclassrepeat/rule.yml @@ -47,7 +47,7 @@ ocil_clause: 'that is not the case' ocil: |- To check the value for maximum consecutive repeating characters, run the following command:
$ grep maxclassrepeat /etc/security/pwquality.conf- For DoD systems, the output should show maxclassrepeat=4. + For DoD systems, the output should show maxclassrepeat=4 or less but greater than zero. platform: pam @@ -56,3 +56,4 @@ template: vars: variable: maxclassrepeat operation: less than or equal + zero_comparison_operation: greater than diff --git a/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_maxclassrepeat/tests/correct_value.pass.sh b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_maxclassrepeat/tests/correct_value.pass.sh new file mode 100644 index 00000000000..5d91559d4a2 --- /dev/null +++ b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_maxclassrepeat/tests/correct_value.pass.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +if grep -q 'maxclassrepeat' /etc/security/pwquality.conf; then + sed -i 's/.*maxclassrepeat.*/maxclassrepeat = 4/' /etc/security/pwquality.conf +else + echo "maxclassrepeat = 4" >> /etc/security/pwquality.conf +fi + diff --git a/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_maxclassrepeat/tests/correct_value_less_than_variable.pass.sh b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_maxclassrepeat/tests/correct_value_less_than_variable.pass.sh new file mode 100644 index 00000000000..4bd8070eb7e --- /dev/null +++ b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_maxclassrepeat/tests/correct_value_less_than_variable.pass.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +if grep -q 'maxclassrepeat' /etc/security/pwquality.conf; then + sed -i 's/.*maxclassrepeat.*/maxclassrepeat = 2/' /etc/security/pwquality.conf +else + echo "maxclassrepeat = 2" >> /etc/security/pwquality.conf +fi + diff --git a/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_maxclassrepeat/tests/negative_value.fail.sh b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_maxclassrepeat/tests/negative_value.fail.sh new file mode 100644 index 00000000000..61538a4945f --- /dev/null +++ b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_maxclassrepeat/tests/negative_value.fail.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +if grep -q 'maxclassrepeat' /etc/security/pwquality.conf; then + sed -i 's/.*maxclassrepeat.*/maxclassrepeat = -1/' /etc/security/pwquality.conf +else + echo "maxclassrepeat = -1" >> /etc/security/pwquality.conf +fi diff --git a/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_maxclassrepeat/tests/wrong_value.fail.sh b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_maxclassrepeat/tests/wrong_value.fail.sh new file mode 100644 index 00000000000..2218250ec7b --- /dev/null +++ b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_maxclassrepeat/tests/wrong_value.fail.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +if grep -q 'maxclassrepeat' /etc/security/pwquality.conf; then + sed -i 's/.*maxclassrepeat.*/maxclassrepeat = 5/' /etc/security/pwquality.conf +else + echo "maxclassrepeat = 5" >> /etc/security/pwquality.conf +fi + diff --git a/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_maxclassrepeat/tests/wrong_value_0.fail.sh b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_maxclassrepeat/tests/wrong_value_0.fail.sh new file mode 100644 index 00000000000..780873c6a86 --- /dev/null +++ b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_maxclassrepeat/tests/wrong_value_0.fail.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +if grep -q 'maxclassrepeat' /etc/security/pwquality.conf; then + sed -i 's/.*maxclassrepeat.*/maxclassrepeat = 0/' /etc/security/pwquality.conf +else + echo "maxclassrepeat = 0" >> /etc/security/pwquality.conf +fi + diff --git a/shared/templates/accounts_password/oval.template b/shared/templates/accounts_password/oval.template index 332a2800317..b995db11ea4 100644 --- a/shared/templates/accounts_password/oval.template +++ b/shared/templates/accounts_password/oval.template @@ -7,11 +7,14 @@ -