Jun 052016
 
Linode DNS API

When you have those items

  • use Linode to host DNS zones
  • use Let’s Encrypt and use DNS TXT record to proof you own the domain

you should automate the process of renewal certificates since it’s required every 3 months.

Turns out that Linode has an API for DNS changes, and using it is very simple. To look at TXT records like this:

linode domain -a record-show -l studiokubota.com -t TXT

which shows all TXT records. Add “-j” to get JSON output. Filter via jq if you need specific items as the CLI does not seem to be able to filter by itself. jq fixes that:

linode domain -a record-show -l studiokubota.com -t TXT -j | 
  jq '."studiokubota.com".records[] | select(.name=="_acme-challenge.harald")'

Update a particular TXT record like this:

linode domain -a record-update -l studiokubota.com -t TXT -R zXwdu1_lMOdYhAp4cS12JxZV3Wuv1YZG001U3E
mJMck -m _acme-challenge.harald

to update the DNS challenge for harald.studiokubota.com.