The idea
A plain DNS answer is a name and an address, with nothing to show who wrote it. DNSSEC signs every answer, and each zone's key is vouched for by the zone above, up to the root, whose key your device already holds. A forged answer breaks the chain somewhere, and a Recursive resolver that checks says so.
Steps
-
The café answers for the bank
Petra is in a café, on its Wi-Fi, about to check her account at Fernbank Credit Union,
online.fernbank.lab. Her laptop,guestLaptop, joined the café's Wi-Fi hotspot,hotspot, and took its settings from it, so the hotspot is also her Recursive resolver: every name she looks up, it answers.This hotspot cheats. For every name but one it asks
publicResolver, a big public resolver, and passes the answer on. Foronline.fernbank.labit answers itself, with its own address, where it runs a copy of the bank's sign-in page.Look up the bank's name the way the laptop does, open the page, then ask
publicResolverdirectly, 10.53.2.53.guestLaptop:~# dig online.fernbank.lab guestLaptop:~# curl -sS -m 3 http://online.fernbank.lab/ guestLaptop:~# dig @10.53.2.53 online.fernbank.lab
-
Signatures ride with the records
A zone is the part of the name tree one set of servers answers for:
fernbank.labsits underlab, which sits under the root.fernbank.labis a signed zone. The bank's DNS provider,dnsHost, keeps a key pair for it, and next to every set of records it publishes an RRSIG: a signature made with the private key. A record and its signature travel together, so a resolver can check one against the other.The public key is published too, in the same zone, as a DNSKEY record. A signed zone usually has two.
The zone-signing key, ZSK, signs the zone's records. The key-signing key, KSK, signs only the DNSKEY set itself. Why two keys becomes clear in the next step.
Ask
dnsHost, 10.53.2.20, for the bank's address with its signature, then for fernbank.lab's keys.guestLaptop:~# dig +dnssec +noall +answer @10.53.2.20 online.fernbank.lab guestLaptop:~# dig +multi +noall +answer @10.53.2.20 DNSKEY fernbank.lab
-
Who vouches for the key
A key needs someone to vouch for it, and in DNS that's the parent zone.
fernbank.labsits underlab, run bytldNs.When the bank signed up for DNSSEC, its provider gave
laba DS record: a SHA-256 hash of fernbank.lab's KSK.labpublishes it, signed withlab's own keys.The same holds one level up: the root zone, on
rootNs, publishes a DS forlab's KSK. Nobody vouches for the root's key, so every validator, a resolver that checks signatures, ships with the root's DS built in, a trust anchor. Real systems get theirs from the operating system, the way a browser gets its trusted certificates.Ask
tldNs, 10.53.2.11, for the DS of fernbank.lab, then hash fernbank.lab's keys yourself ondnsHostwithdnssec-dsfromkeyand compare. Last, read the laptop's trust anchor.guestLaptop:~# dig +dnssec +noall +answer @10.53.2.11 DS fernbank.lab dnsHost:~# dnssec-dsfromkey -2 -f /etc/bind/zones/fernbank.lab.zone fernbank.lab guestLaptop:~# cat /etc/bind/bind.keys
-
Secure, insecure, bogus
publicResolveris a validating resolver: for every answer it walks the chain in the drawing, from the trust anchor down: the root's DS forlab, then the links you checked by hand. Each answer ends up in one of three states.Secure: every link checked out. The resolver sets
adand answers, as it did for the bank's name.Insecure: the zone isn't signed, and the zone above proves it. Most of the world's domains are still unsigned, so a validator must answer for them: it does, without
ad.Bogus: a link fails, a signature that doesn't fit, one that ran out, a DS with no matching key. The resolver answers SERVFAIL and gives no address at all.
tidetimes.lab, a tide-tables site on the samednsHost, never signed up for DNSSEC. AskpublicResolverforwww.tidetimes.lab, then for tidetimes.lab's DS, with signatures.guestLaptop:~# dig @10.53.2.53 www.tidetimes.lab guestLaptop:~# dig +dnssec @10.53.2.53 DS tidetimes.lab
-
Check it on the laptop
adis one bit in the answer. It says "publicResolverchecked this", and it travels to the laptop with no protection at all, through the hotspot. The hotspot strips it from what it passes on, and it could set it on its forgery instead.A validator's verdict is only as good as the path back from it, so do the checking where you are.
delvlooks a name up through the laptop's resolver, here the hotspot, asking for every signature, DNSKEY and DS along the way, and checks the chain itself frombind.keys. Whatever the hotspot says, it can't forgelab's DS.Look up the bank's name with
delvthrough the hotspot, then throughpublicResolver.guestLaptop:~# delv online.fernbank.lab guestLaptop:~# delv @10.53.2.53 online.fernbank.lab
-
Signatures run out
A month later,
publicResolverstops finding the bank. Nothing in the zone changed:dnsHost's signing job stopped, and the last signatures it made have since run out.Signatures have an end date for a reason: without one, a recorded answer would stay valid for ever, even after the bank moved. So a signed zone must be signed again, again and again, and when that stops, the zone goes bogus on every validating resolver at once. It's one of the most common DNSSEC outages.
Ask
publicResolverfor the bank's address, then askdnsHostdirectly with the signature, and read its dates. Then sign the zone again ondnsHost, reload it, and havepublicResolverdrop the failure it remembers.guestLaptop:~# dig @10.53.2.53 online.fernbank.lab guestLaptop:~# dig +dnssec +noall +answer @10.53.2.20 online.fernbank.lab dnsHost:~# dnssec-signzone -K /etc/bind/keys -o fernbank.lab /etc/bind/zones/fernbank.lab.zone dnsHost:~# rndc reload fernbank.lab publicResolver:~# unbound-control flush_bogus guestLaptop:~# dig @10.53.2.53 online.fernbank.lab
Run these steps on real machines