Contents of this article
- First, a letter going out
- The pass at the door: what a certificate really is
- Why encryption drops away so easily with mail
- TLSA: the note on the door
- Why that second digit is about maintenance
- The foundation: why DNSSEC is not optional
- The outage you will run into at some point
- Who actually looks at that note?
- CAA: who is allowed to make a pass at all?
- The two side by side
- Seeing for yourself what's there
- What we don't do
- Frequently asked questions
- Further reading
Two DNS records that together answer one question: who is allowed to issue a certificate for your domain, and which certificate should be presented? This article explains it without you needing a computer science degree.
First, a letter going out
Say you send an email to someone at another company. What actually happens looks nothing like what you see. Your mail server first looks in the internet's phone book (that is DNS) and asks: where is mail for this domain delivered? It gets an address back, goes there, knocks, and hands your message over to the server that answers the door.
Two assumptions are hidden in that story, and both are weaker than you would hope. The first: that the answer from the phone book is correct. The second: that whoever answers the door really is who they claim to be.
The rest of this article is about that second assumption, and about the two records you can use to do something about it. But we will come back to the first one, because without that foundation the rest is decoration.
The pass at the door: what a certificate really is
When your mail server connects to the receiving server, that conversation is encrypted. To do that, the receiving server shows a certificate. You can think of it as a pass: it has a name on it, and it is signed by a party vouching that the name is correct. Such a party is called a certificate authority, CA for short; in this picture it is the pass factory. Let's Encrypt is one, and there are dozens worldwide.
The pass belongs to a key. The certificate contains the public half of a key pair; the private half lives on the server and never leaves it. Only whoever holds that private half can prove the pass is theirs. That is the whole mechanism: it is not the paper that counts, but that someone can show they hold the matching key.
And that second assumption has exactly two weak spots. One: there are dozens of CAs, and in principle each of them may issue a pass with your name on it. Two: your sending server has no idea which pass it should expect, so it believes any pass with a valid signature on it.
TLSA deals with the second problem, CAA with the first. We take them in that order, because the second problem is most visible with mail.
Why encryption drops away so easily with mail
With a website you notice straight away when something is wrong: the padlock disappears, or the browser throws a warning in your face. Mail servers talking to each other don't have that luxury. They speak SMTP, a protocol designed at a time when encryption wasn't yet a concern. Encryption was added later, with a command called STARTTLS, and that command is an offer: the receiving server says "I can encrypt", and the sender takes it up on that.
An offer can be taken away. Someone sitting between those two servers removes the STARTTLS offer from the conversation, and the sending server sees a recipient that apparently can't encrypt. The mail then simply goes through unencrypted. No warning appears, because nobody noticed anything odd: there was never anything else in the conversation.
That is the gap. Not that the encryption gets cracked, but that it is politely switched off and nobody notices.
TLSA: the note on the door
TLSA solves this with a surprisingly simple idea. You add a note to that phone book saying which pass the receiving server should show. A sender that reads the note now knows two things it didn't know before: that encryption must be used, and which certificate belongs with it. If something else is shown, or nothing at all, the mail is not delivered.
The note isn't stored at your domain but at the mail server your MX record points to: the record that says where mail for your domain is delivered. Its name contains the port and the protocol:
_25._tcp.mail.voorbeeld.nl. IN TLSA 3 1 1 <fingerprint>Port 25 is the port mail servers use to talk to each other; TCP is the protocol. Then come three digits and a long string of characters. Those three digits are what makes most explanations incomprehensible, so here they are in plain language:
- The first digit says what is being compared. With
3, the note points directly at the server's own pass. No detour via the question of which CA issued it: this pass, full stop. This is called DANE-EE, after DANE: the name of the technique that ties certificates to DNS. - The second digit says how the pass is recognised. With
1, it isn't about the pass itself but about the key inside it. That looks like a detail, but it is the most important part of the record; you will read why further down. - The third digit says how it is shortened. With
1, a fingerprint is made using SHA-256. That fingerprint is the long string of characters after it.
Hence 3 1 1. That isn't simply the most popular combination: RFC 7672, the standard describing DANE for mail, explicitly recommends this combination for SMTP servers. The two variants that also want to rely on the public list of trusted CAs are advised against there: mail servers don't share a usable list like that among themselves.
Why that second digit is about maintenance
Certificates expire. Let's Encrypt's do so after ninety days, and they are renewed automatically. If the note contained the fingerprint of the pass, it would stop matching after every renewal, because a new pass has a new fingerprint. You would then have to update DNS at every renewal as well, on time, without mistakes, year after year.
By taking the fingerprint of the key instead, that problem largely disappears. A certificate can be reissued on the same key, and the fingerprint then stays the same. The note keeps matching without anyone having to touch it.
This is also why DANE-EE does something counter-intuitive: a sender that goes by this note ignores the certificate's expiry date and doesn't check whether the name on it is correct. That sounds like a relaxation, but it is a shift: validity no longer comes from the CA but from the signature on your DNS. Which brings us to the foundation.
The foundation: why DNSSEC is not optional
Go back for a moment to the first assumption, the one we left aside: that the answer from the phone book is correct. If a note on the door decides whether mail gets delivered, the next question is unavoidable: who can put up a note? If an attacker can remove or replace yours, you have only moved the problem.
DNSSEC is the answer: it puts a digital signature on your DNS answers, so a recipient can check that what it reads really comes from you. Without that signature, a TLSA record isn't security but a suggestion.
And that is not a theoretical objection, because DANE for mail is deliberately opportunistic. If a sender finds no signed TLSA record, it doesn't refuse; it does exactly what it used to do and delivers however it can. An attacker who removes your unsigned note therefore causes no outage that anyone notices. They switch the security off, quietly, and that was exactly the attack you wanted to defend against.
So the order is non-negotiable: first sign the zone with DNSSEC (the zone is everything in DNS for your domain), and only then add TLSA. The other way round is work without any payoff. The same applies one step earlier in the chain, by the way: the MX lookup itself must be signed too, otherwise an attacker simply points you at their own mail server, with a matching note on that door.
The outage you will run into at some point
Now the honest part, because this record can also stop your mail. Almost every DANE outage happens the same way: a certificate is renewed with a new key, while DNS still holds the fingerprint of the old one. From that moment on, every sender that checks refuses to deliver.
The nasty part is the timing. The outage doesn't come on the day you switch the record on: everything still matches then. It comes at the first automatic certificate renewal, two or three months later, when nobody is thinking about that record any more and it has long been "done".
The mail does explicitly not end up in a spam filter. The standard requires such a sender not to fall back to unprotected delivery; that would undermine the whole point. The mail is first deferred and stays in the queue. Microsoft, for example, keeps trying for another day and only then sends an error back to the sender. Worse: because by no means every sender checks, part of your mail still arrives. So you don't notice it from an empty inbox, but from a customer saying they haven't heard from you in days.
There are two ways to prevent this, and they don't exclude each other. The first is keeping the key when renewing, because then the fingerprint doesn't change. The second is a clean transition: publish the new record alongside the old one, wait at least twice the TTL (the lifetime you give the record yourself) so the old copies have expired everywhere in the world, only then put the new certificate live, and remove the old record after that. That order is described in RFC 7671, the document with the operational guidelines for DANE.
Who actually looks at that note?
A fair question, because a note nobody reads changes nothing. The answer: enough parties to make it worthwhile, but by no means everyone.
Microsoft checks it for outgoing mail from Exchange Online, by default and for all customers. Google doesn't publish support for DANE and relies on MTA-STS, a different approach to the same problem. In the other direction Google is out of the picture too: the zones of google.com and gmail.com themselves aren't signed with DNSSEC, so if you send mail to Gmail, there is no note there to go by. You can verify this with a DS lookup: it shows whether a zone is signed.
In the Netherlands the bar is higher than elsewhere. For government bodies, the combination of STARTTLS and DANE has been on the comply-or-explain list of the Dutch Standardisation Forum (Forum Standaardisatie) (in Dutch) since 2016, and since 2018 for sending servers as well. You can see this in the records: look at the mail servers of the Dutch Tax Administration (Belastingdienst) or the police, and you will simply find TLSA records there. If you supply that market, DANE isn't a curiosity but a requirement; the questions to ask your host about it are in DANE at your host.
CAA: who is allowed to make a pass at all?
Time to come back to that other weak spot, because it is separate from mail and affects your website just as much. There are dozens of certificate authorities worldwide, and without further measures each of them may issue a certificate with your domain name on it. Not because they do so casually, but because nothing stops them. One CA that is misled or makes a mistake in its checks, and someone else holds a valid pass with your name on it.
CAA is the sign at the factory rather than at the door. You put in DNS which CAs may issue for your domain, and every CA is required to read it before issuing a certificate. That is not a voluntary arrangement: since 8 September 2017 it has been part of the Baseline Requirements of the CA/Browser Forum, the rules publicly trusted CAs must follow. What exactly a CAA record may contain is set out in RFC 8659.
This is what it looks like, and this is the real record of hostage.nl, so you can check it:
hostage.nl. IN CAA 0 issue "letsencrypt.org"
hostage.nl. IN CAA 0 issuewild "letsencrypt.org"
hostage.nl. IN CAA 0 iodef "mailto:security@hostage.nl"The first line says: only Let's Encrypt may issue certificates for this domain. The second does the same for wildcard certificates, the type that covers all subdomains at once. The third is an address where we want to be notified if a CA refuses a request: a free warning that someone tried to obtain a certificate in our name.
What CAA does not do
This is where expectations often go wrong. CAA works only at the moment of issuance, at the CA. It doesn't invalidate a certificate that already exists, and browsers never look at it. So it is prevention, not protection after the fact. For the latter there is Certificate Transparency, the public log in which issued certificates are recorded, so you can see afterwards what was created in your name. The two complement each other.
Two pitfalls you can avoid
The first is the lookup order. A CA starts at the full name and climbs up: first www.voorbeeld.nl, then voorbeeld.nl, and it stops at the first level where there is any CAA record at all. That is handy (one record on your main domain covers all subdomains), but it also works the other way. If you put only an iodef line on a subdomain, the CA stops there, finds no restriction whatsoever, and anyone may issue again. The subdomain record then doesn't add to the main domain's rule, it overrides it.
The second is in issuewild. If you leave it out, your regular issue rule also applies to wildcards and all is well. But as soon as there is a single issuewild line, all issue lines are ignored for a wildcard request. If you add issuewild for one CA alongside issue for another, you quietly lock that other one out.
And finally, the classic: setting a CAA record for the CA you use today, switching a year later, and then not understanding why the new supplier can't issue a certificate. If you change CA, change the record first. Keep in mind that a CA may reuse its validation for some time, so a correction doesn't always take effect immediately.
The two side by side
Back to where we started. Both records live in DNS, both are about certificates, and they do completely different things:
| CAA | TLSA | |
|---|---|---|
| Answers | Who may create a certificate? | Which certificate should be presented? |
| Read by | The certificate authority, before issuance | The sending mail server, on every delivery |
| Lives on | Your domain itself | The mail server your MX points to |
| DNSSEC needed? | Strongly recommended, and CAs now check it where present | Yes, without DNSSEC it is pointless |
| If it's wrong | You can no longer get a new certificate | Your mail is no longer delivered |
That last row is also the advice on the order. A wrong CAA record is something you notice yourself, at a moment when you are busy with it anyway. A wrong TLSA record is something your customers notice, at a moment when you aren't busy with anything. So start with DNSSEC and CAA, and only add TLSA once renewing your certificates is sorted out.
Seeing for yourself what's there
You don't need to install anything to see whether this is in order for your own domain. The email test at internet.nl checks DNSSEC, DANE, SPF, DKIM and DMARC in one go and shows per item what is missing. It is an initiative backed by, among others, the Dutch government and SIDN (the registry for .nl), and in the Dutch market the result is in practice treated as a report card.
If you want to see the records yourself, you can also do that in our DNS editor: it supports both CAA and TLSA and pre-fills the usual 3 1 1 for a new TLSA record, so you don't have to remember it.
What we don't do
We are not writing here that we offer DANE, because at the moment we don't. Our own zone is signed with DNSSEC and has a CAA record, but there is no TLSA on our MX records. That is because our mail chain still contains a filter we inherited from an acquisition, and it doesn't publish TLSA. We are moving away from it; it is high on the list, and there is internal infrastructure attached to it that has to move along cleanly.
You can check this yourself, and that is exactly why we write it down here instead of talking around it. A host that explains how DANE works while pretending to have it already deserves the scrutiny that follows.
Frequently asked questions
What is the difference between a CAA and a TLSA record?
A CAA record determines which certificate authorities may issue a certificate for your domain; it is read by that authority, before issuance. A TLSA record states which certificate should be presented on your mail server; it is read by the sending mail server, on every delivery. The first is a sign at the factory, the second a check at the door.
Why does a TLSA record say 3 1 1?
Those three digits mean: point directly at the server's certificate, recognise it by the public key rather than by the certificate itself, and compare using a SHA-256 fingerprint. RFC 7672 recommends this combination for mail servers. Recognising it by the key is the most important part: that way the record keeps matching when the certificate is renewed on the same key.
Do I need DNSSEC for a TLSA record?
Yes. Without a signed zone, an attacker can remove or replace the TLSA record, and then exactly the protection you wanted disappears. With an unsigned answer, senders simply fall back to the old way of working, without a warning. So sign the zone first, and only then publish TLSA.
Can a TLSA record stop my email?
Yes, and that is by design. If the record doesn't match what the server presents, a checking sender doesn't deliver and doesn't fall back to unprotected traffic either. The mail is first deferred and then bounces back to the sender as undeliverable. This almost always happens when a certificate is renewed with a new key while the old record stays in place.
Does a CAA record block a certificate that has already been issued?
No. CAA only works at the moment of the request, at the certificate authority. A certificate that already exists isn't invalidated by it, and browsers don't look at your CAA record. To see what has been issued in your name in the past, use Certificate Transparency.
Further reading
Was this article helpful?
Thank you for your feedback.
Thank you. What were you missing? Let us know at support@hostage.nl and we will add it to the article.
Related articles
Still stuck?
Send us a message. We will help you, usually within one working day.