diff options
author | mboelen <michael@cisofy.com> | 2014-09-15 14:01:09 +0400 |
---|---|---|
committer | mboelen <michael@cisofy.com> | 2014-09-15 14:01:09 +0400 |
commit | c9fde8c2d11744cc0875bc3e5dd0abf096211755 (patch) | |
tree | 0997d08919db7ec4e2aa9065c3e9aaf1671c4d6f /include/tests_banners | |
parent | 35d32fb5e40b86632677fd2256aebeddf926394a (diff) |
Code cleanup and small enhancements
Diffstat (limited to 'include/tests_banners')
-rw-r--r-- | include/tests_banners | 97 |
1 files changed, 48 insertions, 49 deletions
diff --git a/include/tests_banners b/include/tests_banners index 38c42c01..c0ed7179 100644 --- a/include/tests_banners +++ b/include/tests_banners @@ -19,7 +19,6 @@ ################################################################################# # InsertSection "Banners and identification" -# Display --indent 2 --text "- Checking banners..." # ################################################################################# # @@ -67,15 +66,15 @@ logtext "Test: Testing existence /etc/motd" if [ -f /etc/motd ]; then logtext "Result: file /etc/motd exists" - Display --indent 2 --text "- /etc/motd..." --result FOUND --color GREEN + Display --indent 2 --text "- /etc/motd" --result FOUND --color GREEN if [ ! -L /etc/motd ]; then IsWorldWritable /etc/motd if [ "${FileIsWorldWritable}" = "TRUE" ]; then - Display --indent 4 --text "- /etc/motd permissions..." --result WARNING --color RED + Display --indent 4 --text "- /etc/motd permissions" --result WARNING --color RED logtext "Result: /etc/motd is world writable. Users can change this file!" ReportWarning ${TEST_NO} "H" "/etc/motd is world writable" else - Display --indent 4 --text "- /etc/motd permissions..." --result OK --color GREEN + Display --indent 4 --text "- /etc/motd permissions" --result OK --color GREEN logtext "Result: /etc/motd is not world writable." fi else @@ -83,7 +82,7 @@ fi else logtext "Result: File /etc/motd not found" - Display --indent 2 --text "- /etc/motd..." --result "NOT FOUND" --color WHITE + Display --indent 2 --text "- /etc/motd" --result "NOT FOUND" --color WHITE fi fi # @@ -107,11 +106,11 @@ # Check if we have 5 or more key words if [ ${N} -gt 4 ]; then logtext "Result: Found ${N} key words, to warn unauthorized users" - Display --indent 4 --text "- /etc/motd contents..." --result OK --color GREEN + Display --indent 4 --text "- /etc/motd contents" --result OK --color GREEN AddHP 2 2 else logtext "Result: Found only ${N} key words, to warn unauthorized users and could be increased" - Display --indent 4 --text "- /etc/motd contents..." --result WEAK --color YELLOW + Display --indent 4 --text "- /etc/motd contents" --result WEAK --color YELLOW ReportSuggestion ${TEST_NO} "Add legal banner to /etc/motd, to warn unauthorized users" AddHP 0 1 fi @@ -125,17 +124,17 @@ if [ ${SKIPTEST} -eq 0 ]; then logtext "Test: Checking file /etc/issue" if [ -f /etc/issue ]; then - # Check for symlink - if [ -L /etc/issue ]; then - logtext "Result: file /etc/issue exists (symlink)" - Display --indent 2 --text "- /etc/issue..." --result SYMLINK --color GREEN - else - Display --indent 2 --text "- /etc/issue..." --result FOUND --color GREEN - fi - else - logtext "Result: file /etc/issue does not exist" - Display --indent 2 --text "- /etc/issue..." --result "NOT FOUND" --color WHITE - fi + # Check for symlink + if [ -L /etc/issue ]; then + logtext "Result: file /etc/issue exists (symlink)" + Display --indent 2 --text "- /etc/issue" --result SYMLINK --color GREEN + else + Display --indent 2 --text "- /etc/issue" --result FOUND --color GREEN + fi + else + logtext "Result: file /etc/issue does not exist" + Display --indent 2 --text "- /etc/issue" --result "NOT FOUND" --color WHITE + fi fi # ################################################################################# @@ -158,11 +157,11 @@ # 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 OK --color GREEN + Display --indent 4 --text "- /etc/issue contents" --result 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 + 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" AddHP 0 1 fi @@ -176,18 +175,18 @@ if [ ${SKIPTEST} -eq 0 ]; then logtext "Test: Checking file /etc/issue.net" if [ -f /etc/issue.net ]; then - # Check for symlink - if [ -L /etc/issue.net ]; then - logtext "Result: file /etc/issue.net exists (symlink)" - Display --indent 2 --text "- /etc/issue.net..." --result SYMLINK --color GREEN - else - logtext "Result: file /etc/issue.net exists" - Display --indent 2 --text "- /etc/issue.net..." --result FOUND --color GREEN - fi - else - logtext "Result: file /etc/issue.net does not exist" - Display --indent 2 --text "- /etc/issue.net..." --result "NOT FOUND" --color WHITE - fi + # Check for symlink + if [ -L /etc/issue.net ]; then + logtext "Result: file /etc/issue.net exists (symlink)" + Display --indent 2 --text "- /etc/issue.net" --result SYMLINK --color GREEN + else + logtext "Result: file /etc/issue.net exists" + Display --indent 2 --text "- /etc/issue.net" --result FOUND --color GREEN + fi + else + logtext "Result: file /etc/issue.net does not exist" + Display --indent 2 --text "- /etc/issue.net" --result "NOT FOUND" --color WHITE + fi fi # ################################################################################# @@ -201,23 +200,23 @@ N=0 logtext "Test: Checking file /etc/issue.net contents for legal key words" for I in ${LEGAL_BANNER_STRINGS}; do - FIND=`grep -i "${I}" /etc/issue.net` - if [ ! "${FIND}" = "" ]; then - logtext "Result: found string '${I}'" - N=`expr ${N} + 1` - fi - done - # Check if we have 5 or more key words - if [ ${N} -gt 4 ]; then - logtext "Result: Found ${N} key words, to warn unauthorized users" - Display --indent 4 --text "- /etc/issue.net contents..." --result OK --color GREEN - AddHP 2 2 - else - logtext "Result: Found only ${N} key words, to warn unauthorized users and could be increased" - Display --indent 4 --text "- /etc/issue.net contents..." --result WEAK --color YELLOW - ReportSuggestion ${TEST_NO} "Add legal banner to /etc/issue.net, to warn unauthorized users" - AddHP 0 1 - fi + FIND=`grep -i "${I}" /etc/issue.net` + if [ ! "${FIND}" = "" ]; then + logtext "Result: found string '${I}'" + N=`expr ${N} + 1` + fi + done + # Check if we have 5 or more key words + if [ ${N} -gt 4 ]; then + logtext "Result: Found ${N} key words, to warn unauthorized users" + Display --indent 4 --text "- /etc/issue.net contents" --result OK --color GREEN + AddHP 2 2 + else + logtext "Result: Found only ${N} key words, to warn unauthorized users and could be increased" + Display --indent 4 --text "- /etc/issue.net contents" --result WEAK --color YELLOW + ReportSuggestion ${TEST_NO} "Add legal banner to /etc/issue.net, to warn unauthorized users" + AddHP 0 1 + fi fi # ################################################################################# |