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>2017-02-28 22:17:01 +0300
committerMichael Boelen <michael.boelen@cisofy.com>2017-02-28 22:17:01 +0300
commited52d0dd417f8d833bc2bfdbbae012d6231836e6 (patch)
tree9332c8f869aaff519a8f0d2d7f39459f362b22f2 /include/tests_mail_messaging
parent3a7d9a42f4700e872eac7ebbc6cf62a53a325160 (diff)
New test and reduction of output on screen
Diffstat (limited to 'include/tests_mail_messaging')
-rw-r--r--include/tests_mail_messaging58
1 files changed, 42 insertions, 16 deletions
diff --git a/include/tests_mail_messaging b/include/tests_mail_messaging
index 2c9a2d66..6157e671 100644
--- a/include/tests_mail_messaging
+++ b/include/tests_mail_messaging
@@ -46,12 +46,13 @@
IsRunning exim
if [ ${RUNNING} -eq 1 ]; then
LogText "Result: found running Exim process"
- Display --indent 2 --text "- Checking Exim status" --result "${STATUS_RUNNING}" --color GREEN
+ Display --indent 2 --text "- Exim status" --result "${STATUS_RUNNING}" --color GREEN
EXIM_RUNNING=1
SMTP_DAEMON="exim"
+ Report "smtp_daemon[]=exim"
else
LogText "Result: no running Exim processes found"
- Display --indent 2 --text "- Checking Exim status" --result "${STATUS_NOT_FOUND}" --color WHITE
+ if IsVerbose; then Display --indent 2 --text "- Exim status" --result "${STATUS_NOT_FOUND}" --color WHITE; fi
fi
fi
#
@@ -67,12 +68,13 @@
FIND1=$(${PSBINARY} ax | ${GREPBINARY} "master" | ${GREPBINARY} "postfix" | ${GREPBINARY} -v "grep")
if [ ! -z "${FIND1}" ]; then
LogText "Result: found running Postfix process"
- Display --indent 2 --text "- Checking Postfix status" --result "${STATUS_RUNNING}" --color GREEN
+ Display --indent 2 --text "- Postfix status" --result "${STATUS_RUNNING}" --color GREEN
POSTFIX_RUNNING=1
SMTP_DAEMON="postfix"
+ Report "smtp_daemon[]=postfix"
else
LogText "Result: no running Postfix processes found"
- Display --indent 2 --text "- Checking Postfix status" --result "${STATUS_NOT_FOUND}" --color WHITE
+ if IsVerbose; then Display --indent 2 --text "- Postfix status" --result "${STATUS_NOT_FOUND}" --color WHITE; fi
fi
fi
#
@@ -83,7 +85,7 @@
if [ ${POSTFIX_RUNNING} -eq 1 -a ! "${POSTFIXBINARY}" = "" ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
Register --test-no MAIL-8816 --preqs-met ${PREQS_MET} --weight L --network NO --category security --description "Check Postfix configuration"
if [ ${SKIPTEST} -eq 0 ]; then
- Display --indent 2 --text "- Checking Postfix configuration" --result "${STATUS_FOUND}" --color GREEN
+ Display --indent 4 --text "- Postfix configuration" --result "${STATUS_FOUND}" --color GREEN
POSTFIX_CONFIGDIR=$(${POSTCONFBINARY} 2> /dev/null | ${GREPBINARY} '^config_directory' | ${AWKBINARY} '{ print $3 }')
POSTFIX_CONFIGFILE="${POSTFIX_CONFIGDIR}/main.cf"
LogText "Postfix configuration directory: ${POSTFIX_CONFIGDIR}"
@@ -92,6 +94,26 @@
#
#################################################################################
#
+ # Test : MAIL-8817
+ # Description : Check Postfix configuration for error
+ if [ ${POSTFIX_RUNNING} -eq 1 -a ! "${POSTFIXBINARY}" = "" ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
+ Register --test-no MAIL-8817 --preqs-met ${PREQS_MET} --weight L --network NO --category security --description "Check Postfix configuration errors"
+ if [ ${SKIPTEST} -eq 0 ]; then
+ LogText "Test: using postconf to see if Postfix configuration has errors"
+ FIND=$(${POSTCONFBINARY} 2>&1 | ${GREPBINARY} "warning:")
+ if [ ! -z "${FIND}" ]; then
+ Report "postfix_config_error=1"
+ Display --indent 6 --text "- Postfix configuration errors" --result "${STATUS_WARNING}" --color RED
+ LogText "Result: found an error or warning in the Postfix configuration. Manual check suggested."
+ ReportSuggestion ${TEST_NO} "Found a configuration error in Postfix" "${POSTFIX_CONFIGFILE}" "text:run postconf > /dev/null"
+ else
+ LogText "Result: all looks to be fine with Postfix configuration"
+ if IsVerbose; then Display --indent 6 --text "- Postfix configuration errors" --result "${STATUS_OK}" --color GREEN; fi
+ fi
+ fi
+#
+#################################################################################
+#
# Test : MAIL-8818
# Description : Check Postfix configuration
if [ ${POSTFIX_RUNNING} -eq 1 -a ! "${POSTFIXBINARY}" = "" ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
@@ -122,12 +144,12 @@
fi
if [ ${SHOWWARNING} -eq 1 ]; then
- Display --indent 4 --text "- Postfix banner" --result "${STATUS_WARNING}" --color RED
+ Display --indent 6 --text "- Postfix banner" --result "${STATUS_WARNING}" --color RED
LogText "Result: found OS, or mail_name in SMTP banner, and/or mail_name contains 'Postfix'."
ReportWarning ${TEST_NO} "Found some information disclosure in SMTP banner (OS or software name)"
ReportSuggestion ${TEST_NO} "You are advised to hide the mail_name (option: smtpd_banner) from your postfix configuration. Use postconf -e or change your main.cf file (${POSTFIX_CONFIGFILE})"
else
- if IsVerbose; then Display --indent 4 --text "- Postfix banner" --result "${STATUS_OK}" --color GREEN; fi
+ if IsVerbose; then Display --indent 6 --text "- Postfix banner" --result "${STATUS_OK}" --color GREEN; fi
fi
fi
#
@@ -141,13 +163,15 @@
IsRunning dovecot
if [ ${RUNNING} -eq 1 ]; then
LogText "Result: found running dovecot process"
- Display --indent 2 --text "- Checking Dovecot status" --result "${STATUS_RUNNING}" --color GREEN
+ Display --indent 2 --text "- Dovecot status" --result "${STATUS_RUNNING}" --color GREEN
DOVECOT_RUNNING=1
IMAP_DAEMON="dovecot"
POP3_DAEMON="dovecot"
+ Report "pop3_daemon[]=dovecot"
+ Report "imap_daemon[]=dovecot"
else
LogText "Result: dovecot not found"
- Display --indent 2 --text "- Checking Dovecot status" --result "${STATUS_NOT_FOUND}" --color WHITE
+ if IsVerbose; then Display --indent 2 --text "- Dovecot status" --result "${STATUS_NOT_FOUND}" --color WHITE; fi
fi
fi
#
@@ -161,12 +185,13 @@
IsRunning qmail-smtpd
if [ ${RUNNING} -eq 1 ]; then
LogText "Result: found running Qmail process"
- Display --indent 2 --text "- Checking Qmail status" --result "${STATUS_RUNNING}" --color GREEN
+ Display --indent 2 --text "- Qmail status" --result "${STATUS_RUNNING}" --color GREEN
QMAIL_RUNNING=1
SMTP_DAEMON="qmail"
+ Report "smtp_daemon[]=qmail"
else
LogText "Result: no running Qmail processes found"
- Display --indent 2 --text "- Checking Qmail status" --result "${STATUS_NOT_FOUND}" --color WHITE
+ if IsVerbose; then Display --indent 2 --text "- Qmail status" --result "${STATUS_NOT_FOUND}" --color WHITE; fi
fi
fi
#
@@ -180,12 +205,13 @@
IsRunning sendmail
if [ ${RUNNING} -eq 1 ]; then
LogText "Result: found running Sendmail process"
- Display --indent 2 --text "- Checking Sendmail status" --result "${STATUS_RUNNING}" --color GREEN
+ Display --indent 2 --text "- Sendmail status" --result "${STATUS_RUNNING}" --color GREEN
SENDMAIL_RUNNING=1
SMTP_DAEMON="sendmail"
+ Report "smtp_daemon[]=sendmail"
else
LogText "Result: no running Sendmail processes found"
- Display --indent 2 --text "- Checking Sendmail status" --result "${STATUS_NOT_FOUND}" --color WHITE
+ if IsVerbose; then Display --indent 2 --text "- Sendmail status" --result "${STATUS_NOT_FOUND}" --color WHITE; fi
fi
fi
#
@@ -200,12 +226,12 @@
FIND=$(${PSBINARY} ax | ${EGREPBINARY} "(/smtpd|smtpd: \[priv\]|smtpd: smtp)" | ${GREPBINARY} -v "grep")
if [ ! "${FIND}" = "" ]; then
LogText "Result: found running smtpd process"
- Display --indent 2 --text "- Checking OpenSMTPD status" --result "${STATUS_RUNNING}" --color GREEN
+ Display --indent 2 --text "- OpenSMTPD status" --result "${STATUS_RUNNING}" --color GREEN
OPENSMTPD_RUNNING=1
- SMTP_DAEMON="opensmtpd"
+ Report "smtp_daemon[]=opensmtpd"
else
LogText "Result: smtpd not found"
- Display --indent 2 --text "- Checking OpenSMTPD status" --result "${STATUS_NOT_FOUND}" --color WHITE
+ if IsVerbose; then Display --indent 2 --text "- OpenSMTPD status" --result "${STATUS_NOT_FOUND}" --color WHITE; fi
fi
fi
#