DNS Privacy Project

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5

This page is a work in progress!!

This page contains some details on how to renew certificates with Let's Encrypt using the same key, which is very helpful in supporting authentication via a SPKI pinset. Thanks to Willem Toorop and Ralph Dolmans at NLnet Labs for developing this!

Manual renewal

  1. Create your new CSR from your existing private key using 'openssl req'

    opensssl req -new -key <my_key_file>
  2. Use the certbot interface to renew the cert, for example using web authenticaiton 

    certbot certonly -d getdnsapi.net --csr /usr/local/certs/getdnsapi.net.csr --webroot -w /home/website/public

    or using dns challenge

    certbot certonly -d getdnsapi.net --csr /usr/local/certs/getdnsapi.net.csr --preferred_challenges dns --manual

Automated renewal

https://dehydrated.de/  is a great tool for automating the renewal workflow, particularly if you want to use the DNS challenge method, rather than web access. 

  • An example configuration file is:



  • Private keys are then stored in

  • The SubjectAltNames are then enumerated in the file


    Add one line in this for each 'group' of names that should share a certificate e.g

    example.com www.example.com example.org
    example1.com www.example1.com example1.net
  • Then the challenge record needs to be provisioned in the corresponding zone in a record of the form

    _acme-challenge.<domain name>

  • If you have many zones it can be helpful to use CNAMES to redirect to a single zone that can hold the acme_challenge records e.g. <domain>.acme.example.com

    The domain acme.example.com is then hosted only on the server that also runs dehydrated. 

  • A script can then be used to deploy and clean the challenge in this domain. An example script is included below

    deploy_challenge() {
       local DOMAIN="${1}" RDATA="${3}"
       echo "$DOMAIN 10 TXT \"$RDATA\"" >> $zonefile
       echo "$DOMAIN 10 TXT \"$RDATA\""
       ldns-read-zone $zonefile > /dev/null
       if [ $? -eq 0 ]; then
           cp $zonefile ~/unsigned/acme.example.com
           ods-signer sign acme.example.com
           sleep .5
    clean_challenge() {
       local DOMAIN="${1}" RDATA="${3}"
       sed -i ".old" "/$DOMAIN 10 TXT \"$RDATA\"/d" $zonefile
       ldns-read-zone $zonefile > /dev/null
       if [ $? -eq 0 ]; then
           cp $zonefile ~/unsigned/acme.example.com
           ods-signer sign acme.example.com
    deploy_cert() {
       local DOMAIN="${1}" KEYFILE="${2}" CERTFILE="${3}"
       # nothing yet..
    unchanged_cert() {
       local DOMAIN="${1}" KEYFILE="${2}" CERTFILE="${3}"
       # nothing yet..
    HANDLER="$1"; shift
    "$HANDLER" "$@"
  • No labels