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
path: root/lynis
diff options
context:
space:
mode:
authormboelen <michael@cisofy.com>2014-09-04 17:35:10 +0400
committermboelen <michael@cisofy.com>2014-09-04 17:35:10 +0400
commitd43cdae34f4887a5d07160e86e76fa14f1939670 (patch)
tree4b2f40fb3e1e6342e157d496fb97451978c13988 /lynis
parente0be20e6999ba680667b8f1792d0860551893b9d (diff)
Extended permissions check for functions and consts file
Diffstat (limited to 'lynis')
-rwxr-xr-xlynis19
1 files changed, 12 insertions, 7 deletions
diff --git a/lynis b/lynis
index 0384080d..2a797ff3 100755
--- a/lynis
+++ b/lynis
@@ -91,22 +91,27 @@
PERMS2=`ls -l ${INCLUDEDIR}/functions | cut -c 2-10`
OWNER=`ls -l ${INCLUDEDIR}/consts | awk -F" " '{ print $3 }'`
OWNER2=`ls -l ${INCLUDEDIR}/functions | awk -F" " '{ print $3 }'`
+ OWNERID=`ls -n ${INCLUDEDIR}/consts | awk -F" " '{ print $3 }'`
+ OWNER2ID=`ls -n ${INCLUDEDIR}/functions | awk -F" " '{ print $3 }'`
+
ISSUE=0
# Check permissions of include/consts file
if [ ! "${PERMS}" = "r--------" -a ! "${PERMS}" = "rw-------" ]; then
- ISSUE=1
- echo "[!] Change file permissions of ${INCLUDEDIR}/consts to 600"
+ ISSUE=1; echo "[!] Change file permissions of ${INCLUDEDIR}/consts to 600."
fi
# Check permissions of include/functions file
if [ ! "${PERMS2}" = "r--------" -a ! "${PERMS2}" = "rw-------" ]; then
- ISSUE=1
- echo "[!] Change file permissions of ${INCLUDEDIR}/functions to 600"
+ ISSUE=1; echo "[!] Change file permissions of ${INCLUDEDIR}/functions to 600."
+ fi
+ # Check if owner of both files is root user
+ if [ ! "${OWNER}" = "root" -a ! "${OWNERID}" = "0" ]; then
+ ISSUE=1; echo "[!] Change ownership of ${INCLUDEDIR}/consts to 'root' or similar (found: ${OWNER} with UID ${OWNERID})."
fi
# Check if owner of both files is root user
- if [ ! "${OWNER}" = "root" -o ! "${OWNER2}" = "root" ]; then
- ISSUE=1
- echo "[!] Change ownership of ${INCLUDEDIR}/consts and ${INCLUDEDIR}/functions to 'root'"
+ if [ ! "${OWNER2}" = "root" -a ! "${OWNER2ID}" = "0" ]; then
+ ISSUE=1; echo "[!] Change ownership of ${INCLUDEDIR}/functions to 'root' or similar (found: ${OWNER2} with UID ${OWNER2ID})."
fi
+
if [ ${ISSUE} -eq 0 ]; then
. ${INCLUDEDIR}/consts
. ${INCLUDEDIR}/functions