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:
authormboelen <michael@cisofy.com>2015-03-25 19:31:17 +0300
committermboelen <michael@cisofy.com>2015-03-25 19:31:17 +0300
commit9978e5c824a7f9e12a400ca8d73d77f240ff750f (patch)
tree5e6f4c716d2ae55bd5f47529283687c406f99b0e /include/tests_banners
parent30bc903c5a6151ef6c96cf9f4894f4d25ed4d73a (diff)
Using return codes and minor cleanups of code
Diffstat (limited to 'include/tests_banners')
-rw-r--r--include/tests_banners78
1 files changed, 39 insertions, 39 deletions
diff --git a/include/tests_banners b/include/tests_banners
index 16620a8a..1bc1bbd0 100644
--- a/include/tests_banners
+++ b/include/tests_banners
@@ -5,8 +5,8 @@
# Lynis
# ------------------
#
-# Copyright 2007-2015, Michael Boelen (michael@rootkit.nl), The Netherlands
-# Web site: http://www.rootkit.nl
+# Copyright 2007-2015, 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
# welcome to redistribute it under the terms of the GNU General Public License.
@@ -45,7 +45,7 @@
fi
if [ -f /etc/COPYRIGHT ]; then
- Display --indent 2 --text "- /etc/COPYRIGHT" --result FOUND --color GREEN
+ Display --indent 2 --text "- /etc/COPYRIGHT" --result FOUND --color GREEN
if [ -s /etc/COPYRIGHT ]; then
logtext "Result: /etc/COPYRIGHT available and contains text"
else
@@ -65,24 +65,24 @@
if [ ${SKIPTEST} -eq 0 ]; then
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
- if [ ! -L /etc/motd ]; then
- IsWorldWritable /etc/motd
- if [ "${FileIsWorldWritable}" = "TRUE" ]; then
- 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
- logtext "Result: /etc/motd is not world writable."
- fi
- else
- logtext "Result: file /etc/motd is symlink"
- fi
- else
- logtext "Result: File /etc/motd not found"
- Display --indent 2 --text "- /etc/motd" --result "NOT FOUND" --color WHITE
+ 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
+ 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
+ logtext "Result: /etc/motd is not world writable."
+ fi
+ else
+ logtext "Result: file /etc/motd is symlink"
+ fi
+ else
+ logtext "Result: File /etc/motd not found"
+ Display --indent 2 --text "- /etc/motd" --result "NOT FOUND" --color WHITE
fi
fi
#
@@ -97,23 +97,23 @@
N=0
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}'"
- 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/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
- ReportSuggestion ${TEST_NO} "Add legal banner to /etc/motd, to warn unauthorized users"
- AddHP 0 1
- fi
+ FIND=`grep -i "${I}" /etc/motd`
+ 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/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
+ ReportSuggestion ${TEST_NO} "Add legal banner to /etc/motd, to warn unauthorized users"
+ AddHP 0 1
+ fi
fi
#
#################################################################################
@@ -246,4 +246,4 @@ wait_for_keypress
# HPUX: /etc/copyright
#
#================================================================================
-# Lynis - Copyright 2007-2015, Michael Boelen - www.rootkit.nl - The Netherlands
+# Lynis - Copyright 2007-2015, Michael Boelen, CISOfy - https://cisofy.com