mirror of https://github.com/CISOfy/lynis.git
Fix for NAME-4408: getent hosts localhost may show two lines on Ope… (#310)
* Fix for NAME-4408: getent hosts localhost may show two lines on OpenBSD * This version does the comparisons in little less awkward way
This commit is contained in:
parent
50b06efd30
commit
3aa2efba4d
|
@ -662,7 +662,7 @@
|
|||
Register --test-no NAME-4408 --preqs-met ${PREQS_MET} --skip-reason "${SKIPREASON}" --weight L --network NO --category security --description "Check localhost entry"
|
||||
if [ ${SKIPTEST} -eq 0 ]; then
|
||||
LogText "Test: Check server hostname not locally mapped in /etc/hosts"
|
||||
FIND=$(${GETENT_BINARY} hosts localhost | ${AWKBINARY} '{print $1}')
|
||||
FIND=$(${GETENT_BINARY} hosts localhost | ${AWKBINARY} '{print $1}' | ${SORTBINARY} | ${TRBINARY} -d '\n')
|
||||
if [ "${FIND}" = "127.0.0.1" ]; then
|
||||
LogText "Result: localhost mapped to 127.0.0.1"
|
||||
Display --indent 4 --text "- Checking /etc/hosts (localhost to IP)" --result "${STATUS_OK}" --color GREEN
|
||||
|
@ -671,6 +671,10 @@
|
|||
LogText "Result: localhost mapped to ::1"
|
||||
Display --indent 4 --text "- Checking /etc/hosts (localhost to IP)" --result "${STATUS_OK}" --color GREEN
|
||||
report "localhost-mapped-to=${FIND}"
|
||||
elif [ "${FIND}" = "127.0.0.1::1" ]; then
|
||||
LogText "Result: localhost mapped to 127.0.0.1 and ::1"
|
||||
Display --indent 4 --text "- Checking /etc/hosts (localhost to IP)" --result "${STATUS_OK}" --color GREEN
|
||||
report "localhost-mapped-to=${FIND}"
|
||||
else
|
||||
LogText "Output: ${FIND}"
|
||||
LogText "Result: this server hostname is not mapped to a local address"
|
||||
|
|
Loading…
Reference in New Issue