Automatisch updaten van DANE TLSA records

(English below) Als webhoster is mijn streven om uitsluitend internet.nl compliant webhosting aan te bieden. Dat betekent onder andere dat ik websites voortaan uitsluitend over het veilige HTTPS wil aanbieden. Door de komst van Let’s Encrypt is dat relatief gemakkelijk en ook nog eens gratis, maar toch bleef ik het gebruik ervan steeds uitstellen. Ondanks de hoge vernieuwingsfrequentie van Let’s Encrypt certificaten (90 dagen), is het automatisch vernieuwen van de certificaten volledig te automatiseren met Certbot snel voor elkaar te krijgen. Echter, voor het vernieuwen van de certificaat vingerafdruk (SHA256 hash) in het TLSA record, vond ik geen kant-en-klare oplossing die paste bij mijn implementatie en wensen.

Voor het hergebruiken van hetzelfde sleutelpaar voel ik niet zoveel, en het auto-update-DANE script van Jurrian van Iersel vereist de nodige aanpassingen om het te krijgen zoals ik wil. Dan zelf maar even een uurtje scripten dacht ik. Dat uurtje werden er wat meer, maar na verschillende testronden werkt het precies zoals ik wil. Hieronder de code van het script voor eenieder die erin geïnteresseerd is. Ik heb veel comments in de code toegevoegd om uit te leggen wat er gebeurt. Het script is gericht op DANE-for-web, maar kan met een beetje creativiteit worden omgeschreven naar DANE-for-email. Met iets meer creativiteit is dit script ook te gebruiken voor het automatisch roteren van DKIM sleutels; wellicht iets voor een volgende blogpost. Anyway; happy scripting!

English translation

As a webhoster I would like to solely offer webhosting services which are internet.nl compliant. Amoung other things, this means that all websites will only be offered over HTTPS. Let’s Encrypt makes this relatively easy and while it is offered for free, I still kept postponing it’s usage. Despite the high renewal frequency of Let’s Encrypt certificates (90 days), the renewal proces can be automated using Certbot. However, for the renewal of certificate fingerprints (SHA256 hash) in TLSA records, I did not find an out-of-the-box solution that suited my implementation and matched my criteria. I did not want to reuse the same keypair, and Jurrian van Iersel’s auto-update-DANE script would require some adjustments to get it the way I want it to be. An hour’s work when I script it myself I thought. Eventually it took me several hours, but after some testing it worked exactly as I wanted. The script’s code is shared below for whoever is interested in using it. I’ve added a lot of comments in the code in order to explain what’s happening. The script is made for DANE-for-web, but with some creativity it can quite easily be rewritten to support DANE-for-email. With a little more creativity this script can also be used to automate the rotation of DKIM keys; maybe something for a next blog post. Anyway; happy scripting!

Bash script

Update: the code for this script was placed on GitHub: https://github.com/baaten-ict-security/tlsa-auto-update.  Future updates/changes to this script will be done in the GitHub repository.

2 antwoorden
  1. Marco
    Marco zegt:

    Great to see people are working on this. Interesting approach with regard to rolling the TLSA records. Is it based on the NCSC factsheet perhaps? The method described in ‘https://tools.ietf.org/html/rfc6698#appendix-A.4′ is somewhat different, isn’t it?

    Instead of OpenDNSSEC one could also use BIND’s auto-maintain features for DNSSEC.

    Finally, I would recommend to consider using dynamic updates of the zone, for example by using the ‘nsupdate’ utility of BIND.

    Beantwoorden
  2. Dennis Baaten
    Dennis Baaten zegt:

    After having read appendix A.4 from RFC6698, you could say that this is actually what I’m dong with this script. There is also a similair concept in the NCSC factsheet. The nsupdate utility looks very interesting; I’m planning on taking a closer look at this tool. Nice tip!

    Beantwoorden

Plaats een Reactie

Meepraten?
Draag gerust bij!

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *

Deze site gebruikt Akismet om spam te verminderen. Bekijk hoe je reactie-gegevens worden verwerkt.