diff options
author | mboelen <michael@cisofy.com> | 2015-12-21 23:17:15 +0300 |
---|---|---|
committer | mboelen <michael@cisofy.com> | 2015-12-21 23:17:15 +0300 |
commit | d16b38eff83a8dca405e21e1c34205289f3d0832 (patch) | |
tree | d9db1eac3d4ead003f0e1b4fbfbabf0ddeb66c1e /include/tests_banners | |
parent | 83a44827e03543146e39c37c33f14ebca6f40a29 (diff) |
Rename of logtext and report functions, upcoming year change
Diffstat (limited to 'include/tests_banners')
-rw-r--r-- | include/tests_banners | 71 |
1 files changed, 35 insertions, 36 deletions
diff --git a/include/tests_banners b/include/tests_banners index 96e3998e..05603476 100644 --- a/include/tests_banners +++ b/include/tests_banners @@ -5,7 +5,7 @@ # Lynis # ------------------ # -# Copyright 2007-2015, Michael Boelen, CISOfy (michael.boelen@cisofy.com) +# Copyright 2007-2016, Michael Boelen, CISOfy (michael.boelen@cisofy.com) # Web site: https://cisofy.com # # Lynis comes with ABSOLUTELY NO WARRANTY. This is free software, and you are @@ -31,29 +31,29 @@ # Description : Check FreeBSD COPYRIGHT banner file Register --test-no BANN-7113 --os FreeBSD --weight L --network NO --description "Check COPYRIGHT banner file" if [ ${SKIPTEST} -eq 0 ]; then - logtext "Test: Testing existence /COPYRIGHT or /etc/COPYRIGHT" + LogText "Test: Testing existence /COPYRIGHT or /etc/COPYRIGHT" if [ -f /COPYRIGHT ]; then Display --indent 2 --text "- /COPYRIGHT" --result FOUND --color GREEN if [ -s /COPYRIGHT ]; then - logtext "Result: /COPYRIGHT available and contains text" + LogText "Result: /COPYRIGHT available and contains text" else - logtext "Result: /COPYRIGHT available, but empty" + LogText "Result: /COPYRIGHT available, but empty" fi else Display --indent 2 --text "- /COPYRIGHT" --result "NOT FOUND" --color WHITE - logtext "Result: /COPYRIGHT not found" + LogText "Result: /COPYRIGHT not found" fi if [ -f /etc/COPYRIGHT ]; then Display --indent 2 --text "- /etc/COPYRIGHT" --result FOUND --color GREEN if [ -s /etc/COPYRIGHT ]; then - logtext "Result: /etc/COPYRIGHT available and contains text" + LogText "Result: /etc/COPYRIGHT available and contains text" else - logtext "Result: /etc/COPYRIGHT available, but empty" + LogText "Result: /etc/COPYRIGHT available, but empty" fi else Display --indent 2 --text "- /etc/COPYRIGHT" --result "NOT FOUND" --color WHITE - logtext "Result: /etc/COPYRIGHT not found" + LogText "Result: /etc/COPYRIGHT not found" fi fi # @@ -63,25 +63,24 @@ # Description : Check MOTD banner file Register --test-no BANN-7119 --weight L --network NO --description "Check MOTD banner file" if [ ${SKIPTEST} -eq 0 ]; then - logtext "Test: Testing existence /etc/motd" + LogText "Test: Testing existence /etc/motd" if [ -f /etc/motd ]; then - logtext "Result: file /etc/motd exists" + LogText "Result: file /etc/motd exists" Display --indent 2 --text "- /etc/motd" --result FOUND --color GREEN if [ ! -L /etc/motd ]; then - IsWorldWritable /etc/motd - if [ $? -eq 1 ]; then + if IsWorldWritable /etc/motd; then Display --indent 4 --text "- /etc/motd permissions" --result WARNING --color RED - logtext "Result: /etc/motd is world writable. Users can change this file!" + 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 - logtext "Result: /etc/motd is not world writable." + LogText "Result: /etc/motd is not world writable." fi else - logtext "Result: file /etc/motd is symlink" + LogText "Result: file /etc/motd is symlink" fi else - logtext "Result: File /etc/motd not found" + LogText "Result: File /etc/motd not found" Display --indent 2 --text "- /etc/motd" --result "NOT FOUND" --color WHITE fi fi @@ -95,21 +94,21 @@ Register --test-no BANN-7122 --preqs-met ${PREQS_MET} --weight L --network NO --description "Check /etc/motd banner file contents" if [ ${SKIPTEST} -eq 0 ]; then N=0 - logtext "Test: Checking file /etc/motd contents for legal key words" + LogText "Test: Checking file /etc/motd contents for legal key words" for I in ${LEGAL_BANNER_STRINGS}; do FIND=`grep -i "${I}" /etc/motd` if [ ! "${FIND}" = "" ]; then - logtext "Result: found string '${I}'" + 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" + LogText "Result: Found ${N} key words, to warn unauthorized users" 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" + 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 ReportSuggestion ${TEST_NO} "Add legal banner to /etc/motd, to warn unauthorized users" AddHP 0 1 @@ -122,17 +121,17 @@ # Description : Check issue banner file Register --test-no BANN-7124 --weight L --network NO --description "Check issue banner file" if [ ${SKIPTEST} -eq 0 ]; then - logtext "Test: Checking file /etc/issue" + 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)" + 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" + LogText "Result: file /etc/issue does not exist" Display --indent 2 --text "- /etc/issue" --result "NOT FOUND" --color WHITE fi fi @@ -146,21 +145,21 @@ Register --test-no BANN-7126 --preqs-met ${PREQS_MET} --weight L --network NO --description "Check issue banner file contents" if [ ${SKIPTEST} -eq 0 ]; then N=0 - logtext "Test: Checking file /etc/issue contents for legal key words" + LogText "Test: Checking file /etc/issue contents for legal key words" for I in ${LEGAL_BANNER_STRINGS}; do FIND=`grep -i "${I}" /etc/issue` if [ ! "${FIND}" = "" ]; then - logtext "Result: found string '${I}'" + 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 (5 or more suggested), to warn unauthorized users" + 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 AddHP 2 2 else - logtext "Result: Found only ${N} key words (5 or more suggested), to warn unauthorized users and could be increased" + 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" AddHP 0 1 @@ -173,18 +172,18 @@ # Description : Check issue.net banner file Register --test-no BANN-7128 --weight L --network NO --description "Check issue.net banner file" if [ ${SKIPTEST} -eq 0 ]; then - logtext "Test: Checking file /etc/issue.net" + 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)" + 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" + 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" + LogText "Result: file /etc/issue.net does not exist" Display --indent 2 --text "- /etc/issue.net" --result "NOT FOUND" --color WHITE fi fi @@ -198,21 +197,21 @@ Register --test-no BANN-7130 --preqs-met ${PREQS_MET} --weight L --network NO --description "Check issue.net banner file contents" if [ ${SKIPTEST} -eq 0 ]; then N=0 - logtext "Test: Checking file /etc/issue.net contents for legal key words" + 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}'" + 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" + 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" + 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 @@ -226,4 +225,4 @@ wait_for_keypress # #================================================================================ -# Lynis - Copyright 2007-2015, Michael Boelen, CISOfy - https://cisofy.com +# Lynis - Copyright 2007-2016, Michael Boelen, CISOfy - https://cisofy.com |