Skip to content

Commit

Permalink
Fix nullok_present.fail.sh of no_empty_passwords
Browse files Browse the repository at this point in the history
  • Loading branch information
alanmcanonical committed Jan 6, 2025
1 parent d110d7b commit be86b98
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
{{% if 'ubuntu' in product %}}
for FILE in "/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}
sed -i '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
sed -i --follow-symlinks 's/\(^[^#].*pam_unix\.so.*\)\s\(try_first_pass.*\)/\1nullok \2/' $SYSTEM_AUTH_FILE
fi
{{% endif %}}

Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
PASSWORD_AUTH_FILE="/etc/pam.d/password-auth"

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

0 comments on commit be86b98

Please sign in to comment.