Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CISOfy/lynis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormboelen <michael@cisofy.com>2014-09-04 17:32:59 +0400
committermboelen <michael@cisofy.com>2014-09-04 17:32:59 +0400
commite0be20e6999ba680667b8f1792d0860551893b9d (patch)
treed3f893cf81dfe3deb04d157c0e9d4b1f46c63e9b /include
parent1c9898be50e1c45b5b6de12a8159bcc2c9f8f776 (diff)
Let SafePerms function also check for UID
Diffstat (limited to 'include')
-rw-r--r--include/functions10
1 files changed, 6 insertions, 4 deletions
diff --git a/include/functions b/include/functions
index 344240ef..6c146a70 100644
--- a/include/functions
+++ b/include/functions
@@ -875,14 +875,16 @@
PERMS=`ls -l $1`
# Owner permissions
OWNER=`echo ${PERMS} | awk -F" " '{ print $3 }'`
- if [ ! "${OWNER}" = "root" ]; then
- echo "Fatal error: file $1 should be owned by user 'root' (found: ${OWNER})"
+ OWNERID=`ls -n $1 | awk -F" " '{ print $3 }'`
+ if [ ! "${OWNER}" = "root" -a ! "${OWNERID}" = "0" ]; then
+ echo "Fatal error: file $1 should be owned by user 'root' or similar (found: ${OWNER})."
ExitFatal
fi
# Group permissions
GROUP=`echo ${PERMS} | awk -F" " '{ print $4 }'`
- if [ ! "${GROUP}" = "root" -a ! "${GROUP}" = "wheel" ]; then
- echo "Fatal error: group owner of directory $1 should be owned by root user, or related group"
+ GROUPID=`ls -n $1 | awk -F" " '{ print $4 }'`
+ if [ ! "${GROUP}" = "root" -a ! "${GROUP}" = "wheel" -a ! "${GROUPID}" = "0" ]; then
+ echo "Fatal error: group owner of directory $1 should be owned by root user, wheel or similar (found: ${GROUP})."
ExitFatal
fi
# Other permissions