diff --git a/linux_os/guide/system/accounts/accounts-pam/set_password_hashing_algorithm/set_password_hashing_algorithm_logindefs/tests/default_multivalue.fail.sh b/linux_os/guide/system/accounts/accounts-pam/set_password_hashing_algorithm/set_password_hashing_algorithm_logindefs/tests/default_multivalue.fail.sh new file mode 100644 index 00000000000..6970170d33d --- /dev/null +++ b/linux_os/guide/system/accounts/accounts-pam/set_password_hashing_algorithm/set_password_hashing_algorithm_logindefs/tests/default_multivalue.fail.sh @@ -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 diff --git a/linux_os/guide/system/accounts/accounts-pam/set_password_hashing_algorithm/set_password_hashing_algorithm_logindefs/tests/default_multivalue.pass.sh b/linux_os/guide/system/accounts/accounts-pam/set_password_hashing_algorithm/set_password_hashing_algorithm_logindefs/tests/default_multivalue.pass.sh new file mode 100644 index 00000000000..741e6ecec62 --- /dev/null +++ b/linux_os/guide/system/accounts/accounts-pam/set_password_hashing_algorithm/set_password_hashing_algorithm_logindefs/tests/default_multivalue.pass.sh @@ -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 diff --git a/linux_os/guide/system/accounts/accounts-pam/set_password_hashing_algorithm/set_password_hashing_algorithm_logindefs/tests/default_multivalue2.pass.sh b/linux_os/guide/system/accounts/accounts-pam/set_password_hashing_algorithm/set_password_hashing_algorithm_logindefs/tests/default_multivalue2.pass.sh new file mode 100644 index 00000000000..efdaf91799d --- /dev/null +++ b/linux_os/guide/system/accounts/accounts-pam/set_password_hashing_algorithm/set_password_hashing_algorithm_logindefs/tests/default_multivalue2.pass.sh @@ -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 diff --git a/linux_os/guide/system/accounts/accounts-pam/set_password_hashing_algorithm/set_password_hashing_algorithm_logindefs/tests/default_partial.fail.sh b/linux_os/guide/system/accounts/accounts-pam/set_password_hashing_algorithm/set_password_hashing_algorithm_logindefs/tests/default_partial.fail.sh new file mode 100644 index 00000000000..707b7fe4bb9 --- /dev/null +++ b/linux_os/guide/system/accounts/accounts-pam/set_password_hashing_algorithm/set_password_hashing_algorithm_logindefs/tests/default_partial.fail.sh @@ -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