Skip to content

Commit fece618

Browse files
Merge pull request #10567 from rumch-se/fix_accounts_passwords_pam_tally2_deny_root
Fixes in SLE 12/15 rule accounts_passwords_pam_tally2_deny_root
2 parents 1a854d4 + a5f1f43 commit fece618

11 files changed

Lines changed: 26 additions & 22 deletions

File tree

controls/anssi.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,8 @@ controls:
755755
- var_accounts_passwords_pam_faillock_deny=3
756756
- accounts_passwords_pam_faillock_deny
757757
- accounts_passwords_pam_faillock_deny_root
758+
# same as above but for pam_tally2 module
759+
- accounts_passwords_pam_tally2_deny_root
758760
# Automatically unlock users after 15 min to prevent DoS
759761
- var_accounts_passwords_pam_faillock_unlock_time=900
760762
- accounts_passwords_pam_faillock_unlock_time

controls/cis_sle12.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1771,6 +1771,7 @@ controls:
17711771
rules:
17721772
- accounts_passwords_pam_tally2
17731773
- var_password_pam_tally2=5
1774+
- accounts_passwords_pam_tally2_deny_root
17741775

17751776
- id: 5.3.3
17761777
title: Ensure password reuse is limited (Automated)

controls/cis_sle15.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1965,6 +1965,7 @@ controls:
19651965
rules:
19661966
- accounts_passwords_pam_tally2
19671967
- var_password_pam_tally2=5
1968+
- accounts_passwords_pam_tally2_deny_root
19681969

19691970
- id: 5.3.3
19701971
title: Ensure password reuse is limited (Automated)
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# platform = multi_platform_sle,multi_platform_ubuntu
1+
# platform = multi_platform_sle
22
# reboot = false
33
# strategy = restrict
44
# complexity = low
55
# disruption = low
66

7-
{{{ ansible_ensure_pam_module_option('/etc/pam.d/common-auth', 'auth', 'required', 'pam_tally2.so', 'even_deny_root', '', '') }}}
8-
7+
{{{ ansible_remove_pam_module_option('/etc/pam.d/login', 'auth', 'required', 'pam_tally2.so', 'onerr=fail') }}}
8+
{{{ ansible_ensure_pam_module_option('/etc/pam.d/login', 'auth', 'required', 'pam_tally2.so', 'even_deny_root', '', '') }}}
99
{{{ ansible_ensure_pam_module_option('/etc/pam.d/common-account', 'account', 'required', 'pam_tally2.so', '', '', '') }}}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# platform = multi_platform_sle,multi_platform_ubuntu
1+
# platform = multi_platform_sle
22
# reboot = false
33
# strategy = restrict
44
# complexity = low
55
# disruption = low
66

7-
{{{ bash_ensure_pam_module_option('/etc/pam.d/common-auth', 'auth', 'required', 'pam_tally2.so', 'even_deny_root', '', '') }}}
8-
7+
{{{ bash_remove_pam_module_option('/etc/pam.d/login', 'auth', 'required', 'pam_tally2.so', 'onerr=fail') }}}
8+
{{{ bash_ensure_pam_module_option('/etc/pam.d/login', 'auth', 'required', 'pam_tally2.so', 'even_deny_root', '', '') }}}
99
{{{ bash_ensure_pam_module_option('/etc/pam.d/common-account', 'account', 'required', 'pam_tally2.so', '', '', '') }}}

linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_passwords_pam_tally2_deny_root/oval/shared.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
</ind:textfilecontent54_test>
1818

1919
<ind:textfilecontent54_object id="object_accounts_passwords_pam_tally2_even_deny_root" comment="Check even deny root configuration of pam_tally2" version="1">
20-
<ind:filepath>/etc/pam.d/common-auth</ind:filepath>
21-
<ind:pattern operation="pattern match">^\s*auth\s+required\s+pam_tally2\.so\s+[^\n]*deny=[[4-9]|[1-9][0-9]]+([\s+\S+]*)even_deny_root([\s+\S+])*\s*(\\)*$</ind:pattern>
22-
<ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
20+
<ind:filepath>/etc/pam.d/login</ind:filepath>
21+
<ind:pattern operation="pattern match">^\s*auth(?:(?!\n)\s)+required(?:(?!\n)\s)+pam_tally2.so(?:(?!\n)\s)+(?:(?:(?:(?!\n)\s)?[^\n]+)?onerr=fail(?:(?:(?!\n)\s)+[^\n]+)?(?:(?!\n)\s)+deny=(\d+)(?:(?:\s+\S+)*\s*$))|(?:(?:(?:(?!\n)\s)?[^\n]+)?deny=(\d+)(?:(?:(?!\n)\s)+[^\n]+)?(?:(?!\n)\s)+even_deny_root(?:(?:\s+\S+)*\s*$))</ind:pattern>
22+
<ind:instance datatype="int">1</ind:instance>
2323
</ind:textfilecontent54_object>
2424

