Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent TLSFLAGS for mail and ftp from beeing overwritten. #64

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions ssl-cert-check
Original file line number Diff line number Diff line change
Expand Up @@ -643,24 +643,22 @@ usage()
##########################################################################
check_server_status() {

if [ "${TLSSERVERNAME}" = "FALSE" ]; then
TLSFLAG=(s_client -crlf -connect "${1}":"${2}")
else
TLSFLAG=(s_client -crlf -connect "${1}":"${2}" -servername "${1}")
fi

if [ "_${2}" = "_smtp" ] || [ "_${2}" = "_25" ]; then
TLSFLAG="-starttls smtp"
TLSFLAG+=(-starttls smtp)
elif [ "_${2}" = "_ftp" ] || [ "_${2}" = "_21" ]; then
TLSFLAG="-starttls ftp"
TLSFLAG+=(-starttls ftp)
elif [ "_${2}" = "_pop3" ] || [ "_${2}" = "_110" ]; then
TLSFLAG="-starttls pop3"
TLSFLAG+=(-starttls pop3)
elif [ "_${2}" = "_imap" ] || [ "_${2}" = "_143" ]; then
TLSFLAG="-starttls imap"
TLSFLAG+=(-starttls imap)
elif [ "_${2}" = "_submission" ] || [ "_${2}" = "_587" ]; then
TLSFLAG="-starttls smtp -port ${2}"
else
TLSFLAG=""
fi

if [ "${TLSSERVERNAME}" = "FALSE" ]; then
TLSFLAG=(s_client -crlf -connect "${1}":"${2}")
else
TLSFLAG=(s_client -crlf -connect "${1}":"${2}" -servername "${1}")
TLSFLAG+=(-starttls smtp -port "${2}")
fi

echo "" | "${OPENSSL}" "${TLSFLAG[@]}" 2> "${ERROR_TMP}" 1> "${CERT_TMP}"
Expand All @@ -686,6 +684,9 @@ check_server_status() {
elif "${GREP}" -i "Name or service not known" "${ERROR_TMP}" > /dev/null; then
prints "${1}" "${2}" "Unable to resolve the DNS name ${1}" "Unknown"
set_returncode 3
elif "${GREP}" -i "unsupported protocol" "${ERROR_TMP}" > /dev/null; then
prints "${1}" "${2}" "Unsupported SSL/TLS protocol" "Unknown"
set_returncode 3
else
check_file_status "${CERT_TMP}" "${1}" "${2}"
fi
Expand Down