mirror of https://github.com/CISOfy/lynis.git
[TIME-3104] search for files using find and strip potential characters that may be unexpected
This commit is contained in:
parent
8c501c7aa8
commit
7e3c9448df
|
@ -163,22 +163,28 @@
|
|||
fi
|
||||
done
|
||||
|
||||
# Don't run check in cron job directory on Solaris
|
||||
# /etc/cron.d/FIFO is a special file and test get stuck at this file
|
||||
# Notes: only test for normal files. File /etc/cron.d/FIFO on solaris is a special file and test may hang
|
||||
# Linux systems may have a .placeholder file
|
||||
FOUND_IN_CRON=0
|
||||
|
||||
# Check cron jobs
|
||||
for I in ${CRON_DIRS}; do
|
||||
if [ -d ${I} ]; then
|
||||
if FileIsReadable ${I}; then
|
||||
FIND=$(${LSBINARY} ${I} | ${GREPBINARY} -v FIFO)
|
||||
FIND=$(${FINDBINARY} ${I} -type f -a ! -name ".placeholder" -print 2> /dev/null | ${SEDBINARY} 's/ /__space__/g' | ${TRBINARY} '\n' '\0' | ${TRBINARY} -cd '[:print:]\0' | ${TRBINARY} '\0' ' ')
|
||||
if [ -n "${FIND}" ]; then
|
||||
for J in ${FIND}; do
|
||||
LogText "Test: checking for ntpdate or rdate in ${I}/${J}"
|
||||
FIND2=$(${EGREPBINARY} "rdate|ntpdate" ${I}/${J} | ${GREPBINARY} -v "^#")
|
||||
if [ -n "${FIND2}" ]; then
|
||||
LogText "Positive match found: ${FIND2}"
|
||||
FOUND=1; FOUND_IN_CRON=1; NTP_CONFIG_TYPE_SCHEDULED=1
|
||||
# Place back spaces if needed
|
||||
J=$(echo ${J} | ${SEDBINARY} 's/__space__/ /g')
|
||||
LogText "Test: checking for ntpdate or rdate in ${J}"
|
||||
if FileIsReadable ${J}; then
|
||||
FIND2=$(${EGREPBINARY} "rdate|ntpdate" "${J}" | ${GREPBINARY} -v "^#")
|
||||
if [ -n "${FIND2}" ]; then
|
||||
LogText "Positive match found: ${FIND2}"
|
||||
FOUND=1; FOUND_IN_CRON=1; NTP_CONFIG_TYPE_SCHEDULED=1
|
||||
fi
|
||||
else
|
||||
LogText "Result: could not test in file '${J}' as it is not readable"
|
||||
fi
|
||||
done
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue