From d16b38eff83a8dca405e21e1c34205289f3d0832 Mon Sep 17 00:00:00 2001 From: mboelen Date: Mon, 21 Dec 2015 21:17:15 +0100 Subject: Rename of logtext and report functions, upcoming year change --- include/tests_scheduling | 100 +++++++++++++++++++++++------------------------ 1 file changed, 50 insertions(+), 50 deletions(-) (limited to 'include/tests_scheduling') diff --git a/include/tests_scheduling b/include/tests_scheduling index 1b5e23f0..83067dd2 100644 --- a/include/tests_scheduling +++ b/include/tests_scheduling @@ -5,7 +5,7 @@ # Lynis # ------------------ # -# Copyright 2007-2015, Michael Boelen, CISOfy (michael.boelen@cisofy.com) +# Copyright 2007-2016, 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 @@ -38,59 +38,59 @@ if [ -f /etc/crontab ]; then FindCronJob /etc/crontab for I in ${sCRONJOBS}; do - logtext "Found cronjob (/etc/crontab): ${I}" - report "cronjob[]=${I}" + LogText "Found cronjob (/etc/crontab): ${I}" + Report "cronjob[]=${I}" done fi CRON_DIRS="/etc/cron.d" for I in ${CRON_DIRS}; do - logtext "Test: checking directory ${I}" + LogText "Test: checking directory ${I}" if [ -d ${I} ]; then FileIsReadable ${I} if [ ${CANREAD} -eq 1 ]; then - logtext "Result: found directory ${I}" - logtext "Test: searching files in ${I}" + LogText "Result: found directory ${I}" + LogText "Test: searching files in ${I}" FIND=`find ${I} -type f -print` if [ "${FIND}" = "" ]; then - logtext "Result: no files found in ${I}" + LogText "Result: no files found in ${I}" else - logtext "Result: found one or more files in ${I}. Analyzing files.." + LogText "Result: found one or more files in ${I}. Analyzing files.." for J in ${FIND}; do FindCronJob ${J} for K in ${sCRONJOBS}; do - logtext "Result: Found cronjob (${I}): ${K}" + LogText "Result: Found cronjob (${I}): ${K}" done done - logtext "Result: done with analyzing files in ${I}" + LogText "Result: done with analyzing files in ${I}" fi else - logtext "Result: can not read file or directory ${I}" + LogText "Result: can not read file or directory ${I}" fi else - logtext "Result: directory ${I} does not exist" + LogText "Result: directory ${I} does not exist" fi done CRON_DIRS="/etc/cron.hourly /etc/cron.daily /etc/cron.weekly /etc/cron.monthly" for I in ${CRON_DIRS}; do - logtext "Test: checking directory ${I}" + LogText "Test: checking directory ${I}" if [ -d ${I} ]; then - logtext "Result: found directory ${I}" - logtext "Test: searching files in ${I}" + LogText "Result: found directory ${I}" + LogText "Test: searching files in ${I}" FIND=`find ${I} -type f -print | grep -v ".placeholder"` if [ "${FIND}" = "" ]; then - logtext "Result: no files found in ${I}" + LogText "Result: no files found in ${I}" else - logtext "Result: found one or more files in ${I}. Analyzing files.." + LogText "Result: found one or more files in ${I}. Analyzing files.." for J in ${FIND}; do - logtext "Result: Found cronjob (${I}): ${J}" - report "cronjob[]=${J}" + LogText "Result: Found cronjob (${I}): ${J}" + Report "cronjob[]=${J}" done - logtext "Result: done with analyzing files in ${I}" + LogText "Result: done with analyzing files in ${I}" fi else - logtext "Result: directory ${I} does not exist" + LogText "Result: directory ${I} does not exist" fi done @@ -101,8 +101,8 @@ for I in ${FIND}; do FindCronJob ${I} for J in ${sCRONJOBS}; do - logtext "Found cronjob (/var/spool/cron/crontabs): ${I} (${J})" - report "cronjob[]=${I}" + LogText "Found cronjob (/var/spool/cron/crontabs): ${I} (${J})" + Report "cronjob[]=${I}" done done else @@ -111,8 +111,8 @@ for I in ${FIND}; do FindCronJob ${I} for J in ${sCRONJOBS}; do - logtext "Found cronjob (/var/spool/cron): ${I} (${J})" - logtext "cronjob[]=${I}" + LogText "Found cronjob (/var/spool/cron): ${I} (${J})" + LogText "cronjob[]=${I}" done done fi @@ -121,11 +121,11 @@ # Anacron if [ "${OS}" = "Linux" ]; then if [ -f /etc/anacrontab ]; then - logtext "Test: checking anacrontab" + LogText "Test: checking anacrontab" sANACRONJOBS=`egrep '^([0-9@])' /etc/anacrontab | tr '\t' ' ' | tr -s ' ' | tr ' ' ','` for J in ${sANACRONJOBS}; do - logtext "Found anacron job (/etc/anacrontab): ${J}" - report "cronjob[]=${J}" + LogText "Found anacron job (/etc/anacrontab): ${J}" + Report "cronjob[]=${J}" done fi fi @@ -139,14 +139,14 @@ # Description : Check atd status Register --test-no SCHD-7718 --weight L --network NO --description "Check at users" if [ ${SKIPTEST} -eq 0 ]; then - logtext "Test: Checking atd status" + LogText "Test: Checking atd status" FIND=`${PSBINARY} ax | grep "/atd" | grep -v "grep"` if [ ! "${FIND}" = "" ]; then - logtext "Result: at daemon active" + LogText "Result: at daemon active" Display --indent 2 --text "- Checking atd status" --result RUNNING --color GREEN ATD_RUNNING=1 else - logtext "Result: at daemon not active" + LogText "Result: at daemon not active" Display --indent 2 --text "- Checking atd status" --result "NOT RUNNING" --color WHITE fi fi @@ -169,46 +169,46 @@ Linux) AT_ALLOW="/etc/at.allow"; AT_DENY="/etc/at.deny" ;; OpenBSD) AT_ALLOW="/var/cron/at.allow"; AT_DENY="/var/cron/at.deny" ;; SunOS) AT_ALLOW="/etc/cron.d/at.allow"; AT_DENY="/etc/cron.d/at.deny" ;; - *) AT_UNKNOWN=1; logtext "Test skipped, files for at unknown" ;; + *) AT_UNKNOWN=1; LogText "Test skipped, files for at unknown" ;; esac if [ ${AT_UNKNOWN} -eq 0 ]; then - logtext "Test: checking for file ${AT_ALLOW}" + LogText "Test: checking for file ${AT_ALLOW}" if [ -f ${AT_ALLOW} ]; then FileIsReadable ${AT_ALLOW} if [ ${CANREAD} -eq 1 ]; then - logtext "Result: file ${AT_ALLOW} exists, only listed users can schedule at jobs" + LogText "Result: file ${AT_ALLOW} exists, only listed users can schedule at jobs" FIND=`cat ${AT_ALLOW} | sort` if [ "${FIND}" = "" ]; then - logtext "Result: File empty, no users are allowed to schedule at jobs" + LogText "Result: File empty, no users are allowed to schedule at jobs" else for I in ${FIND}; do - logtext "Allowed at user: ${I}" + LogText "Allowed at user: ${I}" done fi else - logtext "Result: can not read ${AT_ALLOW} (no permission)" + LogText "Result: can not read ${AT_ALLOW} (no permission)" fi else - logtext "Result: file ${AT_ALLOW} does not exist" - logtext "Test: checking for file ${AT_DENY}" + LogText "Result: file ${AT_ALLOW} does not exist" + LogText "Test: checking for file ${AT_DENY}" if [ -f ${AT_DENY} ]; then FileIsReadable ${AT_DENY} if [ ${CANREAD} -eq 1 ]; then - logtext "Result: file ${AT_DENY} exists, only non listed users can schedule at jobs" + LogText "Result: file ${AT_DENY} exists, only non listed users can schedule at jobs" FIND=`cat ${AT_DENY} | sort` if [ "${FIND}" = "" ]; then - logtext "Result: file is empty, no users are denied access to schedule jobs" + LogText "Result: file is empty, no users are denied access to schedule jobs" else for I in ${FIND}; do - logtext "Denied at user: ${I}" + LogText "Denied at user: ${I}" done fi else - logtext "Result: can not read ${AT_DENY} (no permission)" + LogText "Result: can not read ${AT_DENY} (no permission)" fi else - logtext "Result: both ${AT_ALLOW} and ${AT_DENY} do not exist" - logtext "Note: only root can schedule at jobs" + LogText "Result: both ${AT_ALLOW} and ${AT_DENY} do not exist" + LogText "Note: only root can schedule at jobs" AddHP 1 1 fi fi @@ -225,17 +225,17 @@ if [ ${ATD_RUNNING} -eq 1 ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi Register --test-no SCHD-7724 --preqs-met ${PREQS_MET} --weight L --network NO --description "Check at jobs" if [ ${SKIPTEST} -eq 0 ]; then - logtext "Test: Check scheduled at jobs" + LogText "Test: Check scheduled at jobs" FIND=`atq | grep -v "no files in queue" | ${AWKBINARY} '{gsub("\t"," ");print}' | sed 's/ /!space!/g'` if [ ! "${FIND}" = "" ]; then - logtext "Result: found one or more jobs" + LogText "Result: found one or more jobs" for I in ${FIND}; do I=`echo ${I} | sed 's/!space!/ /g'` - logtext "Found at job: ${I}" + LogText "Found at job: ${I}" done Display --indent 4 --text "- Checking at jobs" --result FOUND --color GREEN else - logtext "Result: no pending at jobs" + LogText "Result: no pending at jobs" Display --indent 4 --text "- Checking at jobs" --result NONE --color GREEN fi fi @@ -247,4 +247,4 @@ wait_for_keypress # #================================================================================ -# Lynis - Copyright 2007-2015, Michael Boelen, CISOfy - https://cisofy.com +# Lynis - Copyright 2007-2016, Michael Boelen, CISOfy - https://cisofy.com -- cgit v1.2.3