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:
authorMichael Boelen <michael.boelen@cisofy.com>2016-09-13 18:27:25 +0300
committerMichael Boelen <michael.boelen@cisofy.com>2016-09-13 18:27:25 +0300
commitdf2fff6cc70cbdf7219fcbcd9d692231f8033a0c (patch)
tree35c35048c427c048eed2f23510b656815da53af1 /include/tests_nameservices
parentad678eca747466bf16a52059315e0898eceff9f9 (diff)
Added NAME-4408 to check localhost to IP mapping
Diffstat (limited to 'include/tests_nameservices')
-rw-r--r--include/tests_nameservices26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/tests_nameservices b/include/tests_nameservices
index e7bb7800..43b491f2 100644
--- a/include/tests_nameservices
+++ b/include/tests_nameservices
@@ -657,6 +657,32 @@
#
#################################################################################
#
+ # Test : NAME-4408
+ # Description : Check localhost entry
+ if [ ! -z "${GETENTBINARY}" ]; then PREQS_MET="YES"; SKIPREASON="No getent binary"; else PREQS_MET="NO"; SKIPREASON=""; fi
+ 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=$(${GETENTBINARY} hosts localhost | ${AWKBINARY} '{print $1}')
+ 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
+ report "localhost-mapped-to=${FIND}"
+ elif [ "${FIND}" = "::1" ]; then
+ 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}"
+ else
+ LogText "Output: ${FIND}"
+ LogText "Result: this server hostname is not mapped to a local address"
+ Display --indent 4 --text "- Checking /etc/hosts (localhost to IP)" --result "${STATUS_SUGGESTION}" --color YELLOW
+ LogText "Information: Ensure that localhost resolves back to 127.0.0.1 (and/or ::1)."
+ ReportSuggestion ${TEST_NO} "Split resolving between localhost and the hostname of the system" "/etc/hosts" "text:Check your localhost line"
+ fi
+ fi
+#
+#################################################################################
+#
Report "name_cache_used=${NAME_CACHE_USED}"
WaitForKeyPress