diff --git a/linux_os/guide/system/accounts/accounts-restrictions/root_logins/no_invalid_shell_accounts_unlocked/oval/shared.xml b/linux_os/guide/system/accounts/accounts-restrictions/root_logins/no_invalid_shell_accounts_unlocked/oval/shared.xml new file mode 100644 index 00000000000..654a4c6ffbc --- /dev/null +++ b/linux_os/guide/system/accounts/accounts-restrictions/root_logins/no_invalid_shell_accounts_unlocked/oval/shared.xml @@ -0,0 +1,80 @@ + + + {{{ oval_metadata("Ensure Accounts Without Valid Login Shell Are Locked") }}} + + + + + + + + + + + + + + + + + + + + /etc/shells + ^\/[^\n\r]*$ + 1 + filter_{{{ rule_id }}}_not_valid_shell + + + + ^.*\bnologin\b.*$ + + + + + /etc/passwd + + + 1 + + + + + ^(?: + + ):(?:[^:]*:){5}([^:]+)$ + + + + + + /etc/passwd + ^([^:]*):[^:]*:\d+:(?:[^:]*:){3}(?!(\/usr)?(\/sbin\/nologin|\/bin\/false))[^:]*$ + 1 + state_{{{ rule_id }}}_users_ignored + state_{{{ rule_id }}}_locked_accounts + + + {{%- set ignored_users_list="(nobody|nfsnobody|root)" %}} + + ^{{{ ignored_users_list }}}$ + + + + + + + + + + + + + /etc/shadow + ^([^:]*):(?:[ \t\n\r\:\;\*\!\\]*):(?:[^:]*:){6}$ + 1 + + + diff --git a/linux_os/guide/system/accounts/accounts-restrictions/root_logins/no_invalid_shell_accounts_unlocked/tests/asterisks.pass.sh b/linux_os/guide/system/accounts/accounts-restrictions/root_logins/no_invalid_shell_accounts_unlocked/tests/asterisks.pass.sh new file mode 100644 index 00000000000..b8d546a67f4 --- /dev/null +++ b/linux_os/guide/system/accounts/accounts-restrictions/root_logins/no_invalid_shell_accounts_unlocked/tests/asterisks.pass.sh @@ -0,0 +1,4 @@ +#!/bin/bash +# remediation = none + +sed -i 's/^\([^:]*\):x:/\1:\*:/' /etc/passwd diff --git a/linux_os/guide/system/accounts/accounts-restrictions/root_logins/no_invalid_shell_accounts_unlocked/tests/correct.pass.sh b/linux_os/guide/system/accounts/accounts-restrictions/root_logins/no_invalid_shell_accounts_unlocked/tests/correct.pass.sh new file mode 100644 index 00000000000..6e2a92192eb --- /dev/null +++ b/linux_os/guide/system/accounts/accounts-restrictions/root_logins/no_invalid_shell_accounts_unlocked/tests/correct.pass.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# remediation = none + +echo "testuser:*:1001:1001::/home/testuser:/bin/bash" > /etc/passwd +echo "testuser:!:20111:0:99999:7:::" > /etc/shadow +echo "/bin/bash" >> /etc/shells diff --git a/linux_os/guide/system/accounts/accounts-restrictions/root_logins/no_invalid_shell_accounts_unlocked/tests/invalid_shell.fail.sh b/linux_os/guide/system/accounts/accounts-restrictions/root_logins/no_invalid_shell_accounts_unlocked/tests/invalid_shell.fail.sh new file mode 100644 index 00000000000..d2dddcd1d39 --- /dev/null +++ b/linux_os/guide/system/accounts/accounts-restrictions/root_logins/no_invalid_shell_accounts_unlocked/tests/invalid_shell.fail.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# remediation = none + +echo "testuser:x:8000:8000:testuser:/home/testuser:/bin/dash" > /etc/passwd +echo "/bin/bash" > /etc/shells