-
Notifications
You must be signed in to change notification settings - Fork 706
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
Open
ericeberry
wants to merge
6
commits into
ComplianceAsCode:master
Choose a base branch
from
ericeberry:u2404_53344
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+141
−4
Open
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7621f2e
Ubuntu 24.04 5.3.3.4.4 Ensure pam_unix includes use_authtok
ericeberry e1e649c
Ubuntu 24.04 5.3.3.4.4 Ensure pam_unix includes use_authtok
ericeberry 1331b24
Merge remote-tracking branch 'origin/master' into u2404_53344
ericeberry 5ba183b
Merge remote-tracking branch 'origin/master' into u2404_53344
ericeberry 2782156
Ubuntu 24.04 5.3.3.4.4 Ensure pam_unix includes use_authtok
ericeberry 038943d
Attempting to fix Ubuntu 24.04 5.3.3.4.4 remdiation on server
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 | ||
|
||
|
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="at_least_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" |
33 changes: 33 additions & 0 deletions
33
...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,33 @@ | ||
#!/bin/bash | ||
# platform = multi_platform_ubuntu | ||
|
||
config_file=/usr/share/pam-configs/tmpunix | ||
|
||
cat << EOF > "$config_file" | ||
Name: Unix authentication | ||
Default: yes | ||
Priority: 1024 | ||
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 --remove unix --enable tmpunix --force | ||
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.