When updating a wildcard-letsencrypt-certificate you're being asked to deploy a DNS TXT record with some sort of hash-value before continuing with the verification.
Like this:
Please deploy a DNS TXT record under the name
_acme-challenge.my-domain.com with the following value:
fsLb985adfK4wO1jdawkawgk-4QPTTE3k8x110
Before continuing, verify the record is deployed.
Usually i change the entry by hand but i tried to automate it... so i wrote a bash script which first starts certbot - pipes the output in to a tmpfile - cuts the needed hash out of the file - safes it as a variable - then passes the variable to a python script, which then updates my bind zonefile.
Somewhat like this:
certbot -d *.my-domain.com --server https://acme-v02.api.letsencrypt.org/directory --manual --manual-public-ip-logging-ok --preferred-challenges dns certonly > /tmpfile
keystring=$(grep -A 2 '_acme-challenge.my-domain.com with the following value:' /tmpfile | cut -d':' -f2-)
python update-bind-my-domain-wildcard.py $keystring
It works... but not as i expected... if i look up the acme-challange entry with dig i can see the modified TXT record - but hence i first start the certbot and update my zone file with dnspython afterwards - the verification process of letsencrpyt fails.
Dig request (@localhost and @1.1.1.1):
;; ANSWER SECTION:
_acme-challenge.my-domain.com. 300 IN TXT "fsLb985adfK4wO1jdawkawgk-4QPTTE3k8x110"
Letsencrypt verification failure:
Waiting for verification...
Cleaning up challenges
Failed authorization procedure. my-domain.com (dns-01): urn:ietf:params:acme:error:unauthorized :: The client lacks sufficient authorization :: Incorrect TXT record "o7dawgrh3234jTcB9YH-lbI-dEYfdawfFWsRoY" found at _acme-challenge.my-domain.com
...where the "o7dawgrh323xxx"-entry is the old (before running the renewal) DNS TXT value...
So my question is if there is a possibility to skip the initial verification and do some sort of a "certbot verification only" after my dns update went through? Or is there a possibility to break out of the certbot renewal, work off the rest of the script first, and come back to the first verification after the rest of the script passed through? Or maybe an even better/simpler way i haven't thought off?
Thanks in advance
C333D