Skip to content

Commit

Permalink
Add new test scenarios
Browse files Browse the repository at this point in the history
Add new Automatus test scenarios for rule file_permissions_ungroupowned
that cover recent changes - exclusion of /sysroot and addition
of /usr/lib/group as second source of group data.
  • Loading branch information
jan-cerny committed Nov 7, 2024
1 parent 3eca0f2 commit fb9b869
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/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

touch /root/test
chown 9999:9999 /root/test
echo "testgroup:x:9999:" >> /usr/lib/group
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

0 comments on commit fb9b869

Please sign in to comment.