check for common mail subdomains

This commit is contained in:
Matthew Saunders Brown 2023-06-16 09:08:17 -07:00
parent 322bf2a82d
commit 19fc7e41df

View File

@ -99,6 +99,28 @@ fi
# copy above www subdomain section and modify as desired to # copy above www subdomain section and modify as desired to
# automatically check for and add additional subdomains to cert # automatically check for and add additional subdomains to cert
# check common additional mail subdomains
if [[ $domain = mail.* ]]; then
# check for imap subdomain
dns=`host -t A ${domain/mail./imap.}|grep 'has address'|awk '{ print $4 }'`
if [[ " ${ips[@]} " =~ " ${dns} " ]]; then
command="$command -d ${domain/mail./imap.}"
dnscheck=true
fi
# check for smtp subdomain
dns=`host -t A ${domain/mail./smtp.}|grep 'has address'|awk '{ print $4 }'`
if [[ " ${ips[@]} " =~ " ${dns} " ]]; then
command="$command -d ${domain/mail./smtp.}"
dnscheck=true
fi
# check for pop subdomain
dns=`host -t A ${domain/mail./pop.}|grep 'has address'|awk '{ print $4 }'`
if [[ " ${ips[@]} " =~ " ${dns} " ]]; then
command="$command -d ${domain/mail./pop.}"
dnscheck=true
fi
fi
# check if any of the dns lookups passed # check if any of the dns lookups passed
if [[ "$dnscheck" = "false" ]]; then if [[ "$dnscheck" = "false" ]]; then
echo "All dns checks failed, can't create cert." echo "All dns checks failed, can't create cert."