mirror of
https://github.com/CISOfy/lynis.git
synced 2025-07-26 23:34:25 +02:00
[NAME-4018] only perform test when /etc/resolv.conf exists
This commit is contained in:
parent
5df7773464
commit
814f2355ca
@ -90,20 +90,19 @@
|
|||||||
Display --indent 2 --text "- Checking search domains" --result "${STATUS_FOUND}" --color GREEN
|
Display --indent 2 --text "- Checking search domains" --result "${STATUS_FOUND}" --color GREEN
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
# Check amount of search domains (max 1)
|
||||||
|
FIND=$(${GREPBINARY} -c "^search" ${ROOTDIR}etc/resolv.conf)
|
||||||
|
if [ ! "${FIND}" = "0" -a ! "${FIND}" = "1" ]; then
|
||||||
|
LogText "Result: found ${FIND} line(s) with a search statement (expecting less than 2 lines)"
|
||||||
|
Display --indent 4 --text "- Checking search domains lines" --result "CONFIG ERROR" --color YELLOW
|
||||||
|
ReportWarning ${TEST_NO} "Found more than 1 search lines in /etc/resolv.conf, which is probably a misconfiguration"
|
||||||
|
else
|
||||||
|
LogText "Result: found ${FIND} line(s) with a search statement (expecting less than 2 lines)"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
LogText "Result: ${ROOTDIR}etc/resolv.conf does not exist, skipping test"
|
LogText "Result: ${ROOTDIR}etc/resolv.conf does not exist, skipping test"
|
||||||
Display --indent 2 --text "- Checking search domains" --result "${STATUS_NOT_FOUND}" --color YELLOW
|
Display --indent 2 --text "- Checking search domains" --result "${STATUS_NOT_FOUND}" --color YELLOW
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check amount of search domains (max 1)
|
|
||||||
FIND=$(${GREPBINARY} -c "^search" ${ROOTDIR}etc/resolv.conf)
|
|
||||||
if [ ! "${FIND}" = "0" -a ! "${FIND}" = "1" ]; then
|
|
||||||
LogText "Result: found ${FIND} line(s) with a search statement (expecting less than 2 lines)"
|
|
||||||
Display --indent 4 --text "- Checking search domains lines" --result "CONFIG ERROR" --color YELLOW
|
|
||||||
ReportWarning ${TEST_NO} "Found more than 1 search lines in /etc/resolv.conf, which is probably a misconfiguration"
|
|
||||||
else
|
|
||||||
LogText "Result: found ${FIND} line(s) with a search statement (expecting less than 2 lines)"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
#
|
#
|
||||||
#################################################################################
|
#################################################################################
|
||||||
|
Loading…
x
Reference in New Issue
Block a user