diff --git a/linux_os/guide/system/accounts/accounts-restrictions/password_expiration/accounts_minimum_age_login_defs/tests/bad_value.fail.sh b/linux_os/guide/system/accounts/accounts-restrictions/password_expiration/accounts_minimum_age_login_defs/tests/bad_value.fail.sh new file mode 100644 index 00000000000..2db724ccaf9 --- /dev/null +++ b/linux_os/guide/system/accounts/accounts-restrictions/password_expiration/accounts_minimum_age_login_defs/tests/bad_value.fail.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +grep -q "^PASS_MIN_DAYS" /etc/login.defs && \ + sed -i "s/PASS_MIN_DAYS.*/PASS_MIN_DAYS\t0/g" /etc/login.defs +if ! [ $? -eq 0 ]; then + echo -e "PASS_MIN_DAYS\t0" >> /etc/login.defs +fi diff --git a/linux_os/guide/system/accounts/accounts-restrictions/password_expiration/accounts_minimum_age_login_defs/tests/commented.fail.sh b/linux_os/guide/system/accounts/accounts-restrictions/password_expiration/accounts_minimum_age_login_defs/tests/commented.fail.sh new file mode 100644 index 00000000000..e440cd59c8f --- /dev/null +++ b/linux_os/guide/system/accounts/accounts-restrictions/password_expiration/accounts_minimum_age_login_defs/tests/commented.fail.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +grep -q "^PASS_MIN_DAYS" /etc/login.defs && \ + sed -i "s/PASS_MIN_DAYS.*/# PASS_MIN_DAYS\t1/g" /etc/login.defs +if ! [ $? -eq 0 ]; then + echo -e "# PASS_MIN_DAYS\t1" >> /etc/login.defs +fi diff --git a/linux_os/guide/system/accounts/accounts-restrictions/password_expiration/accounts_minimum_age_login_defs/tests/correct.pass.sh b/linux_os/guide/system/accounts/accounts-restrictions/password_expiration/accounts_minimum_age_login_defs/tests/correct.pass.sh new file mode 100644 index 00000000000..4bb84027689 --- /dev/null +++ b/linux_os/guide/system/accounts/accounts-restrictions/password_expiration/accounts_minimum_age_login_defs/tests/correct.pass.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +grep -q "^PASS_MIN_DAYS" /etc/login.defs && \ + sed -i "s/PASS_MIN_DAYS.*/PASS_MIN_DAYS\t7/g" /etc/login.defs +if ! [ $? -eq 0 ]; then + echo -e "PASS_MIN_DAYS\t7" >> /etc/login.defs +fi diff --git a/linux_os/guide/system/accounts/accounts-restrictions/password_expiration/accounts_minimum_age_login_defs/tests/disabled.fail.sh b/linux_os/guide/system/accounts/accounts-restrictions/password_expiration/accounts_minimum_age_login_defs/tests/disabled.fail.sh new file mode 100644 index 00000000000..ba48b5ef204 --- /dev/null +++ b/linux_os/guide/system/accounts/accounts-restrictions/password_expiration/accounts_minimum_age_login_defs/tests/disabled.fail.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +grep -q "^PASS_MIN_DAYS" /etc/login.defs && \ + sed -i "s/PASS_MIN_DAYS.*/PASS_MIN_DAYS\t-1/g" /etc/login.defs +if ! [ $? -eq 0 ]; then + echo -e "PASS_MIN_DAYS\t-1" >> /etc/login.defs +fi diff --git a/linux_os/guide/system/accounts/accounts-restrictions/password_expiration/accounts_minimum_age_login_defs/tests/line_missing.fail.sh b/linux_os/guide/system/accounts/accounts-restrictions/password_expiration/accounts_minimum_age_login_defs/tests/line_missing.fail.sh new file mode 100644 index 00000000000..cf35876bb81 --- /dev/null +++ b/linux_os/guide/system/accounts/accounts-restrictions/password_expiration/accounts_minimum_age_login_defs/tests/line_missing.fail.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +sed -i "/PASS_MIN_DAYS.*/d" /etc/login.defs