sutty sends domains, no need to do conversion

https://0xacab.org/sutty/sutty/-/merge_requests/50
This commit is contained in:
f 2021-08-08 22:18:24 -03:00
parent e82961aafc
commit 03ff181219

View file

@ -33,18 +33,12 @@ 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
domain="$(echo "${name}" | sed "s/[^\.]$/&.${SUTTY}/")"
domain="${domain%.}"
# Generate a certificate for www also
for d in ${domain} www.${domain}; do
# Skip already existing domains # Skip already existing domains
test -d "/etc/letsencrypt/live/${d}" && continue test -d "/etc/letsencrypt/live/${domain}" && continue
# Ignore non local domains # Ignore non local domains
nslookup "${d}" 8.8.8.8 | grep -q "${SUTTY_ADDRESS}" || continue nslookup "${domain}" 8.8.8.8 | grep -q "${SUTTY_ADDRESS}" || continue
# Get the certificate for the domain, the webserver will need # Get the certificate for the domain, the webserver will need
# access to this directory # access to this directory
@ -52,8 +46,7 @@ case $1 in
--webroot \ --webroot \
--agree-tos \ --agree-tos \
--webroot-path /var/lib/letsencrypt \ --webroot-path /var/lib/letsencrypt \
-d "${d}" -d "${domain}"
done
done done
esac esac