Skip to content

Commit

Permalink
Merge pull request #10416 from marcusburghardt/cis_ensure_shadow_grou…
Browse files Browse the repository at this point in the history
…p_empty

Enable ensure_shadow_group_empty for RHEL7
  • Loading branch information
Mab879 authored Apr 4, 2023
2 parents 1f0d5ca + 38246a1 commit 91005db
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 11 deletions.
4 changes: 3 additions & 1 deletion controls/cis_rhel7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2291,7 +2291,9 @@ controls:
levels:
- l1_server
- l1_workstation
automated: no # rule missing
status: automated
rules:
- ensure_shadow_group_empty

- id: 6.2.5
title: Ensure no duplicate user names exist (Automated)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# platform = multi_platform_sle,multi_platform_ubuntu
# platform = multi_platform_all

sed -ri 's/(^shadow:[^:]*:[^:]*:)([^:]+$)/\1/' /etc/group
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
documentation_complete: true

prodtype: sle12,sle15,ubuntu2004,ubuntu2204
prodtype: rhel7,sle12,sle15,ubuntu2004,ubuntu2204

title: 'Ensure shadow group is empty'
title: 'Ensure shadow Group is Empty'

description: |-
The shadow group allows system programs which require access the ability
Expand All @@ -19,10 +19,12 @@ rationale: |-
severity: medium

identifiers:
cce@rhel7: CCE-86818-2
cce@sle12: CCE-92213-8
cce@sle15: CCE-91344-2

references:
cis@rhel7: 6.2.4
cis@sle12: 6.2.18
cis@sle15: 6.2.18
cis@ubuntu2004: 6.2.17
Expand All @@ -34,8 +36,13 @@ ocil_clause: 'shadow group is not empty'

ocil: |-
Run the following commands and verify no results are returned:
<per>
<pre>
grep ^shadow:[^:]*:[^:]*:[^:]+ /etc/group
awk -F: '($4 == "<shadow-gid>") { print }' /etc/passwd
</per>
</pre>
warnings:
- general: |-
This rule remediation will ensure the group membership is empty in /etc/group. To avoid any
disruption the remediation won't change the primary group of users in /etc/passwd if any
user has the shadow GID as primary group.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# platform = multi_platform_sle,multi_platform_ubuntu
# platform = multi_platform_all

if ! grep -q "^shadow" /etc/group; then
groupadd shadow
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
# platform = multi_platform_sle,multi_platform_ubuntu
# platform = multi_platform_all

sed -i '/^shadow:[^:]*:[^:]*:.*/d' /etc/group
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# platform = multi_platform_sle,multi_platform_ubuntu
# platform = multi_platform_all

if ! grep -q "^shadow" /etc/group; then
groupadd shadow
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# platform = multi_platform_sle,multi_platform_ubuntu
# platform = multi_platform_all
# remediation = none

if ! grep -q "^shadow" /etc/group; then
Expand Down
1 change: 0 additions & 1 deletion shared/references/cce-redhat-avail.txt
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,6 @@ CCE-86811-7
CCE-86812-5
CCE-86816-6
CCE-86817-4
CCE-86818-2
CCE-86820-8
CCE-86821-6
CCE-86822-4
Expand Down

0 comments on commit 91005db

Please sign in to comment.