Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CISOfy/lynis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralobodzinski <lobo@dzinski.net>2016-11-05 13:55:11 +0300
committerMichael Boelen <michael.boelen@cisofy.com>2016-11-05 13:55:11 +0300
commit3aa2efba4d04f8a1fe7673bd8d5218f64322c8a7 (patch)
treea886146e619c5c0d43337a6809dcff6141e61e48 /include/tests_nameservices
parent50b06efd303fa82284dfa1fd083ed18fa8a55ec6 (diff)
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
Diffstat (limited to 'include/tests_nameservices')
-rw-r--r--include/tests_nameservices6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/tests_nameservices b/include/tests_nameservices
index 1881bd1b..01810688 100644
--- a/include/tests_nameservices
+++ b/include/tests_nameservices
@@ -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"