[MAIL-8818] Style and refactoring

This commit is contained in:
Michael Boelen 2016-07-31 15:43:06 +02:00
parent d05777caf2
commit 1e62769ce0
1 changed files with 9 additions and 9 deletions

View File

@ -98,25 +98,25 @@
Register --test-no MAIL-8818 --preqs-met ${PREQS_MET} --weight L --network NO --category security --description "Check Postfix configuration: banner" Register --test-no MAIL-8818 --preqs-met ${PREQS_MET} --weight L --network NO --category security --description "Check Postfix configuration: banner"
if [ ${SKIPTEST} -eq 0 ]; then if [ ${SKIPTEST} -eq 0 ]; then
LogText "Test: Checking Postfix banner" LogText "Test: Checking Postfix banner"
FIND1=`${POSTCONFBINARY} 2> /dev/null | grep '^smtpd_banner' | grep 'postfix'` FIND1=$(${POSTCONFBINARY} 2> /dev/null | grep '^smtpd_banner' | grep 'postfix')
FIND2=`${POSTCONFBINARY} 2> /dev/null | grep '^smtpd_banner' | grep '$mail_name'` FIND2=$(${POSTCONFBINARY} 2> /dev/null | grep '^smtpd_banner' | grep '$mail_name')
FIND3=`${POSTCONFBINARY} 2> /dev/null | grep '^mail_name' | grep -i 'postfix'` FIND3=$(${POSTCONFBINARY} 2> /dev/null | grep '^mail_name' | grep -i 'postfix')
#YYY Check if OS name shows up in banner #TODO Check if OS name shows up in banner
#FIND4=`${POSTCONFBINARY} 2> /dev/null | grep '^smtpd_banner' | egrep "${OS}|${LINUX_VERSION}` #FIND4=`${POSTCONFBINARY} 2> /dev/null | grep '^smtpd_banner' | egrep "${OS}|${LINUX_VERSION}`
SHOWWARNING=0 SHOWWARNING=0
if [ ! "${FIND1}" = "" ]; then if [ ! "${FIND1}" = "" ]; then
SHOWWARNING=1 SHOWWARNING=1
else else
if [ ! "${FIND2}" = "" -a ! "${FIND3}" = "" ]; then if [ ! "${FIND2}" = "" -a ! "${FIND3}" = "" ]; then
SHOWWARNING=1 SHOWWARNING=1
else else
Display --indent 4 --text "- Checking Postfix banner" --result "${STATUS_OK}" --color GREEN Display --indent 4 --text "- Postfix banner" --result "${STATUS_OK}" --color GREEN
fi fi
fi fi
if [ ${SHOWWARNING} -eq 1 ]; then if [ ${SHOWWARNING} -eq 1 ]; then
Display --indent 4 --text "- Checking Postfix banner" --result "${STATUS_WARNING}" --color RED Display --indent 4 --text "- Postfix banner" --result "${STATUS_WARNING}" --color RED
LogText "Result: found mail_name in SMTP banner, and/or mail_name contains 'Postfix'." LogText "Result: found mail_name in SMTP banner, and/or mail_name contains 'Postfix'."
ReportWarning ${TEST_NO} "L" "Found mail_name in SMTP banner, and/or mail_name contains 'Postfix'" ReportWarning ${TEST_NO} "Found mail_name in SMTP banner, and/or mail_name contains 'Postfix'"
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})" 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})"
fi fi
fi fi