From dc5856cb03c8492616bdfe651c3e5428c673202f Mon Sep 17 00:00:00 2001 From: f Date: Tue, 1 Oct 2019 15:28:14 -0300 Subject: [PATCH] www --- certbot.sh | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/certbot.sh b/certbot.sh index 175ff1b..a296938 100644 --- a/certbot.sh +++ b/certbot.sh @@ -36,16 +36,19 @@ case $1 in domain="$(echo "${name}" | sed "s/[^\.]$/&.${SUTTY}/")" domain="${domain%.}" - # Skip already existing domains - test -d "/etc/letsencrypt/live/${domain}" && continue + # Generate a certificate for www also + for d in ${domain} www.${domain}; do + # Skip already existing domains + test -d "/etc/letsencrypt/live/${d}" && continue - # Get the certificate for the domain, the webserver will need - # access to this directory - /usr/bin/certbot certonly --email "certbot@${SUTTY}" \ - --webroot \ - --agree-tos \ - --webroot-path /var/lib/letsencrypt \ - -d "${domain}" + # Get the certificate for the domain, the webserver will need + # access to this directory + /usr/bin/certbot certonly --email "certbot@${SUTTY}" \ + --webroot \ + --agree-tos \ + --webroot-path /var/lib/letsencrypt \ + -d "${d}" + done done # Fix permissions, users in group ssl have read access