diff --git a/components/pam.yml b/components/pam.yml index 577d57e6682..3dfd260c377 100644 --- a/components/pam.yml +++ b/components/pam.yml @@ -137,6 +137,7 @@ rules: - enable_authselect - enable_pam_namespace - ensure_pam_wheel_group_empty +- ensure_root_access_controlled - ensure_root_password_configured - ensure_shadow_group_empty - ensure_sudo_group_restricted diff --git a/controls/cis_ubuntu2404.yml b/controls/cis_ubuntu2404.yml index 74a2cee01e6..a70ab008385 100644 --- a/controls/cis_ubuntu2404.yml +++ b/controls/cis_ubuntu2404.yml @@ -2140,8 +2140,10 @@ controls: levels: - l1_server - l1_workstation - status: planned - notes: TODO. Rule does not seem to be implemented, nor does it map to any rules in ubuntu2204 profile. + rules: + - ensure_root_access_controlled + status: automated + notes: This rule doesn't come with a remediation, as the exact requirement allows root to either have a password or be locked. - id: 5.4.2.5 title: Ensure root path integrity (Automated) diff --git a/linux_os/guide/system/accounts/accounts-restrictions/root_logins/ensure_root_access_controlled/oval/shared.xml b/linux_os/guide/system/accounts/accounts-restrictions/root_logins/ensure_root_access_controlled/oval/shared.xml new file mode 100644 index 00000000000..cfae0e503db --- /dev/null +++ b/linux_os/guide/system/accounts/accounts-restrictions/root_logins/ensure_root_access_controlled/oval/shared.xml @@ -0,0 +1,19 @@ + + + {{{ oval_metadata("Ensure root account access is controlled") }}} + + + + + + + + + /etc/shadow + ^root:(\$(y|[0-9].+)\$|!.*|\*.*).*$ + 1 + + diff --git a/linux_os/guide/system/accounts/accounts-restrictions/root_logins/ensure_root_access_controlled/rule.yml b/linux_os/guide/system/accounts/accounts-restrictions/root_logins/ensure_root_access_controlled/rule.yml new file mode 100644 index 00000000000..29806238aef --- /dev/null +++ b/linux_os/guide/system/accounts/accounts-restrictions/root_logins/ensure_root_access_controlled/rule.yml @@ -0,0 +1,34 @@ +documentation_complete: true + + +title: 'Ensure root account access is controlled' + +description: |- + There are a number of methods to access the root account directly. + Without a password set any user would be able to gain access and + thus control over the entire system. + +rationale: |- + Access to root should be secured at all times. + +severity: medium + +platform: system_with_kernel + +ocil_clause: 'root password is not set or is not locked' + +ocil: |- + Run the following command to verify that either the root user's + password is set or the root user's account is locked: +
# passwd -S root | awk '$2 ~ /^(P|L)/ {print "User: \"" $1 "\" Password is status: " $2}'
+ Verify the output is either: + User: "root" Password is status: P + - OR - + User: "root" Password is status: L + Note: + - P - Password is set + - L - Password is locked + + +warnings: + - general: This rule doesn't come with a remediation, as the exact requirement allows root to either have a password or be locked. \ No newline at end of file diff --git a/linux_os/guide/system/accounts/accounts-restrictions/root_logins/ensure_root_access_controlled/tests/correct.pass.sh b/linux_os/guide/system/accounts/accounts-restrictions/root_logins/ensure_root_access_controlled/tests/correct.pass.sh new file mode 100644 index 00000000000..01cd47b059e --- /dev/null +++ b/linux_os/guide/system/accounts/accounts-restrictions/root_logins/ensure_root_access_controlled/tests/correct.pass.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# packages = passwd +# platform = multi_platform_all + +sed -i "s/^root:[^:]*/root:\$y\$AAAAAAAAAA/" /etc/shadow diff --git a/linux_os/guide/system/accounts/accounts-restrictions/root_logins/ensure_root_access_controlled/tests/empty.fail.sh b/linux_os/guide/system/accounts/accounts-restrictions/root_logins/ensure_root_access_controlled/tests/empty.fail.sh new file mode 100644 index 00000000000..e341109e1b6 --- /dev/null +++ b/linux_os/guide/system/accounts/accounts-restrictions/root_logins/ensure_root_access_controlled/tests/empty.fail.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# packages = passwd +# platform = multi_platform_all +# remediation = None + +passwd -d root diff --git a/linux_os/guide/system/accounts/accounts-restrictions/root_logins/ensure_root_access_controlled/tests/locked.pass.sh b/linux_os/guide/system/accounts/accounts-restrictions/root_logins/ensure_root_access_controlled/tests/locked.pass.sh new file mode 100644 index 00000000000..e79e6768eb3 --- /dev/null +++ b/linux_os/guide/system/accounts/accounts-restrictions/root_logins/ensure_root_access_controlled/tests/locked.pass.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# packages = passwd +# platform = multi_platform_all +# remediation = None + +passwd -l root