Skip to content

Commit f80c992

Browse files
authored
Merge pull request #13811 from mrkanon/accounts_password_pam_retry
Update accounts_password_pam_pwquality_retry for OL STIG
2 parents d19dd58 + 2994a1c commit f80c992

26 files changed

+175
-24
lines changed

controls/stig_ol9.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2593,7 +2593,7 @@ controls:
25932593
title: OL 9 must ensure the password complexity module in the system-auth file is configured for
25942594
three retries or less.
25952595
rules:
2596-
- accounts_password_pam_retry
2596+
- accounts_password_pam_pwquality_retry
25972597
- var_password_pam_retry=3
25982598
status: automated
25992599

linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_pwquality_retry/rule.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ identifiers:
2525
references:
2626
srg: SRG-OS-000069-GPOS-00037
2727

28+
{{% if product == "ol8" %}}
29+
platform: os_linux[ol]>8.3
30+
{{% endif %}}
31+
2832
ocil_clause: 'the value of "retry" is set to "0" or greater than "{{{ xccdf_value("var_password_pam_retry") }}}", or is missing'
2933

3034
ocil: |-

linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_retry/ansible/shared.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
# disruption = medium
66
{{% if 'ubuntu' in product %}}
77
{{% set configuration_files = ["common-password"] %}}
8-
{{% elif product in ['ol8', 'ol9'] or 'rhel' in product or 'almalinux' in product %}}
8+
{{% elif 'ol' in families or 'rhel' in product or 'almalinux' in product %}}
99
{{% set configuration_files = ["password-auth","system-auth"] %}}
1010
{{% else %}}
1111
{{% set configuration_files = ["system-auth"] %}}
1212
{{% endif %}}
1313

1414
{{{ ansible_instantiate_variables("var_password_pam_retry") }}}
1515

16-
{{% if product in ['ol8', 'ol9', 'rhel8', 'rhel9', 'almalinux'] -%}}
16+
{{% if product in ['rhel8', 'rhel9', 'almalinux'] -%}}
1717
- name: Ensure PAM variable retry is set accordingly
1818
ansible.builtin.lineinfile:
1919
create: yes

linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_retry/bash/shared.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# platform = multi_platform_all
22

3-
{{% if product in ['ol8', 'ol9'] or 'rhel' in product %}}
3+
{{% if 'ol' in families or 'rhel' in product %}}
44
{{% set configuration_files = ["password-auth","system-auth"] %}}
55
{{% else %}}
66
{{% set configuration_files = ["system-auth"] %}}
@@ -9,7 +9,7 @@
99

1010
{{{ bash_instantiate_variables("var_password_pam_retry") }}}
1111

