-
Notifications
You must be signed in to change notification settings - Fork 700
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12636 from ericeberry/u2404-5414
U2404 5414
- Loading branch information
Showing
10 changed files
with
62 additions
and
5 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
5 changes: 5 additions & 0 deletions
5
...am/set_password_hashing_algorithm/set_password_hashing_algorithm_logindefs/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 |
---|---|---|
@@ -1,4 +1,9 @@ | ||
# platform = multi_platform_all | ||
|
||
{{{ bash_instantiate_variables("var_password_hashing_algorithm") }}} | ||
|
||
# Allow multiple algorithms, but choose the first one for remediation | ||
# | ||
var_password_hashing_algorithm="$(echo $var_password_hashing_algorithm | cut -d \| -f 1)" | ||
|
||
{{{ bash_replace_or_append('/etc/login.defs', '^ENCRYPT_METHOD', "$var_password_hashing_algorithm", '%s %s') }}} |
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
8 changes: 8 additions & 0 deletions
8
...shing_algorithm/set_password_hashing_algorithm_logindefs/tests/default_multivalue.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,8 @@ | ||
#!/bin/bash | ||
# variables = var_password_hashing_algorithm=good_value1|good_value2 | ||
|
||
if grep -q "^ENCRYPT_METHOD" /etc/login.defs; then | ||
sed -i "s/^ENCRYPT_METHOD\b.*/ENCRYPT_METHOD wrong_value/" /etc/login.defs | ||
else | ||
echo "ENCRYPT_METHOD wrong_value" >> /etc/login.defs | ||
fi |
8 changes: 8 additions & 0 deletions
8
...shing_algorithm/set_password_hashing_algorithm_logindefs/tests/default_multivalue.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,8 @@ | ||
#!/bin/bash | ||
# variables = var_password_hashing_algorithm=good_value1|good_value2 | ||
|
||
if grep -q "^ENCRYPT_METHOD" /etc/login.defs; then | ||
sed -i "s/^ENCRYPT_METHOD\b.*/ENCRYPT_METHOD good_value2/" /etc/login.defs | ||
else | ||
echo "ENCRYPT_METHOD good_value2" >> /etc/login.defs | ||
fi |
8 changes: 8 additions & 0 deletions
8
...hing_algorithm/set_password_hashing_algorithm_logindefs/tests/default_multivalue2.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,8 @@ | ||
#!/bin/bash | ||
# variables = var_password_hashing_algorithm=good_value1|good_value2 | ||
|
||
if grep -q "^ENCRYPT_METHOD" /etc/login.defs; then | ||
sed -i "s/^ENCRYPT_METHOD\b.*/ENCRYPT_METHOD good_value1/" /etc/login.defs | ||
else | ||
echo "ENCRYPT_METHOD good_value1" >> /etc/login.defs | ||
fi |
9 changes: 9 additions & 0 deletions
9
..._hashing_algorithm/set_password_hashing_algorithm_logindefs/tests/default_partial.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,9 @@ | ||
#!/bin/bash | ||
# variables = var_password_hashing_algorithm=value1|value2 | ||
|
||
# test that partial match fails | ||
if grep -q "^ENCRYPT_METHOD" /etc/login.defs; then | ||
sed -i "s/^ENCRYPT_METHOD\b.*/ENCRYPT_METHOD value/" /etc/login.defs | ||
else | ||
echo "ENCRYPT_METHOD value" >> /etc/login.defs | ||
fi |
9 changes: 9 additions & 0 deletions
9
...hashing_algorithm/set_password_hashing_algorithm_logindefs/tests/default_yescrypt.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,9 @@ | ||
#!/bin/bash | ||
# variables = var_password_hashing_algorithm=YESCRYPT | ||
|
||
# Make sure ENCRYPT_METHOD is YESCRYPT | ||
if grep -q "^ENCRYPT_METHOD" /etc/login.defs; then | ||
sed -i "s/^ENCRYPT_METHOD\b.*/ENCRYPT_METHOD YESCRYPT/" /etc/login.defs | ||
else | ||
echo "ENCRYPT_METHOD YESCRYPT" >> /etc/login.defs | ||
fi |
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 |
---|---|---|
|
@@ -17,3 +17,4 @@ options: | |
SHA512: SHA512 | ||
SHA256: SHA256 | ||
yescrypt: YESCRYPT | ||
cis_ubuntu2404: SHA512|YESCRYPT |