Automate Let's Encrypt Wildcard Certificate creation with Ionos DNS Rest API.
# if you install it elsewhere, remember to change paths in below examples
cd ~
git clone https://github.com/timephy/certbot-dns-ionos
First enable and create an API key under https://developer.hosting.ionos.de
Set these variables before running certonly
or renew
commands.
MAIL=<your_mail>
API_KEY=<publicprefix>.<secret>
# for single certonly
DOMAIN=<your_domain>
# for multiple certonly
DOMAINS=(<your_domain1> <your_domain2> <your_domain3>)
docker run -i --rm \
-v /etc/letsencrypt:/etc/letsencrypt \
-v ~/certbot-dns-ionos:/tmp/scripts \
-e "API_KEY=$API_KEY" \
certbot/certbot \
certonly \
--keep-until-expiring \
--preferred-challenges dns \
--non-interactive \
--agree-tos \
--manual \
--manual-auth-hook /tmp/scripts/authenticate.sh \
--manual-cleanup-hook /tmp/scripts/cleanup.sh \
-m $MAIL \
-d $DOMAIN,*.$DOMAIN
or for multiple certificates:
for DOMAIN in ${DOMAINS[@]}
do
docker run -i --rm \
-v /etc/letsencrypt:/etc/letsencrypt \
-v ~/certbot-dns-ionos:/tmp/scripts \
-e "API_KEY=$API_KEY" \
certbot/certbot \
certonly \
--keep-until-expiring \
--preferred-challenges dns \
--non-interactive \
--agree-tos \
--manual \
--manual-auth-hook /tmp/scripts/authenticate.sh \
--manual-cleanup-hook /tmp/scripts/cleanup.sh \
-m $MAIL \
-d $DOMAIN,*.$DOMAIN
done
No -d $DOMAIN
to renew all domains.
docker run -i --rm \
-v /etc/letsencrypt:/etc/letsencrypt \
-v ~/certbot-dns-ionos:/tmp/scripts \
-e "API_KEY=$API_KEY" \
certbot/certbot \
renew \
--keep-until-expiring \
--preferred-challenges dns \
--non-interactive \
--agree-tos \
--manual \
--manual-auth-hook /tmp/scripts/authenticate.sh \
--manual-cleanup-hook /tmp/scripts/cleanup.sh \
-m $MAIL
Lists your certificates.
docker run -i --rm \
-v /etc/letsencrypt:/etc/letsencrypt \
-v ~/certbot-dns-ionos:/tmp/scripts \
certbot/certbot \
certificates