12-
{{% if product in ['ol8', 'ol9'] or 'rhel' in product -%}}
12+
{{% if 'rhel' in product -%}}
1313
{{{ bash_replace_or_append('/etc/security/pwquality.conf',
1414
'^retry',
1515
'$var_password_pam_retry',

linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_retry/oval/shared.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
test_ref="test_password_pam_pwquality_retry_{{{ file | escape_id }}}" />
2020
{{% endfor %}}
2121
</criteria>
22+
{{% if 'ol' not in families%}}
2223
<criteria operator="AND" comment="Conditions for retry in pwquality.conf file are satisfied">
2324
{{% for file in configuration_files %}}
2425
<criterion
@@ -28,6 +29,7 @@
2829
<criterion comment="check retry parameter in pwquality.conf"
2930
test_ref="test_password_pam_pwquality_retry_pwquality_conf"/>
3031
</criteria>
32+
{{% endif %}}
3133
</criteria>
3234
</criteria>
3335
</definition>
@@ -64,9 +66,11 @@
6466
{{{ object_pwquality_retry( path="/etc/pam.d/" ~ file ,
6567
test_ref="password_pam_pwquality_retry_" ~ (file | escape_id)) }}}
6668

69+
{{% if 'ol' not in families %}}
6770
{{{ test_pwquality_notset(file,
6871
"password_pam_pwquality_retry_" ~ (file | escape_id) ~"_not_set",
6972
"password_pam_pwquality_retry_" ~ (file | escape_id)) }}}
73+
{{% endif %}}
7074
{{% endfor %}}
7175

7276
<ind:textfilecontent54_state id="state_password_pam_retry_upper_bound" version="1"
@@ -82,7 +86,7 @@
8286

8387
<external_variable datatype="int" id="var_password_pam_retry" version="1"
8488
comment="External variable for pam_pwquality retry"/>
85-
89+
{{% if 'ol' not in families %}}
8690
<ind:textfilecontent54_test check="all" version="1"
8791
id="test_password_pam_pwquality_retry_pwquality_conf"
8892
comment="check the configuration of /etc/security/pwquality.conf">
@@ -96,4 +100,5 @@
96100
<ind:pattern operation="pattern match">^[\s]*retry[\s]*=[\s]*(\d+)(?:[\s]|$)</ind:pattern>
97101
<ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
98102
</ind:textfilecontent54_object>
103+
{{% endif %}}
99104
</def-group>

linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_retry/rule.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,11 @@ ocil: |-
6464
<pre>password requisite pam_pwquality.so retry={{{ xccdf_value("var_password_pam_retry") }}}</pre>
6565
{{% endif %}}
6666
67+
{{% if product == "ol8" %}}
68+
platform: os_linux[ol]<8.4 and package[libpwquality]
69+
{{% else %}}
6770
platform: package[libpwquality]
71+
{{% endif %}}
6872

6973
fixtext: |-
7074
Configure {{{ full_name }}} to limit the "pwquality" retry option to {{{ xccdf_value("var_password_pam_retry") }}}.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/bin/bash
22
# platform = Red Hat Virtualization 4,multi_platform_fedora,multi_platform_ol,multi_platform_rhel,multi_platform_ubuntu,multi_platform_almalinux
33
# variables = var_password_pam_retry=3
4+
{{% if 'ol' in families %}}
5+
# packages = authselect
6+
{{% endif %}}
47

58
source common.sh

linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_retry/tests/common.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{{% if 'ubuntu' in product %}}
22
configuration_files=("common-password")
3-
{{% elif product in ['ol8', 'ol9'] or 'rhel' in product %}}
3+
{{% elif 'ol' in families or 'rhel' in product %}}
44
configuration_files=("password-auth" "system-auth")
55
{{% else %}}
66
configuration_files=("system-auth")
77
{{% endif %}}
88

99

10-
{{% if product in ['ol8', 'ol9'] or 'rhel' in product %}}
10+
{{% if 'ol' in families or 'rhel' in product %}}
1111
authselect create-profile testingProfile --base-on sssd
1212

1313
for file in ${configuration_files[@]}; do

linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_retry/tests/correct_value.pass.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#!/bin/bash
2-
# platform = Oracle Linux 7,Red Hat Virtualization 4,multi_platform_fedora,multi_platform_ubuntu
2+
# platform = multi_platform_ol,Red Hat Virtualization 4,multi_platform_fedora,multi_platform_ubuntu
33
# variables = var_password_pam_retry=3
4+
{{% if 'ol' in families %}}
5+
# packages = authselect
6+
{{% endif %}}
47

58
source common.sh
69

@@ -16,6 +19,16 @@ Password:
1619
EOF
1720

1821
DEBIAN_FRONTEND=noninteractive pam-auth-update
22+
{{% elif 'ol' in families %}}
23+
for cfile in ${configuration_files[@]}; do
24+
{{{ bash_ensure_pam_module_configuration('/etc/pam.d/$cfile',
25+
'password',
26+
'required',
27+
'pam_pwquality.so',
28+
'retry',
29+
"3",
30+
'^\s*account') }}}
31+
done
1932
{{% else %}}
2033
for file in ${configuration_files[@]}; do
2134
{{{ bash_ensure_pam_module_option('/etc/pam.d/$file',

linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_retry/tests/pwquality_conf_commented.fail.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
# packages = authselect
3-
# platform = Oracle Linux 8,Oracle Linux 9,multi_platform_rhel
3+
# platform = multi_platform_rhel
44
# variables = var_password_pam_retry=3
55

66
source common.sh

0 commit comments

Comments
 (0)