Trustworthy DNS and mail
DNSSEC and encrypted DNS
Signed DNS answers, and DNS carried over an encrypted connection to a resolver you chose.
DNSSEC signs DNS answers, so a resolver can detect a forged one; DoH/DoT encrypt the path to the
resolver. A validating resolver sets the ad flag on answers that check out and returns SERVFAIL for ones that
fail (bogus). DNSSEC signs, it does not hide: answers still cross the network in the clear. DoH/DoT hide lookups
from the local network. Neither replaces TLS. Try dig +dnssec example.com.
How DNSSEC works, step by step
In the DNSSEC lab the root, lab and a credit union's fernbank.lab are signed,
tidetimes.lab is not, and a guest laptop on café Wi-Fi can ask the café's hotspot or a validating public resolver
(10.53.2.53). DNSSEC is defined in RFC 4033 to 4035:
- The owner signs the zone with
dnssec-signzone. Every record set (all records of one name and type) gets an RRSIG, made with the zone-signing key (ZSK, DNSKEY flags 256). The key-signing key (KSK, flags 257) signs the DNSKEY set. Signatures carry a validity window, 30 days here, so the zone must be signed again before it ends. - The zone proves what does not exist. Signing adds an NSEC chain: each record names the next name in the zone and the types present, signed. "No such name" and "no such type" become signed statements.
- The parent vouches for the key.
labpublishes a DS forfernbank.lab, the SHA-256 digest of its KSK, and signs it. The links up to the root form the chain of trust. - The resolver asks for the proof. It sets the DO bit (DNSSEC OK) in the EDNS0 header and gets the RRSIGs with the records. It fetches each zone's DNSKEY set and the parent's DS, and checks every link from its trust anchor, the root's key, down to the answer.
- It gives a verdict. Secure: the answer goes out with the
adflag. Insecure: the parent proved with a signed NSEC that the child has no DS, so an unsigned answer is fine, withoutad. Bogus: something that must be signed is not, or does not match, and the client gets SERVFAIL with an Extended DNS Error (RFC 8914).
DNSSEC signs, it does not encrypt. DNS over TLS (RFC 7858, TCP port 853) and DNS over HTTPS (RFC 8484, port
443, path /dns-query) encrypt the hop from a client to its resolver; the
DNS servers lab asks the same name plain and over TLS.
What it looks like on a Linux machine
The public resolver runs unbound; the name servers run BIND. +dnssec asks for the signatures:
$ dig +dnssec +noall +answer @10.53.2.20 online.fernbank.lab
online.fernbank.lab. 60 IN A 10.53.2.40
online.fernbank.lab. 60 IN RRSIG A 13 3 60 20261202181700 20261102181700 8762 fernbank.lab. X2IRyCev…
Type covered, algorithm 13 (ECDSA P-256 with SHA-256), 3 labels, original TTL 60, expiry, inception, key tag,
signer. Key tag 8762 is fernbank.lab's ZSK; its KSK is 29233, and lab vouches for that one:
$ dig +noall +answer @10.53.2.11 DS fernbank.lab
fernbank.lab. 60 IN DS 29233 13 2 EAE87F1564BF44F9481A1A2810877139625539ECC0D267A45D6C6CC9 F2AFA22F
$ dnssec-dsfromkey -2 -f /etc/bind/zones/fernbank.lab.zone fernbank.lab
fernbank.lab. IN DS 29233 13 2 EAE87F1564BF44F9481A1A2810877139625539ECC0D267A45D6C6CC9F2AFA22F
The café's hotspot answers online.fernbank.lab itself, with its own address and flags: qr aa rd ra, no
signature. The validating resolver returns the bank's 10.53.2.40 with flags: qr rd ra ad. delv checks
the chain on the laptop itself, from the root's key in /etc/bind/bind.keys:
$ delv online.fernbank.lab
;; resolution failed: insecurity proof failed
$ delv @10.53.2.53 online.fernbank.lab
; fully validated
online.fernbank.lab. 59 IN A 10.53.2.40
When fernbank.lab's signatures expire, the validating resolver gives SERVFAIL and says why:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 22151
; EDE: 7 (Signature Expired): (validation failure <online.fernbank.lab. A IN>: signature expired from 10.53.2.20 for key fernbank.lab. while building chain of trust)
+cd (checking disabled) asks the resolver to skip validation, which shows the failing data for debugging.
What goes wrong, and how you see it
The signatures expire. Nobody re-signs, the validity window ends, and every name in the zone turns
SERVFAIL at once, with EDE: 7 (Signature Expired). Let the name server sign on a schedule (BIND's
dnssec-policy) instead of by hand.
A key changed, the DS did not. A new KSK without a new DS in the parent breaks the chain: EDE: 6 (DNSSEC Bogus), "no keys have a DS". Publish the new key beside the old one and wait one key-set TTL, compute the DS with
dnssec-dsfromkey -2, publish it in the parent, wait out the old DS's TTL, then retire the old key.
A forged answer arrives. Something on the path answers for the signed zone without signatures. The validator
refuses it: EDE: 10 (RRSIGs Missing). This is DNSSEC doing its job.
The trust anchor is wrong. Every signed name fails, and so do unsigned ones, because proving a zone is unsigned also needs a signature from above. Compare the resolver's trust anchor with the root's real DS.
The clock is wrong. Signatures carry absolute times, so a validator with a bad clock finds valid ones expired or not yet valid. Check NTP before blaming the zone.
Questions people ask
Does DNSSEC encrypt DNS? No. Queries and answers still cross the network in the clear. DNSSEC proves an answer came unchanged from the zone's owner; DoT and DoH hide it from the path.
Does DNSSEC stop DNS spoofing? Between a validating resolver and the authoritative servers, yes: a forged or altered answer for a signed zone is refused. Between the laptop and its resolver it does not, unless the laptop validates itself or uses an encrypted link. See DNS spoofing and the DNS spoofing city.
What does SERVFAIL mean on a signed domain? Often a validation failure. Run the query again with +cd: if an
answer appears, the data is bogus, and the EDE line says why.
Read next
- DNS The distributed directory that turns names like bank.lab into addresses.
- Recursive resolver The DNS server a device asks: it does the whole search and caches the answers.
- DNSSEC chain of trust The run of signed links from the root's key, which a resolver trusts, down to the answer it checks.
- TLS and certificates Encryption plus proof of identity: the server shows a certificate for the name, signed by a trusted authority.
- DNS leak Lookups leaving outside a VPN tunnel, telling the local network every name you visit.
- SPF, DKIM and DMARC Three DNS-published policies that let a receiving mail server check that a message really comes from the domain it claims.
- DNS spoofing A forged DNS answer that sends a name to the attacker's address, believed by a client or cached by a resolver.
- DNS amplification Bouncing small spoofed queries off open resolvers so large answers flood a victim.