summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2020-09-11 08:35:58 -0400
committerLuke Smith <luke@lukesmith.xyz>2020-09-11 08:35:58 -0400
commit7295f6ae8118ec38153b44256a0dad113bec44c0 (patch)
tree259529120c3d511c869e0bec3f74033371492324
parentab2a2f0d89da5229b71fec573a1f20a8d8e3d44a (diff)
guess proper cert if mail subdomain not available
-rwxr-xr-xemailwiz.sh4
1 files changed, 3 insertions, 1 deletions
diff --git a/emailwiz.sh b/emailwiz.sh
index 7565ba1..da81ab5 100755
--- a/emailwiz.sh
+++ b/emailwiz.sh
@@ -42,7 +42,9 @@ subdom="mail"
maildomain="$subdom.$domain"
certdir="/etc/letsencrypt/live/$maildomain"
-[ ! -d "$certdir" ] && echo "Note! You must first have a HTTPS/SSL Certificate for $maildomain.
+[ ! -d "$certdir" ] && certdir="$(dirname "$(certbot certificates 2>/dev/null | grep "$maildomain" -A 2 | awk '/Certificate Path/ {print $3}')")"
+
+[ ! -d "$certdir" ] && echo "Note! You must first have a Let's Encrypt Certbot HTTPS/SSL Certificate for $maildomain.
Use Let's Encrypt's Certbot to get that and then rerun this script.