From 30bc903c5a6151ef6c96cf9f4894f4d25ed4d73a Mon Sep 17 00:00:00 2001 From: mboelen Date: Wed, 25 Mar 2015 17:30:13 +0100 Subject: Using return codes for file permission checks --- include/tests_boot_services | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/include/tests_boot_services b/include/tests_boot_services index 4eb216d8..35fee381 100644 --- a/include/tests_boot_services +++ b/include/tests_boot_services @@ -5,7 +5,7 @@ # Lynis # ------------------ # -# Copyright 2007-2015, CISOfy & Michael Boelen, The Netherlands +# Copyright 2007-2015, Michael Boelen, CISOfy (michael.boelen@cisofy.com) # Web site: https://cisofy.com # # Lynis comes with ABSOLUTELY NO WARRANTY. This is free software, and you are @@ -548,7 +548,7 @@ for J in ${FIND}; do logtext "Test: checking permissions of file ${J}" IsWorldWritable ${J} - if [ "${FileIsWorldWritable}" = "TRUE" ]; then + if [ $? -eq 1 ]; then logtext "Result: warning, file ${J} is world writable" FOUND=1 else @@ -570,7 +570,7 @@ FIND=`find /etc/rc${NO}.d -type f -print` for I in ${FIND}; do IsWorldWritable ${I} - if [ "${FileIsWorldWritable}" = "TRUE" ]; then + if [ $? -eq 1 ]; then logtext "Result: warning, file ${I} is world writable" FOUND=1 else @@ -586,7 +586,7 @@ if [ -f ${I} ]; then logtext "Test: Checking ${I} file for writable bit" IsWorldWritable ${I} - if [ "${FileIsWorldWritable}" = "TRUE" ]; then + if [ $? -eq 1 ]; then ReportWarning ${TEST_NO} "H" "Found writable startup script ${I}" FOUND=1 logtext "Result: warning, file ${I} is world writable" @@ -599,8 +599,7 @@ # Check results if [ ${FOUND} -eq 1 ]; then Display --indent 2 --text "- Check startup files (permissions)" --result "WARNING" --color RED - ReportWarning ${TEST_NO} "H" "One or more startup files can be overwritten by all users" - ReportSuggestion ${TEST_NO} "Check startup scripts for world write access and change permissions if needed" + ReportWarning ${TEST_NO} "H" "Found world writable startup scripts" logtext "Result: found one or more scripts which are possibly writable by other users" AddHP 0 3 else @@ -730,4 +729,4 @@ wait_for_keypress # #================================================================================ -# Lynis - Copyright 2007-2015, Michael Boelen - www.rootkit.nl - The Netherlands +# Lynis - Copyright 2007-2015, Michael Boelen, CISOfy - https://cisofy.com -- cgit v1.2.3