From 551f89c63b08069ae78947580e6ce640fc10d7a3 Mon Sep 17 00:00:00 2001 From: Michael Boelen Date: Sat, 28 Jan 2017 15:47:47 +0100 Subject: Log weak banner and code enhancements --- include/tests_banners | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/include/tests_banners b/include/tests_banners index d200b343..ee3e15a1 100644 --- a/include/tests_banners +++ b/include/tests_banners @@ -149,10 +149,11 @@ Register --test-no BANN-7126 --preqs-met ${PREQS_MET} --weight L --network NO --category security --description "Check issue banner file contents" if [ ${SKIPTEST} -eq 0 ]; then N=0 - LogText "Test: Checking file /etc/issue contents for legal key words" + FILE="${ROOTDIR}etc/issue" + LogText "Test: Checking file ${FILE} contents for legal key words" for I in ${LEGAL_BANNER_STRINGS}; do - FIND=`${GREPBINARY} -i "${I}" /etc/issue` - if [ ! "${FIND}" = "" ]; then + FIND=$(${GREPBINARY} -i "${I}" ${FILE}) + if [ ! -z "${FIND}" ]; then LogText "Result: found string '${I}'" N=$((N + 1)) fi @@ -160,13 +161,14 @@ # Check if we have 5 or more key words if [ ${N} -gt 4 ]; then LogText "Result: Found ${N} key words (5 or more suggested), to warn unauthorized users" - Display --indent 4 --text "- /etc/issue contents" --result "${STATUS_OK}" --color GREEN + Display --indent 4 --text "- ${FILE} contents" --result "${STATUS_OK}" --color GREEN AddHP 2 2 else LogText "Result: Found only ${N} key words (5 or more suggested), to warn unauthorized users and could be increased" - Display --indent 4 --text "- /etc/issue contents" --result WEAK --color YELLOW - ReportSuggestion ${TEST_NO} "Add a legal banner to /etc/issue, to warn unauthorized users" + Display --indent 4 --text "- ${FILE} contents" --result WEAK --color YELLOW + ReportSuggestion ${TEST_NO} "Add a legal banner to ${FILE}, to warn unauthorized users" AddHP 0 1 + Report "weak_banner_file[]=${FILE}" fi fi # -- cgit v1.2.3