fix: some renewal files where missing (??)

This commit is contained in:
f 2024-06-14 18:39:39 -03:00
parent 67ca76f7f1
commit 919706b80e
No known key found for this signature in database

View file

@ -89,10 +89,27 @@ case $1 in
2>"${headers}" \
| jq --raw-output .[] \
| while read domain; do
if test -z "${domain}"; then
echo "not ok - domain is empty" >&2
continue
fi
# Skip already existing domains
if test -f "/etc/letsencrypt/renewal/${domain}.conf"; then
if test -s "/etc/letsencrypt/renewal/${domain}.conf"; then
echo "ok - ${domain} already issued" >&2
continue
else
echo "ok - ${domain} renewal conf was empty, fixing..." >&2
other_renewal="$(grep -l -m 1 "^authenticator = webroot$" /etc/letsencrypt/renewal/*.conf | head -1)"
if test -z "${other_renewal}"; then
echo "not ok - ${domain} couldn't fix" >&2
ensure 1
fi
other_domain="$(basename "${other_renewal}" .conf)"
sed -re "s/${other_domain}/${domain}/g" "${other_renewal}" > "/etc/letsencrypt/renewal/${domain}.conf"
fi
# Ignore non local domains