diff options
author | lowkey <dvehrs@gmail.com> | 2019-05-23 23:31:36 +0300 |
---|---|---|
committer | lowkey <dvehrs@gmail.com> | 2019-05-23 23:31:36 +0300 |
commit | a271cb90c89a22da56b344d4bf7787c426d97f4a (patch) | |
tree | e1b52c6f4d15b701c593f8e7bb5b03ee2248e447 /include/tests_mail_messaging | |
parent | 8e61275ff496c4b2170379410106ebc5e903e1ef (diff) |
Added certificate tests for Exim
Diffstat (limited to 'include/tests_mail_messaging')
-rw-r--r-- | include/tests_mail_messaging | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/include/tests_mail_messaging b/include/tests_mail_messaging index b74a7c5e..e740eaf8 100644 --- a/include/tests_mail_messaging +++ b/include/tests_mail_messaging @@ -161,6 +161,83 @@ LogText "Result: Private Key not set." Display --indent 4 --text "- Private Key not set" --result "${STATUS_WARNING}" --color WHITE fi + + LogText "Test: Exim Verify Certificates" + + case "${EXIM_TYPE}" in + "INTERNET HOST" | "SMARTHOST" ) + EXIM_CERTIFICATES=$(exim -bP tls_verify_certificate | cut -d '=' -f2 | sed -e 's/^\s*//' -e 's/\s*$//') + ;; + "SATELLITE" ) + EXIM_CERTIFICATES=$(exim -bP transport remote_smtp_smarthost | grep tls_verify_certificate | cut -d '=' -f2 | sed -e 's/^\s*//' -e 's/\s*$//') + ;; + esac + + case "${EXIM_CERTIFICATES}" in + "") + # This condition results in a RED warning because it should + # never be hit. + LogText "Result: Verify Certificates not set" + Display --indent 4 --text "- Verify Certificates not set" --result "${STATUS_WARNING}" --color RED + ;; + "system") + # This is the default setting and should be the most common. + LogText "Result: Verify Certificates set to system default" + Display --indent 4 --text "- Verify Certificates" --result "DEFAULT" --color WHITE + ;; + *) + # This condition should only be hit when it has been set to + # a custom value. + LogText "Result: Verify Certificates set to \"${EXIM_CERTIFICATES}\"" + Display --indent 4 --text "- Verify Certificates" --result "CUSTOM" --color GREEN + ;; + esac + + + case "${EXIM_TYPE}" in + "INTERNET HOST" | "SMARTHOST" ) + EXIM_VERIFY_HOSTS=$(exim -bP tls_verify_hosts | cut -d '=' -f2 | sed -e 's/^\s*//' -e 's/\s*$//') + EXIM_TRY_VERIFY_HOSTS=$(exim -bP tls_try_verify_hosts | cut -d '=' -f2 | sed -e 's/^\s*//' -e 's/\s*$//') + ;; + "SATELLITE" ) + EXIM_VERIFY_HOSTS=$(exim -bP transport remote_smtp_smarthost | grep tls_verify_hosts | cut -d '=' -f2 | sed -e 's/^\s*//' -e 's/\s*$//') + EXIM_TRY_VERIFY_HOSTS=$(exim -bP transport remote_smtp_smarthost | grep tls_try_verify_hosts | cut -d '=' -f2 | sed -e 's/^\s*//' -e 's/\s*$//') + ;; + esac + + LogText "Test: Exim Try Verify Hosts" + if [ ! -z "${EXIM_TRY_VERIFY_HOSTS}" ]; then + case "${EXIM_TYPE}" in + "INTERNET HOST" ) + LogText "Result: Try Verify Hosts enabled." + Display --indent 4 --text "- Try Verify Hosts" --result "ENABLED" --color GREEN + ;; + "SATELLITE" | "SMARTHOST" ) + LogText "Result: Try Verify Hosts." + Display --indent 4 --text "- Try Verify Hosts" --result "ENABLED" --color YELLOW + ;; + esac + else + LogText "Result: Try Verify Hosts not enabled." + Display --indent 4 --text "- Try Verify Hosts" --result "NOT ENABLED" --color WHITE + fi + + LogText "Test: Exim Verify Hosts" + if [ ! -z "${EXIM_VERIFY_HOSTS}" ]; then + case "${EXIM_TYPE}" in + "INTERNET HOST" ) + LogText "Result: Verify Hosts." + Display --indent 4 --text "- Verify Hosts" --result "ENABLED" --color YELLOW + ;; + "SATELLITE" | "SMARTHOST" ) + LogText "Result: Verify Hosts." + Display --indent 4 --text "- Verify Hosts" --result "ENABLED" --color GREEN + ;; + esac + else + LogText "Result: Verify Hosts." + Display --indent 4 --text "- Verify Hosts" --result "NOT ENABLED" --color WHITE + fi fi fi |