-
Notifications
You must be signed in to change notification settings - Fork 710
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12584 from jan-cerny/file_permissions_ungroupowned
Improve rule file_permissions_ungroupowned for use in bootable containers
- Loading branch information
Showing
4 changed files
with
110 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...ide/system/permissions/files/file_permissions_ungroupowned/tests/group_in_usr_lib.pass.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
# | ||
UNOWNED_FILES=$(df --local -P | awk {'if (NR!=1) print $6'} | xargs -I '{}' find '{}' -xdev -nogroup) | ||
|
||
IFS=$"\n" | ||
for f in $UNOWNED_FILES; do | ||
rm -f "$f" | ||
done | ||
sed -i 's/group:\s\+\(.*\)/group: altfiles \1/' /etc/nsswitch.conf | ||
|
||
touch /root/test | ||
chown 9999:9999 /root/test | ||
echo "testgroup:x:9999:" >> /usr/lib/group |
14 changes: 14 additions & 0 deletions
14
...e/system/permissions/files/file_permissions_ungroupowned/tests/unowned_in_sysroot.pass.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
# | ||
# remediation = none | ||
|
||
UNOWNED_FILES=$(df --local -P | awk {'if (NR!=1) print $6'} | xargs -I '{}' find '{}' -xdev -nogroup) | ||
|
||
IFS=$"\n" | ||
for f in $UNOWNED_FILES; do | ||
rm -f "$f" | ||
done | ||
|
||
mkdir /sysroot | ||
touch /sysroot/test | ||
chown 9999:9999 /sysroot/test |