2525
<ind:textfilecontent54_test id="test_accounts_passwords_pam_tally2_even_deny_root_account"

linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_passwords_pam_tally2_deny_root/rule.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ identifiers:
2222
references:
2323
anssi: BP28(R18)
2424
cis-csc: 1,12,15,16
25+
cis@sle12: 5.3.2
26+
cis@sle15: 5.3.2
2527
cobit5: DSS05.04,DSS05.10,DSS06.10
2628
disa: CCI-002238,CCI-000044
2729
isa-62443-2009: 4.3.3.6.1,4.3.3.6.2,4.3.3.6.3,4.3.3.6.4,4.3.3.6.5,4.3.3.6.6,4.3.3.6.7,4.3.3.6.8,4.3.3.6.9
@@ -38,17 +40,17 @@ ocil_clause: 'limiting the number of failed logon attempts for the root user is
3840
ocil: |-
3941
To ensure that even the <tt>root</tt> account is locked after a defined number of failed password
4042
attempts, run the following command:
41-
<pre>$ grep even_deny_root /etc/pam.d/common-auth</pre>
43+
<pre>$ grep even_deny_root /etc/pam.d/login</pre>
4244
The output should show <tt>even_deny_root</tt>.
4345

4446
fixtext: |-
4547
To configure the system to lock out the <tt>root</tt> account after a number of incorrect login
46-
attempts using <tt>pam_tally2.so</tt>, modify the content of both <tt>/etc/pam.d/common-auth</tt> and
48+
attempts using <tt>pam_tally2.so</tt>, modify the content of both <tt>/etc/pam.d/login</tt> and
4749
<tt>/etc/pam.d/common-account</tt> as follows:
4850
<br /><br />
4951
<ul>
5052
<li> add or modify the <tt>pam_tally2.so</tt> module line in
51-
<tt>/etc/pam.d/common-auth</tt> to ensure <tt>even_deny_root</tt> is present. For example:
53+
<tt>/etc/pam.d/login</tt> to ensure <tt>even_deny_root</tt> is present. For example:
5254
<pre>auth required pam_tally2.so deny=4 even_deny_root unlock_time=1200</pre>
5355
<li> add or modify the following line in <tt>/etc/pam.d/common-account</tt>:
5456
<pre>account required pam_tally2.so</pre></li>

linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_passwords_pam_tally2_deny_root/tests/pam_tally2_absent_account_config.fail.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/bin/bash
2-
# platform = multi_platform_sle,Ubuntu 20.04
2+
# platform = multi_platform_sle
33

44
cat >/etc/pam.d/common-account <<CAPTA
55
account [success=1 new_authtok_reqd=done default=ignore] pam_unix.so
66
account requisite pam_deny.so
77
account required pam_permit.so
88
CAPTA
99

10-
cat >/etc/pam.d/common-auth <<CAPTEDRC
10+
cat >/etc/pam.d/login <<CAPTEDRC
1111
auth required pam_tally2.so onerr=fail audit silent deny=3 even_deny_root unlock_time=900
1212
auth [success=1 default=ignore] pam_unix.so nullok_secure
1313
auth requisite pam_deny.so

linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_passwords_pam_tally2_deny_root/tests/pam_tally2_deny_missing.fail.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# platform = multi_platform_sle,Ubuntu 20.04
2+
# platform = multi_platform_sle
33

44
cat >/etc/pam.d/common-account <<CAPTAC
55
account [success=1 new_authtok_reqd=done default=ignore] pam_unix.so
@@ -8,7 +8,7 @@ account required pam_tally2.so
88
account required pam_permit.so
99
CAPTAC
1010

11-
cat >/etc/pam.d/common-auth <<CAPTDM
11+
cat >/etc/pam.d/login <<CAPTDM
1212
auth required pam_tally2.so onerr=fail audit silent even_deny_root unlock_time=900
1313
auth [success=1 default=ignore] pam_unix.so nullok_secure
1414
auth requisite pam_deny.so
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# platform = multi_platform_sle,Ubuntu 20.04
2+
# platform = multi_platform_sle
33

44
cat >/etc/pam.d/common-account <<CAPTC
55
account [success=1 new_authtok_reqd=done default=ignore] pam_unix.so
@@ -8,11 +8,10 @@ account required pam_tally2.so
88
account required pam_permit.so
99
CAPTC
1010

11-
cat >/etc/pam.d/common-auth <<CAPTEDRM
11+
cat >/etc/pam.d/login <<CAPTEDRM
1212
auth required pam_tally2.so onerr=fail audit silent deny=3 unlock_time=900
1313
auth [success=1 default=ignore] pam_unix.so nullok_secure
1414
auth requisite pam_deny.so
1515
auth required pam_permit.so
1616
auth optional pam_cap.so
1717
CAPTEDRM
18-

0 commit comments

Comments
 (0)