After various breaches at the certificate authorities it has become clear that we need a way to authenticate a server certificate without the need to trust a third party. “DNS-based Authentication of Named Entities“ (DANE) makes this possible by publishing the certificate in the DNS. Find more information about DANE here.
In this tutorial we show an example implementation of DANE for email delivery.
What you need
- a DNSSEC capable nameserver (in this example: powerdns)
- a DNSSEC capable registrar (in this example: gandi.net)
- a mail server with TLS Support (in this example: postfix )
- to test the secured email delivery: a second mailserver with DANE support ( postfix >=2.11, DNSSEC capable resolver )
in this state, a sending server can encrypt the transmission, but it can not verify the self-signed server certificate, so it will treat the TLS connection as anonymous:
postfix/smtp: Anonymous TLS connection established to mail.example.com[...]:25: TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)In order to enable DANE support, our domain’s DNS zone must be secured with DNSSEC. Our example domain is hosted on a powerdns authoritative server securing a zone on a current powerdns is pretty easy:
The key from the last command must be copied to the registrar. At gandi.net the form to add a DNSSEC key looks like this:
Once the key is added and synchronized on the registry’s DNS servers, you can test DNSSEC funconality at http://dnssec-debugger.verisignlabs.com/
Now, back on the mailserver hosting our domain we have to create a hash of the SSL-certificate:
Using this value we can add the DANE TLSA record for our mailserver in the DNS zone:
In powerdns, add a record:
|Name||_25._tcp.mail.example.com (replace mail.example.com with your real mx hostname)|
|Content||3 0 1 02059728e52f9a58a235584e1ed70bd2b51a44024452ec2ba0166e8fb1d1d32b|
the “3 0 1” means: “we took a full domain-issued certificate, and created a sha256 hash of it”. For other possible values see RFC6698 section 7.2 – 7.4.
Now we can test the new DANE TLSA records at https://www.tlsa.info
And finally, let’s test it from another postfix box. For this to work, the sending server must use a DNSSEC resolver (for example unbound) and postfix >=2.11 with DANE enabled:
and voilà, our connection is now verified even though we’re using a self-signed certificate:
postfix/smtp: Verified TLS connection established to mail.example.com[...]:25: TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)