Set certdir after requesting

This commit is contained in:
jacob.eva 2023-09-21 19:35:05 +01:00
parent e0de7cef11
commit b0ba4cee74
No known key found for this signature in database
GPG Key ID: 0B92E083BBCCAA1E

View File

@ -22,10 +22,12 @@ for vhost in ${domains[@]}; do # for each vhost
if systemctl is-active --quiet nginx if systemctl is-active --quiet nginx
then then
pacman -S --noconfirm certbot-nginx pacman -S --noconfirm certbot-nginx
certbot -d "$vhost" certonly --nginx --register-unsafely-without-email --agree-tos # request cert with nginx certbot -d "$vhost" certonly --nginx --register-unsafely-without-email --agree-tos &&
certdir[$index]="/etc/letsencrypt/live/$vhost" # request cert with nginx
else else
pacman -S --noconfirm certbot pacman -S --noconfirm certbot
certbot -d "$vhost" certonly --standalone --register-unsafely-without-email --agree-tos # request cert with certbot certbot -d "$vhost" certonly --standalone --register-unsafely-without-email --agree-tos &&
certdir[$index]="/etc/letsencrypt/live/$vhost" # request cert with certbot
fi fi
[ ! -d "$certdir[$index]" ] && echo "Error locating or installing SSL certificate." && exit 1 [ ! -d "$certdir[$index]" ] && echo "Error locating or installing SSL certificate." && exit 1
done done