Let's Encrypt Wildcard Certificates

Using acme.sh
Since the certbot gandi dns plugin has been giving issues over the past months (no smooth renewal, leading to unavailability of sites) we started moving things to acme.sh. Seems to work better, easier to setup etc.

Install the bash script
wget https://get.acme.sh

As root:

sh acme.sh

This will install the script to /root/ and add it to path

Request a wildcard cert for lurk.org
first find and export the gandi dns key:

export GANDI_LIVEDNS_KEY="fdmlfsdklmfdkmqsdfk"

Then request a wildcard cert. (the dns key is added to a config file automatically for future renewals)

acme.sh --issue --dns dns_gandi_livedns --nginx -d *.lurk.org

Find the certs in:

/root/.acme.sh/\*.lurk.org/

Migration status
Done:


 * VMB (nginx, masto, icecast)

To do:


 * agnes (nginx, prosody, mm3)
 * douglas (???)

= N.B. everything below is for archival reference =

Base installation
apt install python-pip pip install wheel pip install certbot

Gandi
'''NOTE: At time of writing, only an API key from the domain owner will work. So another account, even if listed technical contact, will not able to use the live DNS API, just the live DNS web interface. Since the writing of this HOWTO, there is now this as well https://github.com/obynio/certbot-plugin-gandi TODO'''

pip install 'git+https://gitlab.com/cspublic/certbot-plugin-gandi.git' mkdir /etc/certbot-plugin-gandi certbot_plugin_gandi:dns_api_key=APIKEY chmod 600 /etc/certbot-plugin-gandi/gandi.ini '''NOTE: At time of writing, the default sever end point used by cerbot (0.22) is not compatible with ACME v2, as a workaround --server must be passed manually. Next version of certbot should point to the right server''' /usr/local/bin/certbot certonly -a certbot-plugin-gandi:dns --certbot-plugin-gandi:dns-credentials /etc/certbot-plugin-gandi/gandi.ini -d mydomain.blabla -d *.mydomain.blabla --server https://acme-v02.api.letsencrypt.org/directory '''NOTE: At time of writing, certbot-plugin-gandi seems to behave a bit funnily when asked to request a challenge for a wildcard cert (it works flawslessly for regular domains). It might be needed to run the command several times to get the infamous CONGRATULATION message from certbot.''' /etc/letsencrypt/live/mydomain.blabla/fullchain.pem /etc/letsencrypt/live/mydomain.blabla/privkey.pem
 * Get API key from Gandi (somewhere in account settings)
 * install certbot-plugin-gandi
 * create /etc/certbot-plugin-gandi/gandi.ini with the following:
 * a bit of paranoia
 * request certificate for both mydomain.blabla and *.mydomain.blabla
 * If all goes well certs will be there:

Renewal
To non-interactively renew *all* of your certificates: /usr/local/bin/certbot renew

agnes
TODO: hooks! service nginx restart prosodyctl reload