Skip to content

Commit

Permalink
Merge pull request #11282 from mpurg/fix_no_empty_passwords
Browse files Browse the repository at this point in the history
Fix and modify UBTU-20-010463 (no_empty_passwords)
  • Loading branch information
dodys authored Nov 21, 2023
2 parents 117b7be + eed70c3 commit a195365
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# complexity = low
# disruption = medium
{{% if 'ubuntu' in product %}}
{{%- set pam_config_paths = "['/etc/pam.d/common-password']" %}}
{{%- set pam_config_paths = "['/etc/pam.d/common-password', '/etc/pam.d/common-auth']" %}}
{{% else %}}
{{%- set pam_config_paths = "['/etc/pam.d/system-auth', '/etc/pam.d/password-auth']" -%}}
{{% endif %}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ for FILE in ${NULLOK_FILES}; do
sed --follow-symlinks -i 's/\<nullok\>//g' ${FILE}
done
{{% elif 'ubuntu' in product %}}
COMMON_PASSWORD_PATH="/etc/pam.d/common-password"
if grep -l "nullok.*" ${COMMON_PASSWORD_PATH}; then
sed -i 's/nullok.*//g' ${COMMON_PASSWORD_PATH}
fi
for FILE in "/etc/pam.d/common-auth" "/etc/pam.d/common-password"; do
sed -i 's/\(.*pam_unix\.so.*\)\s\<nullok\>\(.*\)/\1\2/g' ${FILE}
done
{{% else %}}
if [ -f /usr/bin/authselect ]; then
{{{ bash_enable_authselect_feature('without-nullok') }}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{{% if product in ['sle12', 'sle15'] %}}
<ind:filepath operation="pattern match">^/etc/pam.d/.*$</ind:filepath>
{{% elif 'ubuntu' in product %}}
<ind:filepath operation="pattern match">^/etc/pam.d/common-password</ind:filepath>
<ind:filepath operation="pattern match">^/etc/pam.d/common-(auth|password)</ind:filepath>
{{% else %}}
<ind:filepath operation="pattern match">^/etc/pam.d/(system|password)-auth$</ind:filepath>
{{% endif %}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/bin/bash
# platform = Oracle Linux 7,Red Hat Enterprise Linux 7,Red Hat Virtualization 4,multi_platform_fedora
# platform = Oracle Linux 7,Red Hat Enterprise Linux 7,Red Hat Virtualization 4,multi_platform_fedora,multi_platform_ubuntu

{{% if 'ubuntu' in product %}}
sed -i --follow-symlinks '/nullok/d' /etc/pam.d/common-auth
sed -i --follow-symlinks '/nullok/d' /etc/pam.d/common-password
{{% else %}}
sed -i --follow-symlinks '/nullok/d' /etc/pam.d/system-auth
sed -i --follow-symlinks '/nullok/d' /etc/pam.d/password-auth
{{% endif %}}
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
#!/bin/bash
# platform = Oracle Linux 7,Red Hat Enterprise Linux 7,Red Hat Virtualization 4,multi_platform_fedora
# platform = Oracle Linux 7,Red Hat Enterprise Linux 7,Red Hat Virtualization 4,multi_platform_fedora,multi_platform_ubuntu

{{% if 'ubuntu' in product %}}
for FILE in "/etc/pam.d/common-auth" "/etc/pam.d/common-password"; do
if ! grep -q "^[^#].*pam_unix\.so.*nullok" ${FILE}; then
sed -i 's/\([\s]pam_unix\.so\)/\1 nullok/g' ${FILE}
fi
done
{{% else %}}
SYSTEM_AUTH_FILE="/etc/pam.d/system-auth"

if ! $(grep -q "^[^#].*pam_unix\.so.*nullok" $SYSTEM_AUTH_FILE); then
sed -i --follow-symlinks 's/\([\s].*pam_unix\.so.*\)\s\(try_first_pass.*\)/\1nullok \2/' $SYSTEM_AUTH_FILE
fi
{{% endif %}}

6 changes: 3 additions & 3 deletions products/ubuntu2004/profiles/stig.profile
Original file line number Diff line number Diff line change
Expand Up @@ -591,11 +591,11 @@ selections:
- disable_ctrlaltdel_reboot
- disable_ctrlaltdel_burstaction

# UBTU-20-010462 The Ubuntu operating system must not have accounts configured with blank or null passwords.
- no_empty_passwords_etc_shadow

# UBTU-20-010461 The Ubuntu operating system must disable automatic mounting of Universal Serial Bus (USB) mass storage driver.
- kernel_module_usb-storage_disabled

# UBTU-20-010462 The Ubuntu operating system must not have accounts configured with blank or null passwords.
- no_empty_passwords_etc_shadow

# UBTU-20-010463 The Ubuntu operating system must not allow accounts configured with blank or null passwords.
- no_empty_passwords

0 comments on commit a195365

Please sign in to comment.