Improved umask detection and logging

This commit is contained in:
mboelen 2015-08-20 18:46:06 +02:00
parent 649f0cfb3c
commit 210ba41a3c
1 changed files with 6 additions and 4 deletions

View File

@ -813,7 +813,9 @@
#FIND2=`egrep "^([[:space:]])([[:tab:]])*umask" /etc/profile | awk '{ print $2 }' | wc -l` #FIND2=`egrep "^([[:space:]])([[:tab:]])*umask" /etc/profile | awk '{ print $2 }' | wc -l`
WEAK_UMASK=0 WEAK_UMASK=0
FOUND_UMASK=0 FOUND_UMASK=0
if [ "${FIND2}" = "1" ]; then if [ "${FIND2}" = "0" ]; then
logtext "Result: did not find umask in /etc/profile"
elif [ "${FIND2}" = "1" ]; then
logtext "Result: found umask (prefixed with spaces)" logtext "Result: found umask (prefixed with spaces)"
FOUND_UMASK=1 FOUND_UMASK=1
if [ ! "${FIND}" = "077" -a ! "${FIND}" = "027" ]; then if [ ! "${FIND}" = "077" -a ! "${FIND}" = "027" ]; then
@ -824,7 +826,7 @@
fi fi
# Found more than 1 umask value in profile # Found more than 1 umask value in profile
else else
logtext "Result: found several umask values configured in /etc/profile" logtext "Result: found multiple umask values configured in /etc/profile"
FOUND_UMASK=1 FOUND_UMASK=1
for I in ${FIND}; do for I in ${FIND}; do
if [ ! "${I}" = "077" -a ! "${I}" = "027" ]; then if [ ! "${I}" = "077" -a ! "${I}" = "027" ]; then
@ -861,7 +863,7 @@
logtext "Test: Checking umask entries in /etc/passwd (pam_umask)" logtext "Test: Checking umask entries in /etc/passwd (pam_umask)"
if [ -f /etc/passwd ]; then if [ -f /etc/passwd ]; then
logtext "Result: file /etc/passwd exists" logtext "Result: file /etc/passwd exists"
logtext "Test: Checking umask value in /etc/profile" logtext "Test: Checking umask value in /etc/passwd"
FIND=`grep "umask=" /etc/passwd` FIND=`grep "umask=" /etc/passwd`
if [ "${FIND}" = "" ]; then if [ "${FIND}" = "" ]; then
ReportManual "AUTH-9328:03" ReportManual "AUTH-9328:03"
@ -873,7 +875,7 @@
# /etc/login.defs # /etc/login.defs
logtext "Test: Checking /etc/login.defs" logtext "Test: Checking /etc/login.defs"
if [ -f /etc/login.defs ]; then if [ -f /etc/login.defs ]; then
logtext "Result: file /etc/profile exists" logtext "Result: file /etc/login.defs exists"
logtext "Test: Checking umask value in /etc/login.defs" logtext "Test: Checking umask value in /etc/login.defs"
FIND=`grep "^UMASK" /etc/login.defs | awk '{ print $2 }'` FIND=`grep "^UMASK" /etc/login.defs | awk '{ print $2 }'`
if [ "${FIND}" = "" ]; then if [ "${FIND}" = "" ]; then