diff --git a/components/pam.yml b/components/pam.yml
index 577d57e6682..d4d3f1e9714 100644
--- a/components/pam.yml
+++ b/components/pam.yml
@@ -162,6 +162,7 @@ rules:
- gid_passwd_group_same
- group_unique_id
- group_unique_name
+- groups_no_zero_gid_except_root
- grub2_disable_interactive_boot
- gui_login_dod_acknowledgement
- install_smartcard_packages
diff --git a/controls/cis_ubuntu2404.yml b/controls/cis_ubuntu2404.yml
index c72af22cb84..69081859462 100644
--- a/controls/cis_ubuntu2404.yml
+++ b/controls/cis_ubuntu2404.yml
@@ -2136,8 +2136,12 @@ 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:
+ - groups_no_zero_gid_except_root
+ status: automated
+ notes: |
+ The remediation is not automated as the removal or modification
+ of group IDs from a system is too disruptive.
- id: 5.4.2.4
title: Ensure root account access is controlled (Automated)
diff --git a/linux_os/guide/system/accounts/accounts-restrictions/root_logins/groups_no_zero_gid_except_root/oval/shared.xml b/linux_os/guide/system/accounts/accounts-restrictions/root_logins/groups_no_zero_gid_except_root/oval/shared.xml
new file mode 100644
index 00000000000..6c1ae253606
--- /dev/null
+++ b/linux_os/guide/system/accounts/accounts-restrictions/root_logins/groups_no_zero_gid_except_root/oval/shared.xml
@@ -0,0 +1,20 @@
+
$ awk -F: '$3 == 0 {print $1}' /etc/group+
root+ +fixtext: |- + Change the GID of any group on the system, other than root, that has a GID of "0". + +warnings: + - general: |- + This rule doesn't come with a remediation. The removal of groups from a system + or reassigning the GID is considered too disruptive. diff --git a/linux_os/guide/system/accounts/accounts-restrictions/root_logins/groups_no_zero_gid_except_root/tests/only_root.pass.sh b/linux_os/guide/system/accounts/accounts-restrictions/root_logins/groups_no_zero_gid_except_root/tests/only_root.pass.sh new file mode 100644 index 00000000000..2adf4bdb5cf --- /dev/null +++ b/linux_os/guide/system/accounts/accounts-restrictions/root_logins/groups_no_zero_gid_except_root/tests/only_root.pass.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# remediation = none + +# Delete all groups with gid 0 except root. +awk -F: '$3 == 0 && $1 != "root" { print $1 }' /etc/group | xargs -I '{}' groupdel -f '{}' diff --git a/linux_os/guide/system/accounts/accounts-restrictions/root_logins/groups_no_zero_gid_except_root/tests/other_user_uid_0.fail.sh b/linux_os/guide/system/accounts/accounts-restrictions/root_logins/groups_no_zero_gid_except_root/tests/other_user_uid_0.fail.sh new file mode 100644 index 00000000000..5798ae85b88 --- /dev/null +++ b/linux_os/guide/system/accounts/accounts-restrictions/root_logins/groups_no_zero_gid_except_root/tests/other_user_uid_0.fail.sh @@ -0,0 +1,4 @@ +#!/bin/bash +# remediation = none + +groupadd --non-unique --gid 0 root2