Certificates via DNS

A Let's Encrypt certificate, including for *.example.nl, with the DNS zone at Servur: the TXT record goes in and comes out again by itself.

New

Version 1 of the API has just opened up for your own scripts, with API keys per workspace. What is between [brackets] we have yet to fill in.

What you need

  • A DNS zone on Servur's nameservers for the certificate's domain.
  • An API key of the workspace with the Manage services permission, preferably for this purpose only.

The script finds the zone that belongs to the domain name, puts the _acme-challenge record in it with the value the certificate authority asks for, and removes it again as soon as the certificate is there.

With acme.sh

Put dns_servur.sh from [the address of the repository with the scripts] in the dnsapi folder of acme.sh. acme.sh remembers the key after the first time, for renewals too.

Terminal
cp dns_servur.sh ~/.acme.sh/dnsapi/
export SERVUR_API_KEY="srv_..."
acme.sh --issue --dns dns_servur -d example.nl -d "*.example.nl"

With certbot

Use servur_hook.py from [the address of the repository with the scripts] as a manual hook. It needs nothing more than Python, which certbot already brings along. After adding the record it waits 30 seconds until the nameservers have it; with SERVUR_WAIT you choose a different time.

Terminal
export SERVUR_API_KEY="srv_..."
certbot certonly --manual --preferred-challenges dns \
  --manual-auth-hook "/usr/local/bin/servur_hook.py auth" \
  --manual-cleanup-hook "/usr/local/bin/servur_hook.py cleanup" \
  -d example.nl -d "*.example.nl"

Building it yourself

For another client three endpoints are enough: GET /v1/dns-zones to find the zone, POST /v1/dns-zones/:zoneId/records with a TXT record to set the challenge, and DELETE /v1/dns-zones/:zoneId/records/:recordId to remove it again. See the endpoints.

Was this helpful?

Everything for your online success, all in one place

Create an account