diff --git a/include/consts b/include/consts index ca3144d7..528d9d1d 100644 --- a/include/consts +++ b/include/consts @@ -130,6 +130,7 @@ unset LANG SCAN_TEST_HEAVY=""; SCAN_TEST_MEDIUM=""; SCAN_TEST_LOW="" SESTATUSBINARY="" SERVICE_MANAGER="" + SHELL_IS_BUSYBOX=0 SHOW_PROGRAM_DETAILS=1 SHOW_REPORT=1 SKIPPED_TESTS_ROOTONLY="" diff --git a/include/functions b/include/functions index aea0109f..c4c134f1 100644 --- a/include/functions +++ b/include/functions @@ -625,7 +625,9 @@ IsRunning() { RUNNING=0 - FIND=`${PSBINARY} ax | egrep "( |/)$1" | grep -v "grep"` + PSOPTIONS="" + if [ ${SHELL_IS_BUSYBOX} -eq 0 ]; then PSOPTIONS=" ax"; fi + FIND=`${PSBINARY} ${PSOPTIONS} | egrep "( |/)$1" | grep -v "grep"` if [ ! "${FIND}" = "" ]; then RUNNING=1 logtext "IsRunning: process '$1' found (${FIND})" diff --git a/include/osdetection b/include/osdetection index 3aa6af34..7f251e80 100644 --- a/include/osdetection +++ b/include/osdetection @@ -373,6 +373,16 @@ *) ECHOCMD="echo -e" ;; esac + # Check if we have full featured commands, or are using BusyBox as a shell + if [ -x /bin/busybox ]; then + if [ -L /bin/ps ]; then + ShowSymlinkPath /bin/ps + if [ "${SYMLINK}" = "/bin/busybox" ]; then + SHELL_IS_BUSYBOX=1 + fi + fi + fi + #================================================================================ # Lynis - Copyright 2007-2015 Michael Boelen, CISOfy - https://cisofy.com diff --git a/lynis b/lynis index 8735fe6d..459a6cae 100755 --- a/lynis +++ b/lynis @@ -283,6 +283,7 @@ echo "Search paths used --> ${tPROFILE_TARGETS}" ExitCustom 66 fi + # Initialize and check profile file, auditor name, log file and report file if [ ! -r ${PROFILE} ]; then echo "Fatal error: Can't open profile file (${PROFILE})"; exit 1; fi if [ "${AUDITORNAME}" = "" ]; then AUDITORNAME="[Unknown]"; fi @@ -324,8 +325,8 @@ echo " ${YELLOW}Note: ${WHITE}Cancelling the program can leave temporary files behind${NORMAL}" echo "" wait_for_keypress - # Deleting any stale PID files that might exist. - # Note: Display function does not work yet at this point + + # Deleting any stale PID files that might exist. Note: Display function does not work yet at this point if [ -f "${MYHOMEDIR}/lynis.pid" ]; then rm -f "${MYHOMEDIR}/lynis.pid"; fi if [ -f "./lynis.pid" ]; then rm -f "./lynis.pid"; fi if [ -f "/var/run/lynis.pid" ]; then rm -f "/var/run/lynis.pid"; fi @@ -351,7 +352,6 @@ # # Bail out if we didn't get any parameter, or incorrect ones if [ ${PARAMCOUNT} -eq 0 -o ${WRONGOPTION} -eq 1 -o ${VIEWHELP} -eq 1 ]; then - #echo " ==================================================" echo "" echo " Usage: lynis ${WHITE}[options] ${CYAN}mode${NORMAL}" echo "" @@ -529,15 +529,19 @@ logtext "Kernel version (full): ${OS_KERNELVERSION_FULL}" fi logtext "Hardware platform: ${HARDWARE}" + logtext "-----------------------------------------------------" logtext "Hostname: ${HOSTNAME}" logtext "Auditor: ${AUDITORNAME}" logtext "Profile: ${PROFILE}" + logtext "Include directory: ${INCLUDEDIR}" + logtext "Plugin directory: ${PLUGINDIR}" + logtext "-----------------------------------------------------" logtext "Log file: ${LOGFILE}" logtext "Report file: ${REPORTFILE}" logtext "Report version: ${REPORT_version}" logtext "-----------------------------------------------------" - logtext "Include directory: ${INCLUDEDIR}" - logtext "Plugin directory: ${PLUGINDIR}" + logtext "BusyBox used: ${SHELL_IS_BUSYBOX}" + logtextbreak #