sutty sends domains, no need to do conversion
https://0xacab.org/sutty/sutty/-/merge_requests/50
This commit is contained in:
parent
e82961aafc
commit
03ff181219
1 changed files with 12 additions and 19 deletions
31
certbot.sh
31
certbot.sh
|
@ -33,27 +33,20 @@ case $1 in
|
||||||
"https://api.${SUTTY}/v1/sites.json" \
|
"https://api.${SUTTY}/v1/sites.json" \
|
||||||
2>"${headers}" \
|
2>"${headers}" \
|
||||||
| jq --raw-output .[] \
|
| jq --raw-output .[] \
|
||||||
| while read name; do
|
| while read domain; do
|
||||||
# If the site name doesn't end with a dot, it's a subdomain
|
# Skip already existing domains
|
||||||
domain="$(echo "${name}" | sed "s/[^\.]$/&.${SUTTY}/")"
|
test -d "/etc/letsencrypt/live/${domain}" && continue
|
||||||
domain="${domain%.}"
|
|
||||||
|
|
||||||
# Generate a certificate for www also
|
# Ignore non local domains
|
||||||
for d in ${domain} www.${domain}; do
|
nslookup "${domain}" 8.8.8.8 | grep -q "${SUTTY_ADDRESS}" || continue
|
||||||
# Skip already existing domains
|
|
||||||
test -d "/etc/letsencrypt/live/${d}" && continue
|
|
||||||
|
|
||||||
# Ignore non local domains
|
# Get the certificate for the domain, the webserver will need
|
||||||
nslookup "${d}" 8.8.8.8 | grep -q "${SUTTY_ADDRESS}" || continue
|
# access to this directory
|
||||||
|
/usr/bin/certbot certonly --email "certbot@${SUTTY}" \
|
||||||
# Get the certificate for the domain, the webserver will need
|
--webroot \
|
||||||
# access to this directory
|
--agree-tos \
|
||||||
/usr/bin/certbot certonly --email "certbot@${SUTTY}" \
|
--webroot-path /var/lib/letsencrypt \
|
||||||
--webroot \
|
-d "${domain}"
|
||||||
--agree-tos \
|
|
||||||
--webroot-path /var/lib/letsencrypt \
|
|
||||||
-d "${d}"
|
|
||||||
done
|
|
||||||
done
|
done
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue