mirror of
https://github.com/CISOfy/lynis.git
synced 2025-07-27 15:54:09 +02:00
Additional checks for log and report file
This commit is contained in:
parent
d569e9eb40
commit
8fde6723e2
6
lynis
6
lynis
@ -238,15 +238,21 @@ Make sure to execute ${PROGRAM_NAME} from untarred directory or check your insta
|
|||||||
if [ -z "${LOGFILE}" ]; then
|
if [ -z "${LOGFILE}" ]; then
|
||||||
# Try creating a log file in temporary directory
|
# Try creating a log file in temporary directory
|
||||||
if [ ! -f /tmp/lynis.log ]; then
|
if [ ! -f /tmp/lynis.log ]; then
|
||||||
|
if [ -L /tmp/lynis.log ]; then echo "Log file is symlinked, which can introduce the risk of a symlink attack."; exit 1; fi
|
||||||
touch /tmp/lynis.log
|
touch /tmp/lynis.log
|
||||||
if [ $? -eq 0 ]; then LOGFILE="/tmp/lynis.log"; else LOGFILE="/dev/null"; fi
|
if [ $? -eq 0 ]; then LOGFILE="/tmp/lynis.log"; else LOGFILE="/dev/null"; fi
|
||||||
else
|
else
|
||||||
LOGFILE="/tmp/lynis.log"
|
LOGFILE="/tmp/lynis.log"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
if [ -L "${LOGFILE}" ]; then echo "Log file is symlinked, which can introduce the risk of a symlink attack."; exit 1; fi
|
||||||
fi
|
fi
|
||||||
if [ -z "${REPORTFILE}" ]; then
|
if [ -z "${REPORTFILE}" ]; then
|
||||||
touch /tmp/lynis-report.dat
|
touch /tmp/lynis-report.dat
|
||||||
|
if [ -L /tmp/lynis-report.dat ]; then echo "Report file is symlinked, which can introduce the risk of a symlink attack."; exit 1; fi
|
||||||
if [ $? -eq 0 ]; then REPORTFILE="/tmp/lynis-report.dat"; else REPORTFILE="/dev/null"; fi
|
if [ $? -eq 0 ]; then REPORTFILE="/tmp/lynis-report.dat"; else REPORTFILE="/dev/null"; fi
|
||||||
|
else
|
||||||
|
if [ -L "${REPORTFILE}" ]; then echo "Report file is symlinked, which can introduce the risk of a symlink attack."; exit 1; fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
#
|
#
|
||||||
|
Loading…
x
Reference in New Issue
Block a user