mirror of https://github.com/CISOfy/lynis.git
Changes to check for presence BusyBox, to better support platforms using this as primary shell
This commit is contained in:
parent
776a70d6cf
commit
9d1cec8a9b
|
@ -130,6 +130,7 @@ unset LANG
|
||||||
SCAN_TEST_HEAVY=""; SCAN_TEST_MEDIUM=""; SCAN_TEST_LOW=""
|
SCAN_TEST_HEAVY=""; SCAN_TEST_MEDIUM=""; SCAN_TEST_LOW=""
|
||||||
SESTATUSBINARY=""
|
SESTATUSBINARY=""
|
||||||
SERVICE_MANAGER=""
|
SERVICE_MANAGER=""
|
||||||
|
SHELL_IS_BUSYBOX=0
|
||||||
SHOW_PROGRAM_DETAILS=1
|
SHOW_PROGRAM_DETAILS=1
|
||||||
SHOW_REPORT=1
|
SHOW_REPORT=1
|
||||||
SKIPPED_TESTS_ROOTONLY=""
|
SKIPPED_TESTS_ROOTONLY=""
|
||||||
|
|
|
@ -625,7 +625,9 @@
|
||||||
IsRunning()
|
IsRunning()
|
||||||
{
|
{
|
||||||
RUNNING=0
|
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
|
if [ ! "${FIND}" = "" ]; then
|
||||||
RUNNING=1
|
RUNNING=1
|
||||||
logtext "IsRunning: process '$1' found (${FIND})"
|
logtext "IsRunning: process '$1' found (${FIND})"
|
||||||
|
|
|
@ -373,6 +373,16 @@
|
||||||
*) ECHOCMD="echo -e" ;;
|
*) ECHOCMD="echo -e" ;;
|
||||||
esac
|
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
|
# Lynis - Copyright 2007-2015 Michael Boelen, CISOfy - https://cisofy.com
|
||||||
|
|
14
lynis
14
lynis
|
@ -283,6 +283,7 @@
|
||||||
echo "Search paths used --> ${tPROFILE_TARGETS}"
|
echo "Search paths used --> ${tPROFILE_TARGETS}"
|
||||||
ExitCustom 66
|
ExitCustom 66
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Initialize and check profile file, auditor name, log file and report file
|
# 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 [ ! -r ${PROFILE} ]; then echo "Fatal error: Can't open profile file (${PROFILE})"; exit 1; fi
|
||||||
if [ "${AUDITORNAME}" = "" ]; then AUDITORNAME="[Unknown]"; 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 " ${YELLOW}Note: ${WHITE}Cancelling the program can leave temporary files behind${NORMAL}"
|
||||||
echo ""
|
echo ""
|
||||||
wait_for_keypress
|
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 "${MYHOMEDIR}/lynis.pid" ]; then rm -f "${MYHOMEDIR}/lynis.pid"; fi
|
||||||
if [ -f "./lynis.pid" ]; then rm -f "./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
|
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
|
# 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
|
if [ ${PARAMCOUNT} -eq 0 -o ${WRONGOPTION} -eq 1 -o ${VIEWHELP} -eq 1 ]; then
|
||||||
#echo " =================================================="
|
|
||||||
echo ""
|
echo ""
|
||||||
echo " Usage: lynis ${WHITE}[options] ${CYAN}mode${NORMAL}"
|
echo " Usage: lynis ${WHITE}[options] ${CYAN}mode${NORMAL}"
|
||||||
echo ""
|
echo ""
|
||||||
|
@ -529,15 +529,19 @@
|
||||||
logtext "Kernel version (full): ${OS_KERNELVERSION_FULL}"
|
logtext "Kernel version (full): ${OS_KERNELVERSION_FULL}"
|
||||||
fi
|
fi
|
||||||
logtext "Hardware platform: ${HARDWARE}"
|
logtext "Hardware platform: ${HARDWARE}"
|
||||||
|
logtext "-----------------------------------------------------"
|
||||||
logtext "Hostname: ${HOSTNAME}"
|
logtext "Hostname: ${HOSTNAME}"
|
||||||
logtext "Auditor: ${AUDITORNAME}"
|
logtext "Auditor: ${AUDITORNAME}"
|
||||||
logtext "Profile: ${PROFILE}"
|
logtext "Profile: ${PROFILE}"
|
||||||
|
logtext "Include directory: ${INCLUDEDIR}"
|
||||||
|
logtext "Plugin directory: ${PLUGINDIR}"
|
||||||
|
logtext "-----------------------------------------------------"
|
||||||
logtext "Log file: ${LOGFILE}"
|
logtext "Log file: ${LOGFILE}"
|
||||||
logtext "Report file: ${REPORTFILE}"
|
logtext "Report file: ${REPORTFILE}"
|
||||||
logtext "Report version: ${REPORT_version}"
|
logtext "Report version: ${REPORT_version}"
|
||||||
logtext "-----------------------------------------------------"
|
logtext "-----------------------------------------------------"
|
||||||
logtext "Include directory: ${INCLUDEDIR}"
|
logtext "BusyBox used: ${SHELL_IS_BUSYBOX}"
|
||||||
logtext "Plugin directory: ${PLUGINDIR}"
|
|
||||||
logtextbreak
|
logtextbreak
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in New Issue