-
Notifications
You must be signed in to change notification settings - Fork 706
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ubuntu 24.04 5.3.3.4.4 Ensure pam_unix includes use_authtok
- Loading branch information
1 parent
ed46c2a
commit 7621f2e
Showing
8 changed files
with
113 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...ounts-pam/locking_out_password_attempts/accounts_password_pam_unix_authtok/bash/shared.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# platform = multi_platform_ubuntu | ||
|
||
config_file="/usr/share/pam-configs/cac_unix" | ||
{{{ bash_pam_unix_enable() }}} | ||
sed -i -E '/^Password:/,/^[^[:space:]]/ { | ||
/pam_unix\.so/ { | ||
/use_authtok/! s/$/ use_authtok/g | ||
} | ||
}' "$config_file" | ||
|
||
|
||
DEBIAN_FRONTEND=noninteractive pam-auth-update | ||
|
||
|
23 changes: 23 additions & 0 deletions
23
...unts-pam/locking_out_password_attempts/accounts_password_pam_unix_authtok/oval/shared.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{{%- set accounts_password_pam_unix_file = '/etc/pam.d/common-password' -%}} | ||
|
||
<def-group> | ||
<definition class="compliance" id="{{{ rule_id }}}" version="1"> | ||
{{{ oval_metadata("Configure the system to include use_authtok in pam common_password configuration file") }}} | ||
<criteria> | ||
<criterion test_ref="test_password_pam_unix_use_authtok" | ||
comment="use_authtok is configured in pam unix in common_password file"/> | ||
</criteria> | ||
</definition> | ||
|
||
<ind:textfilecontent54_test id="test_password_pam_unix_use_authtok" version="1" | ||
check="all" check_existence="only_one_exists" | ||
comment="use_authtok is configured in pam unix in common_password file"> | ||
<ind:object object_ref="obj_test_use_authtok" /> | ||
</ind:textfilecontent54_test> | ||
|
||
<ind:textfilecontent54_object id="obj_test_use_authtok" version="1"> | ||
<ind:filepath>{{{ accounts_password_pam_unix_file }}}</ind:filepath> | ||
<ind:pattern operation="pattern match">^[ \t]*password[ \t]+([^#\n\r]+)[ \t]+pam_unix\.so[ \t]+([^#\n\r]+[ \t]+)?use_authtok.*$</ind:pattern> | ||
<ind:instance datatype="int" operation="equals">1</ind:instance> | ||
</ind:textfilecontent54_object> | ||
</def-group> |
32 changes: 32 additions & 0 deletions
32
...ts/accounts-pam/locking_out_password_attempts/accounts_password_pam_unix_authtok/rule.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
documentation_complete: true | ||
|
||
|
||
title: 'Require use_authtok for pam_unix.so' | ||
|
||
{{% set configFile = "/etc/pam.d/common-password" %}} | ||
|
||
description: |- | ||
When password changing enforce the module to set the new password to the one | ||
provided by a previously stacked password module | ||
rationale: |- | ||
Require use_authtok in pam_unix.so configuration | ||
severity: medium | ||
|
||
ocil_clause: 'Usage of use_authtok for pam_unix.so is required' | ||
|
||
ocil: |- | ||
To verify the password reuse setting is compliant, run the following command: | ||
<pre>$ grep use_authtok {{{ configFile }}}</pre> | ||
The output should show use_authtok on the line. | ||
fixtext: |- | ||
To configure the <tt>use_authtok</tt> option for the <tt>pam_unix</tt> | ||
PAM modules, in the file <tt>{{{ configFile }}}</tt>, append <tt>use_authtok</tt> | ||
to the line which refers to the <tt>pam_unix.so</tt>, as | ||
shown below: | ||
<pre>password [success=1 default=ignore] pam_unix.so <i>...existing_options...</i> use_authtok</pre> | ||
platform: package[pam] |
33 changes: 33 additions & 0 deletions
33
...t_password_attempts/accounts_password_pam_unix_authtok/tests/ubuntu_correct_value.pass.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
# platform = multi_platform_ubuntu | ||
|
||
config_file=/usr/share/pam-configs/tmpunix | ||
|
||
cat << EOF > "$config_file" | ||
Name: Unix authentication | ||
Default: yes | ||
Priority: 0 | ||
Auth-Type: Primary | ||
Auth: | ||
[success=end default=ignore] pam_unix.so try_first_pass | ||
Auth-Initial: | ||
[success=end default=ignore] pam_unix.so | ||
Account-Type: Primary | ||
Account: | ||
[success=end new_authtok_reqd=done default=ignore] pam_unix.so | ||
Account-Initial: | ||
[success=end new_authtok_reqd=done default=ignore] pam_unix.so | ||
Session-Type: Additional | ||
Session: | ||
required pam_unix.so | ||
Session-Initial: | ||
required pam_unix.so | ||
Password-Type: Primary | ||
Password: | ||
[success=end default=ignore] pam_unix.so obscure use_authtok try_first_pass yescrypt | ||
Password-Initial: | ||
[success=end default=ignore] pam_unix.so obscure yescrypt | ||
EOF | ||
|
||
DEBIAN_FRONTEND=noninteractive pam-auth-update | ||
rm "$config_file" |
5 changes: 5 additions & 0 deletions
5
...t_password_attempts/accounts_password_pam_unix_authtok/tests/ubuntu_missing_value.fail.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
# platform = multi_platform_ubuntu | ||
|
||
config_file=/etc/pam.d/common-password | ||
sed -i --follow-symlinks "s/use_authtok//g" $config_file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters