-
Notifications
You must be signed in to change notification settings - Fork 711
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ubuntu 24.04 5.3.3.4.4 Ensure pam_unix includes use_authtok #12760
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a25a2db
Ubuntu 24.04 5.3.3.4.4 Ensure pam_unix includes use_authtok
ericeberry 69a09ab
Ubuntu 24.04 5.3.3.4.4 Ensure pam_unix includes use_authtok
ericeberry 8a4d226
Ubuntu 24.04 5.3.3.4.4 Ensure pam_unix includes use_authtok
ericeberry 1cffce4
Attempting to fix Ubuntu 24.04 5.3.3.4.4 remdiation on server
ericeberry c1b0b0a
Attempt to fix pam_unix authtok failure test
ericeberry 2a15dc8
Fix test issues
ericeberry File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 --remove unix --enable cac_unix | ||
|
||
|
42 changes: 42 additions & 0 deletions
42
...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,42 @@ | ||
{{%- 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="any_exist" | ||
comment="use_authtok is configured in pam unix in common_password file"> | ||
<ind:object object_ref="obj_test_use_authtok" /> | ||
<ind:state state_ref="ste_test_use_authtok" /> | ||
</ind:textfilecontent54_test> | ||
|
||
<ind:textfilecontent54_object id="obj_test_use_authtok" version="1"> | ||
<set> | ||
<object_reference>obj_test_use_authtok_password_lines_except_first</object_reference> | ||
<filter action="include">ste_test_use_authtok_pam_unix_lines</filter> | ||
</set> | ||
</ind:textfilecontent54_object> | ||
|
||
<ind:textfilecontent54_state id="ste_test_use_authtok" version="1"> | ||
<ind:subexpression operation="pattern match">^[^#\n\r]+[ \t]+pam_unix\.so[ \t]+[^#\n\r]+use_authtok.*$</ind:subexpression> | ||
</ind:textfilecontent54_state> | ||
|
||
<!-- Get all password lines except the first line. This is to avoid matching a pam_unix | ||
line on the top of the stack, which does not need use_authtok to pass --> | ||
<ind:textfilecontent54_object id="obj_test_use_authtok_password_lines_except_first" version="1"> | ||
<ind:filepath>{{{ accounts_password_pam_unix_file }}}</ind:filepath> | ||
<ind:pattern operation="pattern match">^[ \t]*password[ \t]+(.+)$</ind:pattern> | ||
<ind:instance datatype="int" operation="greater than or equal">2</ind:instance> | ||
</ind:textfilecontent54_object> | ||
|
||
<ind:textfilecontent54_state id="ste_test_use_authtok_pam_unix_lines" version="1"> | ||
<ind:subexpression operation="pattern match">^[^#\n\r]+[ \t]+pam_unix\.so.*$</ind:subexpression> | ||
</ind:textfilecontent54_state> | ||
|
||
</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] |
18 changes: 18 additions & 0 deletions
18
...m/locking_out_password_attempts/accounts_password_pam_unix_authtok/tests/ubuntu_common.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,18 @@ | ||
#!/bin/bash | ||
# platform = multi_platform_ubuntu | ||
|
||
# remove all pam-auth-update configs which update the | ||
# primary password block and create a config with well defined | ||
# high priority to ensure correct stacking of our module | ||
grep -il "Password-Type: Primary" /usr/share/pam-configs/* | grep -v "/unix$" | xargs rm -f | ||
|
||
cat << EOF > /usr/share/pam-configs/cac_test_echo | ||
Name: Echo | ||
Default: yes | ||
Priority: 10000 | ||
Password-Type: Primary | ||
Password: | ||
password optional pam_echo.so | ||
Password-Initial: | ||
password optional pam_echo.so | ||
EOF |
39 changes: 39 additions & 0 deletions
39
...sword_attempts/accounts_password_pam_unix_authtok/tests/ubuntu_conflicting_values.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,39 @@ | ||
#!/bin/bash | ||
# platform = multi_platform_ubuntu | ||
|
||
source ubuntu_common.sh | ||
|
||
config_file=/usr/share/pam-configs/tmpunix | ||
|
||
# lower priority to ensure the config is below the cac_test_echo | ||
# on the stack, thus using the "Password:" configuration | ||
cat << EOF > "$config_file" | ||
Name: Unix authentication | ||
Default: yes | ||
Priority: 1024 | ||
Conflicts: unix | ||
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 | ||
[success=end default=ignore] pam_unix.so obscure 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" |
39 changes: 39 additions & 0 deletions
39
...word_attempts/accounts_password_pam_unix_authtok/tests/ubuntu_conflicting_values2.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,39 @@ | ||
#!/bin/bash | ||
# platform = multi_platform_ubuntu | ||
|
||
source ubuntu_common.sh | ||
|
||
config_file=/usr/share/pam-configs/tmpunix | ||
|
||
# lower priority to ensure the config is below the cac_test_echo | ||
# on the stack, thus using the "Password:" configuration | ||
cat << EOF > "$config_file" | ||
Name: Unix authentication | ||
Default: yes | ||
Priority: 1024 | ||
Conflicts: unix | ||
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 try_first_pass yescrypt | ||
[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" |
38 changes: 38 additions & 0 deletions
38
...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,38 @@ | ||
#!/bin/bash | ||
# platform = multi_platform_ubuntu | ||
|
||
source ubuntu_common.sh | ||
|
||
config_file=/usr/share/pam-configs/tmpunix | ||
|
||
# lower priority to ensure the config is below the cac_test_echo | ||
# on the stack, thus using the "Password:" configuration | ||
cat << EOF > "$config_file" | ||
Name: Unix authentication | ||
Default: yes | ||
Priority: 1024 | ||
Conflicts: unix | ||
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" |
38 changes: 38 additions & 0 deletions
38
...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,38 @@ | ||
#!/bin/bash | ||
# platform = multi_platform_ubuntu | ||
|
||
source ubuntu_common.sh | ||
|
||
config_file=/usr/share/pam-configs/tmpunix | ||
|
||
# lower priority to ensure the config is below the cac_test_echo | ||
# on the stack, thus using the "Password:" configuration | ||
cat << EOF > "$config_file" | ||
Name: Unix authentication | ||
Default: yes | ||
Priority: 1024 | ||
Conflicts: unix | ||
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 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" |
38 changes: 38 additions & 0 deletions
38
...rd_attempts/accounts_password_pam_unix_authtok/tests/ubuntu_missing_value_initial.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,38 @@ | ||
#!/bin/bash | ||
# platform = multi_platform_ubuntu | ||
|
||
source ubuntu_common.sh | ||
|
||
config_file=/usr/share/pam-configs/tmpunix | ||
|
||
# higher priority to ensure the config is above the cac_test_echo | ||
# on the stack, thus using the "Password-Initial:" configuration | ||
cat << EOF > "$config_file" | ||
Name: Unix authentication | ||
Default: yes | ||
Priority: 1000000 | ||
Conflicts: unix | ||
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 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" |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is a fix for all rules using the
bash_pam_unix_enable
macro. Please add a note to the description.