validation.rst revision 1.1.1.3 1 .. Copyright (C) Internet Systems Consortium, Inc. ("ISC")
2 ..
3 .. SPDX-License-Identifier: MPL-2.0
4 ..
5 .. This Source Code Form is subject to the terms of the Mozilla Public
6 .. License, v. 2.0. If a copy of the MPL was not distributed with this
7 .. file, you can obtain one at https://mozilla.org/MPL/2.0/.
8 ..
9 .. See the COPYRIGHT file distributed with this work for additional
10 .. information regarding copyright ownership.
11
12 .. _DNSSEC_validation:
13
14 Validation
15 ----------
16
17 .. _easy_start_guide_for_recursive_servers:
18
19 Easy-Start Guide for Recursive Servers
20 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
21
22 This section provides the basic information needed to set up a
23 working DNSSEC-aware recursive server, also known as a validating
24 resolver. A validating resolver performs validation for each remote
25 response received, following the chain of trust to verify that the answers it
26 receives are legitimate, through the use of public key cryptography and
27 hashing functions.
28
29 .. _enabling_validation:
30
31 Enabling DNSSEC Validation
32 ^^^^^^^^^^^^^^^^^^^^^^^^^^
33
34 So how do we turn on DNSSEC validation? It turns out that you may not need
35 to reconfigure your name server at all, since the most recent versions of BIND 9 -
36 including packages and distributions - have shipped with DNSSEC validation
37 enabled by default. Before making any configuration changes, check
38 whether you already have DNSSEC validation enabled by following the steps
39 described in :ref:`how_to_test_recursive_server`.
40
41 In earlier versions of BIND, including 9.11-ESV, DNSSEC
42 validation must be explicitly enabled. To do this, you only need to
43 add one line to the ``options`` section of your configuration file:
44
45 ::
46
47 options {
48 ...
49 dnssec-validation auto;
50 ...
51 };
52
53 Restart ``named`` or run ``rndc reconfig``, and your recursive server is
54 now happily validating each DNS response. If this does not work for you,
55 you may have some other network-related configurations that need to be
56 adjusted. Take a look at :ref:`network_requirements` to make sure your network
57 is ready for DNSSEC.
58
59 .. _effect_of_enabling_validation:
60
61 Effects of Enabling DNSSEC Validation
62 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
63
64 Once DNSSEC validation is enabled, any DNS response that does not pass
65 the validation checks results in a failure to resolve the domain name
66 (often a SERVFAIL status seen by the client). If everything has
67 been configured properly, this is the correct result; it means that an end user has
68 been protected against a malicious attack.
69
70 However, if there is a DNSSEC configuration issue (sometimes outside of
71 the administrator's control), a specific name or sometimes entire
72 domains may "disappear" from the DNS, and become unreachable
73 through that resolver. For the end user, the issue may manifest itself
74 as name resolution being slow or failing altogether; some parts of a URL
75 not loading; or the web browser returning an error message indicating
76 that the page cannot be displayed. For example, if root name
77 servers were misconfigured with the wrong information about ``.org``, it
78 could cause all validation for ``.org`` domains to fail. To end
79 users, it would appear that all ``.org`` web
80 sites were out of service [#]_. Should you encounter DNSSEC-related problems, don't be
81 tempted to disable validation; there is almost certainly a solution that
82 leaves validation enabled. A basic troubleshooting guide can be found in
83 :ref:`dnssec_troubleshooting`.
84
85 .. [#]
86 Of course, something like this could happen for reasons other than
87 DNSSEC: for example, the root publishing the wrong addresses for the
88 ``.org`` nameservers.
89
90 .. _how_to_test_recursive_server:
91
92 So You Think You Are Validating (How To Test A Recursive Server)
93 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
94
95 Now that you have reconfigured your recursive server and
96 restarted it, how do you know that your recursive name server is
97 actually verifying each DNS query? There are several ways to check, and
98 we've listed a few of them below.
99
100 .. _using_web_based_tests_to_verify:
101
102 Using Web-Based Tools to Verify
103 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
104
105 For most people, the simplest way to check if a recursive name server
106 is indeed validating DNS queries is to use one of the many web-based
107 tools available.
108
109 Configure your client computer to use the newly reconfigured recursive
110 server for DNS resolution; then use one of these web-based tests to
111 confirm that it is in fact validating DNS responses.
112
113 - `Internet.nl <https://en.conn.internet.nl/connection/>`__
114
115 - `DNSSEC or Not (VeriSign) <https://www.dnssec-or-not.com/>`__
116
117 .. _using_dig_to_verify:
118
119 Using ``dig`` to Verify
120 ^^^^^^^^^^^^^^^^^^^^^^^
121
122 Web-based DNSSEC-verification tools often employ JavaScript. If you don't trust the
123 JavaScript magic that the web-based tools rely on, you can take matters
124 into your own hands and use a command-line DNS tool to check your
125 validating resolver yourself.
126
127 While ``nslookup`` is popular, partly because it comes pre-installed on
128 most systems, it is not DNSSEC-aware. ``dig``, on the other hand, fully
129 supports the DNSSEC standard and comes as a part of BIND. If you do not
130 have ``dig`` already installed on your system, install it by downloading
131 it from ISC's `website <https://www.isc.org/download>`__. ISC provides pre-compiled
132 Windows versions on its website.
133
134 ``dig`` is a flexible tool for interrogating DNS name servers. It
135 performs DNS lookups and displays the answers that are returned from the
136 name servers that were queried. Most seasoned DNS administrators use
137 ``dig`` to troubleshoot DNS problems because of its flexibility, ease of
138 use, and clarity of output.
139
140 The example below shows how to use ``dig`` to query the name server 10.53.0.1
141 for the A record for ``ftp.isc.org`` when DNSSEC validation is enabled
142 (i.e. the default). The address 10.53.0.1 is only used as an example;
143 replace it with the actual address or host name of your
144 recursive name server.
145
146 ::
147
148 $ dig @10.53.0.1 ftp.isc.org. A +dnssec +multiline
149
150 ; <<>> DiG 9.16.0 <<>> @10.53.0.1 ftp.isc.org a +dnssec +multiline
151 ; (1 server found)
152 ;; global options: +cmd
153 ;; Got answer:
154 ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 48742
155 ;; flags: qr rd ra ad; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
156
157 ;; OPT PSEUDOSECTION:
158 ; EDNS: version: 0, flags: do; udp: 4096
159 ; COOKIE: 29a9705c2160b08c010000005e67a4a102b9ae079c1b24c8 (good)
160 ;; QUESTION SECTION:
161 ;ftp.isc.org. IN A
162
163 ;; ANSWER SECTION:
164 ftp.isc.org. 300 IN A 149.20.1.49
165 ftp.isc.org. 300 IN RRSIG A 13 3 300 (
166 20200401191851 20200302184340 27566 isc.org.
167 e9Vkb6/6aHMQk/t23Im71ioiDUhB06sncsduoW9+Asl4
168 L3TZtpLvZ5+zudTJC2coI4D/D9AXte1cD6FV6iS6PQ== )
169
170 ;; Query time: 452 msec
171 ;; SERVER: 10.53.0.1#53(10.53.0.1)
172 ;; WHEN: Tue Mar 10 14:30:57 GMT 2020
173 ;; MSG SIZE rcvd: 187
174
175 The important detail in this output is the presence of the ``ad`` flag
176 in the header. This signifies that BIND has retrieved all related DNSSEC
177 information related to the target of the query (``ftp.isc.org``) and that
178 the answer received has passed the validation process described in
179 :ref:`how_are_answers_verified`. We can have confidence in the
180 authenticity and integrity of the answer, that ``ftp.isc.org`` really
181 points to the IP address 149.20.1.49, and that it was not a spoofed answer
182 from a clever attacker.
183
184 Unlike earlier versions of BIND, the current versions of BIND always
185 request DNSSEC records (by setting the ``do`` bit in the query they make
186 to upstream servers), regardless of DNSSEC settings. However, with
187 validation disabled, the returned signature is not checked. This can be
188 seen by explicitly disabling DNSSEC validation. To do this, add the line
189 ``dnssec-validation no;`` to the "options" section of the configuration
190 file, i.e.:
191
192 ::
193
194 options {
195 ...
196 dnssec-validation no;
197 ...
198 };
199
200 If the server is restarted (to ensure a clean cache) and the same
201 ``dig`` command executed, the result is very similar:
202
203 ::
204
205 $ dig @10.53.0.1 ftp.isc.org. A +dnssec +multiline
206
207 ; <<>> DiG 9.16.0 <<>> @10.53.0.1 ftp.isc.org a +dnssec +multiline
208 ; (1 server found)
209 ;; global options: +cmd
210 ;; Got answer:
211 ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 39050
212 ;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
213
214 ;; OPT PSEUDOSECTION:
215 ; EDNS: version: 0, flags: do; udp: 4096
216 ; COOKIE: a8dc9d1b9ec45e75010000005e67a8a69399741fdbe126f2 (good)
217 ;; QUESTION SECTION:
218 ;ftp.isc.org. IN A
219
220 ;; ANSWER SECTION:
221 ftp.isc.org. 300 IN A 149.20.1.49
222 ftp.isc.org. 300 IN RRSIG A 13 3 300 (
223 20200401191851 20200302184340 27566 isc.org.
224 e9Vkb6/6aHMQk/t23Im71ioiDUhB06sncsduoW9+Asl4
225 L3TZtpLvZ5+zudTJC2coI4D/D9AXte1cD6FV6iS6PQ== )
226
227 ;; Query time: 261 msec
228 ;; SERVER: 10.53.0.1#53(10.53.0.1)
229 ;; WHEN: Tue Mar 10 14:48:06 GMT 2020
230 ;; MSG SIZE rcvd: 187
231
232 However, this time there is no ``ad`` flag in the header. Although
233 ``dig`` is still returning the DNSSEC-related resource records, it is
234 not checking them, and thus cannot vouch for the authenticity of the answer.
235 If you do carry out this test, remember to re-enable DNSSEC validation
236 (by removing the ``dnssec-validation no;`` line from the configuration
237 file) before continuing.
238
239 .. _verifying_protection_from_bad_domains:
240
241 Verifying Protection From Bad Domain Names
242 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
243
244 It is also important to make sure that DNSSEC is protecting your network from
245 domain names that fail to validate; such failures could be caused by
246 attacks on your system, attempting to get it to accept false DNS
247 information. Validation could fail for a number of reasons: maybe the
248 answer doesn't verify because it's a spoofed response; maybe the
249 signature was a replayed network attack that has expired; or maybe the
250 child zone has been compromised along with its keys, and the parent
251 zone's information tells us that things don't add up. There is a
252 domain name specifically set up to fail DNSSEC validation,
253 ``www.dnssec-failed.org``.
254
255 With DNSSEC validation enabled (the default), an attempt to look up that
256 name fails:
257
258 ::
259
260 $ dig @10.53.0.1 www.dnssec-failed.org. A
261
262 ; <<>> DiG 9.16.0 <<>> @10.53.0.1 www.dnssec-failed.org. A
263 ; (1 server found)
264 ;; global options: +cmd
265 ;; Got answer:
266 ;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 22667
267 ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
268
269 ;; OPT PSEUDOSECTION:
270 ; EDNS: version: 0, flags:; udp: 4096
271 ; COOKIE: 69c3083144854587010000005e67bb57f5f90ff2688e455d (good)
272 ;; QUESTION SECTION:
273 ;www.dnssec-failed.org. IN A
274
275 ;; Query time: 2763 msec
276 ;; SERVER: 10.53.0.1#53(10.53.0.1)
277 ;; WHEN: Tue Mar 10 16:07:51 GMT 2020
278 ;; MSG SIZE rcvd: 78
279
280 On the other hand, if DNSSEC validation is disabled (by adding the
281 statement ``dnssec-validation no;`` to the ``options`` clause in the
282 configuration file), the lookup succeeds:
283
284 ::
285
286 $ dig @10.53.0.1 www.dnssec-failed.org. A
287
288 ; <<>> DiG 9.16.0 <<>> @10.53.0.1 www.dnssec-failed.org. A
289 ; (1 server found)
290 ;; global options: +cmd
291 ;; Got answer:
292 ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 54704
293 ;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
294
295 ;; OPT PSEUDOSECTION:
296 ; EDNS: version: 0, flags:; udp: 4096
297 ; COOKIE: 251eee58208917f9010000005e67bb6829f6dabc5ae6b7b9 (good)
298 ;; QUESTION SECTION:
299 ;www.dnssec-failed.org. IN A
300
301 ;; ANSWER SECTION:
302 www.dnssec-failed.org. 7200 IN A 68.87.109.242
303 www.dnssec-failed.org. 7200 IN A 69.252.193.191
304
305 ;; Query time: 439 msec
306 ;; SERVER: 10.53.0.1#53(10.53.0.1)
307 ;; WHEN: Tue Mar 10 16:08:08 GMT 2020
308 ;; MSG SIZE rcvd: 110
309
310 Do not be tempted to disable DNSSEC validation just because some names
311 are failing to resolve. Remember, DNSSEC protects your DNS lookup from
312 hacking. The next section describes how to quickly check whether
313 the failure to successfully look up a name is due to a validation
314 failure.
315
316 .. _how_do_i_know_validation_problem:
317
318 How Do I Know I Have a Validation Problem?
319 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
320
321 Since all DNSSEC validation failures result in a general ``SERVFAIL``
322 message, how do we know if it was really a validation error?
323 Fortunately, there is a flag in ``dig``, (``+cd``, for "checking
324 disabled") which tells the server to disable DNSSEC validation. If
325 you receive a ``SERVFAIL`` message, re-run the query a second time
326 and set the ``+cd`` flag. If the query succeeds with ``+cd``, but
327 ends in ``SERVFAIL`` without it, you know you are dealing with a
328 validation problem. So using the previous example of
329 ``www.dnssec-failed.org`` and with DNSSEC validation enabled in the
330 resolver:
331
332 ::
333
334 $ dig @10.53.0.1 www.dnssec-failed.org A +cd
335
336 ; <<>> DiG 9.16.0 <<>> @10.53.0.1 www.dnssec-failed.org. A +cd
337 ; (1 server found)
338 ;; global options: +cmd
339 ;; Got answer:
340 ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 62313
341 ;; flags: qr rd ra cd; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
342
343 ;; OPT PSEUDOSECTION:
344 ; EDNS: version: 0, flags:; udp: 4096
345 ; COOKIE: 73ca1be3a74dd2cf010000005e67c8c8e6df64b519cd87fd (good)
346 ;; QUESTION SECTION:
347 ;www.dnssec-failed.org. IN A
348
349 ;; ANSWER SECTION:
350 www.dnssec-failed.org. 7197 IN A 68.87.109.242
351 www.dnssec-failed.org. 7197 IN A 69.252.193.191
352
353 ;; Query time: 0 msec
354 ;; SERVER: 10.53.0.1#53(10.53.0.1)
355 ;; WHEN: Tue Mar 10 17:05:12 GMT 2020
356 ;; MSG SIZE rcvd: 110
357
358 For more information on troubleshooting, please see
359 :ref:`dnssec_troubleshooting`.
360
361 .. _validation_easy_start_explained:
362
363 Validation Easy Start Explained
364 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
365
366 In :ref:`easy_start_guide_for_recursive_servers`, we used one line
367 of configuration to turn on DNSSEC validation: the act of chasing down
368 signatures and keys, making sure they are authentic. Now we are going to
369 take a closer look at what DNSSEC validation actually does, and some other options.
370
371 .. _dnssec_validation_explained:
372
373 ``dnssec-validation``
374 ^^^^^^^^^^^^^^^^^^^^^
375
376 ::
377
378 options {
379 dnssec-validation auto;
380 };
381
382 This auto line enables automatic DNSSEC trust anchor configuration
383 using the ``managed-keys`` feature. In this case, no manual key
384 configuration is needed. There are three possible choices for the
385 ``dnssec-validation`` option:
386
387 - *yes*: DNSSEC validation is enabled, but a trust anchor must be
388 manually configured. No validation actually takes place until
389 at least one trusted key has been manually configured.
390
391 - *no*: DNSSEC validation is disabled, and the recursive server behaves
392 in the "old-fashioned" way of performing insecure DNS lookups.
393
394 - *auto*: DNSSEC validation is enabled, and a default trust anchor
395 (included as part of BIND 9) for the DNS root zone is used. This is the
396 default; BIND automatically does this if there is no
397 ``dnssec-validation`` line in the configuration file.
398
399 Let's discuss the difference between *yes* and *auto*. If set to
400 *yes*, the trust anchor must be manually defined and maintained
401 using the ``trust-anchors`` statement (with either the ``static-key`` or
402 ``static-ds`` modifier) in the configuration file; if set to
403 *auto* (the default, and as shown in the example), then no further
404 action should be required as BIND includes a copy [#]_ of the root key.
405 When set to *auto*, BIND automatically keeps the keys (also known as
406 trust anchors, discussed in :ref:`trust_anchors_description`)
407 up-to-date without intervention from the DNS administrator.
408
409 We recommend using the default *auto* unless there is a good reason to
410 require a manual trust anchor. To learn more about trust anchors,
411 please refer to :ref:`trusted_keys_and_managed_keys`.
412
413 .. _how_does_dnssec_change_dns_lookup_revisited:
414
415 How Does DNSSEC Change DNS Lookup (Revisited)?
416 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
417
418 Now you've enabled validation on your recursive name server and
419 verified that it works. What exactly changed? In
420 :ref:`how_does_dnssec_change_dns_lookup` we looked at a very
421 high-level, simplified version of the 12 steps of the DNSSEC validation process. Let's revisit
422 that process now and see what your validating resolver is doing in more
423 detail. Again, as an example we are looking up the A record for the
424 domain name ``www.isc.org`` (see :ref:`dnssec_12_steps`):
425
426 1. The validating resolver queries the ``isc.org`` name servers for the
427 A record of ``www.isc.org``. This query has the ``DNSSEC
428 OK`` (``do``) bit set to 1, notifying the remote authoritative
429 server that DNSSEC answers are desired.
430
431 2. Since the zone ``isc.org`` is signed, and its name servers are
432 DNSSEC-aware, it responds with the answer to the A record query plus
433 the RRSIG for the A record.
434
435 3. The validating resolver queries for the DNSKEY for ``isc.org``.
436
437 4. The ``isc.org`` name server responds with the DNSKEY and RRSIG
438 records. The DNSKEY is used to verify the answers received in #2.
439
440 5. The validating resolver queries the parent (``.org``) for the DS
441 record for ``isc.org``.
442
443 6. The ``.org`` name server is also DNSSEC-aware, so it responds with the
444 DS and RRSIG records. The DS record is used to verify the answers
445 received in #4.
446
447 7. The validating resolver queries for the DNSKEY for ``.org``.
448
449 8. The ``.org`` name server responds with its DNSKEY and RRSIG. The DNSKEY
450 is used to verify the answers received in #6.
451
452 9. The validating resolver queries the parent (root) for the DS record
453 for ``.org``.
454
455 10. The root name server, being DNSSEC-aware, responds with DS and RRSIG
456 records. The DS record is used to verify the answers received in #8.
457
458 11. The validating resolver queries for the DNSKEY for root.
459
460 12. The root name server responds with its DNSKEY and RRSIG. The DNSKEY is
461 used to verify the answers received in #10.
462
463 After step #12, the validating resolver takes the DNSKEY received and
464 compares it to the key or keys it has configured, to decide whether
465 the received key can be trusted. We talk about these locally
466 configured keys, or trust anchors, in :ref:`trust_anchors_description`.
467
468 With DNSSEC, every response includes not just the
469 answer, but a digital signature (RRSIG) as well, so the
470 validating resolver can verify the answer received. That is what we
471 look at in the next section, :ref:`how_are_answers_verified`.
472
473 .. _how_are_answers_verified:
474
475 How Are Answers Verified?
476 ^^^^^^^^^^^^^^^^^^^^^^^^^
477
478 .. note::
479
480 Keep in mind, as you read this section, that although words like
481 "encryption" and "decryption"
482 are used here from time to time, DNSSEC does not provide privacy.
483 Public key cryptography is used to verify data *authenticity* (who
484 sent it) and data *integrity* (it did not change during transit), but
485 any eavesdropper can still see DNS requests and responses in
486 clear text, even when DNSSEC is enabled.
487
488 So how exactly are DNSSEC answers verified? Let's first see how verifiable information is
489 generated. On the authoritative server, each DNS record (or message) is
490 run through a hash function, and this hashed value is then encrypted by a
491 private key. This encrypted hash value is the digital signature.
492
493 .. figure:: ../dnssec-guide/img/signature-generation.png
494 :alt: Signature Generation
495 :width: 80.0%
496
497 Signature Generation
498
499 When the validating resolver queries for the resource record, it
500 receives both the plain-text message and the digital signature(s). The
501 validating resolver knows the hash function used (it is listed in the digital
502 signature record itself), so it can take the plain-text message and run
503 it through the same hash function to produce a hashed value, which we'll call
504 hash value X. The validating resolver can also obtain the public key
505 (published as DNSKEY records), decrypt the digital signature, and get
506 back the original hashed value produced by the authoritative server,
507 which we'll call hash value Y. If hash values X and Y are identical, and
508 the time is correct (more on what this means below), the answer is
509 verified, meaning this answer came from the authoritative server
510 (authenticity), and the content remained intact during transit
511 (integrity).
512
513 .. figure:: ../dnssec-guide/img/signature-verification.png
514 :alt: Signature Verification
515 :width: 80.0%
516
517 Signature Verification
518
519 Take the A record ``ftp.isc.org``, for example. The plain text is:
520
521 ::
522
523 ftp.isc.org. 4 IN A 149.20.1.49
524
525 The digital signature portion is:
526
527 ::
528
529 ftp.isc.org. 300 IN RRSIG A 13 3 300 (
530 20200401191851 20200302184340 27566 isc.org.
531 e9Vkb6/6aHMQk/t23Im71ioiDUhB06sncsduoW9+Asl4
532 L3TZtpLvZ5+zudTJC2coI4D/D9AXte1cD6FV6iS6PQ== )
533
534 When a validating resolver queries for the A record ``ftp.isc.org``, it
535 receives both the A record and the RRSIG record. It runs the A record
536 through a hash function (in this example, SHA256 as
537 indicated by the number 13, signifying ECDSAP256SHA256) and produces
538 hash value X. The resolver also fetches the appropriate DNSKEY record to
539 decrypt the signature, and the result of the decryption is hash value Y.
540
541 But wait, there's more! Just because X equals Y doesn't mean everything
542 is good. We still have to look at the time. Remember we mentioned a
543 little earlier that we need to check if the time is correct? Look
544 at the two timestamps in our example above:
545
546 - Signature Expiration: 20200401191851
547
548 - Signature Inception: 20200302184340
549
550 This tells us that this signature was generated UTC March 2nd, 2020, at
551 6:43:40 PM (20200302184340), and it is good until UTC April 1st, 2020,
552 7:18:51 PM (20200401191851). The validating resolver's current
553 system time needs to fall between these two timestamps. If it does not, the
554 validation fails, because it could be an attacker replaying an old
555 captured answer set from the past, or feeding us a crafted one with
556 incorrect future timestamps.
557
558 If the answer passes both the hash value check and the timestamp check, it is
559 validated and the authenticated data (``ad``) bit is set, and the response
560 is sent to the client; if it does not verify, a SERVFAIL is returned to
561 the client.
562
563 .. [#]
564 BIND technically includes two copies of the root key: one is in
565 ``bind.keys.h`` and is built into the executable, and one is in
566 ``bind.keys`` as a ``trust-anchors`` statement. The two copies of the
567 key are identical.
568
569 .. _trust_anchors_description:
570
571 Trust Anchors
572 ~~~~~~~~~~~~~
573
574 A trust anchor is a key that is placed into a validating resolver, so
575 that the validator can verify the results of a given request with a
576 known or trusted public key (the trust anchor). A validating resolver
577 must have at least one trust anchor installed to perform DNSSEC
578 validation.
579
580 .. _how_trust_anchors_are_used:
581
582 How Trust Anchors are Used
583 ~~~~~~~~~~~~~~~~~~~~~~~~~~
584
585 In the section :ref:`how_does_dnssec_change_dns_lookup_revisited`,
586 we walked through the 12 steps of the DNSSEC lookup process. At the end
587 of the 12 steps, a critical comparison happens: the key received from
588 the remote server and the key we have on file are compared to see if we
589 trust it. The key we have on file is called a trust anchor, sometimes
590 also known as a trust key, trust point, or secure entry point.
591
592 The 12-step lookup process describes the DNSSEC lookup in the ideal
593 world, where every single domain name is signed and properly delegated,
594 and where each validating resolver only needs to have one trust anchor - that
595 is, the root's public key. But there is no restriction that the
596 validating resolver must only have one trust anchor. In fact, in the
597 early stages of DNSSEC adoption, it was not unusual for a validating
598 resolver to have more than one trust anchor.
599
600 For instance, before the root zone was signed (in July 2010), some
601 validating resolvers that wished to validate domain names in the ``.gov``
602 zone needed to obtain and install the key for ``.gov``. A sample lookup
603 process for ``www.fbi.gov`` at that time would have been eight steps rather
604 than 12:
605
606 .. figure:: ../dnssec-guide/img/dnssec-8-steps.png
607 :alt: DNSSEC Validation with ``.gov`` Trust Anchor
608
609
610 1. The validating resolver queried ``fbi.gov`` name server for the A
611 record of ``www.fbi.gov``.
612
613 2. The FBI's name server responded with the answer and its RRSIG.
614
615 3. The validating resolver queried the FBI's name server for its DNSKEY.
616
617 4. The FBI's name server responded with the DNSKEY and its RRSIG.
618
619 5. The validating resolver queried a ``.gov`` name server for the DS
620 record of ``fbi.gov``.
621
622 6. The ``.gov`` name server responded with the DS record and the
623 associated RRSIG for ``fbi.gov``.
624
625 7. The validating resolver queried the ``.gov`` name server for its DNSKEY.
626
627 8. The ``.gov`` name server responded with its DNSKEY and the associated
628 RRSIG.
629
630 This all looks very similar, except it's shorter than the 12 steps that
631 we saw earlier. Once the validating resolver receives the DNSKEY file in
632 #8, it recognizes that this is the manually configured trusted key
633 (trust anchor), and never goes to the root name servers to ask for the
634 DS record for ``.gov``, or ask the root name servers for their DNSKEY.
635
636 In fact, whenever the validating resolver receives a DNSKEY, it checks
637 to see if this is a configured trusted key to decide whether it
638 needs to continue chasing down the validation chain.
639
640 .. _trusted_keys_and_managed_keys:
641
642 Trusted Keys and Managed Keys
643 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
644
645 Since the resolver is validating, we must have at least one key (trust
646 anchor) configured. How did it get here, and how do we maintain it?
647
648 If you followed the recommendation in
649 :ref:`easy_start_guide_for_recursive_servers`, by setting
650 ``dnssec-validation`` to *auto*, there is nothing left to do.
651 BIND already includes a copy of the root key (in the file
652 ``bind.keys``), and automatically updates it when the root key
653 changes. [#]_ It looks something like this:
654
655 ::
656
657 trust-anchors {
658 # This key (20326) was published in the root zone in 2017.
659 . initial-key 257 3 8 "AwEAAaz/tAm8yTn4Mfeh5eyI96WSVexTBAvkMgJzkKTOiW1vkIbzxeF3
660 +/4RgWOq7HrxRixHlFlExOLAJr5emLvN7SWXgnLh4+B5xQlNVz8Og8kv
661 ArMtNROxVQuCaSnIDdD5LKyWbRd2n9WGe2R8PzgCmr3EgVLrjyBxWezF
662 0jLHwVN8efS3rCj/EWgvIWgb9tarpVUDK/b58Da+sqqls3eNbuv7pr+e
663 oZG+SrDK6nWeL3c6H5Apxz7LjVc1uTIdsIXxuOLYA4/ilBmSVIzuDWfd
664 RUfhHdY6+cn8HFRm+2hM8AnXGXws9555KrUB5qihylGa8subX2Nn6UwN
665 R1AkUTV74bU=";
666 };
667
668 You can, of course, decide to manage this key manually yourself.
669 First, you need to make sure that ``dnssec-validation`` is set
670 to *yes* rather than *auto*:
671
672 ::
673
674 options {
675 dnssec-validation yes;
676 };
677
678 Then, download the root key manually from a trustworthy source, such as
679 `<https://www.isc.org/bind-keys>`__. Finally, take the root key you
680 manually downloaded and put it into a ``trust-anchors`` statement as
681 shown below:
682
683 ::
684
685 trust-anchors {
686 # This key (20326) was published in the root zone in 2017.
687 . static-key 257 3 8 "AwEAAaz/tAm8yTn4Mfeh5eyI96WSVexTBAvkMgJzkKTOiW1vkIbzxeF3
688 +/4RgWOq7HrxRixHlFlExOLAJr5emLvN7SWXgnLh4+B5xQlNVz8Og8kv
689 ArMtNROxVQuCaSnIDdD5LKyWbRd2n9WGe2R8PzgCmr3EgVLrjyBxWezF
690 0jLHwVN8efS3rCj/EWgvIWgb9tarpVUDK/b58Da+sqqls3eNbuv7pr+e
691 oZG+SrDK6nWeL3c6H5Apxz7LjVc1uTIdsIXxuOLYA4/ilBmSVIzuDWfd
692 RUfhHdY6+cn8HFRm+2hM8AnXGXws9555KrUB5qihylGa8subX2Nn6UwN
693 R1AkUTV74bU=";
694 };
695
696 While this ``trust-anchors`` statement and the one in the ``bind.keys``
697 file appear similar, the definition of the key in ``bind.keys`` has the
698 ``initial-key`` modifier, whereas in the statement in the configuration
699 file, that is replaced by ``static-key``. There is an important
700 difference between the two: a key defined with ``static-key`` is always
701 trusted until it is deleted from the configuration file. With the
702 ``initial-key`` modified, keys are only trusted once: for as long as it
703 takes to load the managed key database and start the key maintenance
704 process. Thereafter, BIND uses the managed keys database
705 (``managed-keys.bind.jnl``) as the source of key information.
706
707 .. warning::
708
709 Remember, if you choose to manage the keys on your own, whenever the
710 key changes (which, for most zones, happens on a periodic basis),
711 the configuration needs to be updated manually. Failure to do so will
712 result in breaking nearly all DNS queries for the subdomain of the
713 key. So if you are manually managing ``.gov``, all domain names in
714 the ``.gov`` space may become unresolvable; if you are manually
715 managing the root key, you could break all DNS requests made to your
716 recursive name server.
717
718 Explicit management of keys was common in the early days of DNSSEC, when
719 neither the root zone nor many top-level domains were signed. Since
720 then, `over 90% <https://stats.research.icann.org/dns/tld_report/>`__ of
721 the top-level domains have been signed, including all the largest ones.
722 Unless you have a particular need to manage keys yourself, it is best to
723 use the BIND defaults and let the software manage the root key.
724
725 .. [#]
726 The root zone was signed in July 2010 and, as at the time of this writing
727 (mid-2020), the key has been changed once, in October 2018. The intention going
728 forward is to roll the key once every five years.
729
730 .. _whats_edns0_all_about:
731
732 What's EDNS All About (And Why Should I Care)?
733 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
734
735 .. _whats-edns0-all-about-overview:
736
737 EDNS Overview
738 ^^^^^^^^^^^^^
739
740 Traditional DNS responses are typically small in size (less than 512
741 bytes) and fit nicely into a small UDP packet. The Extension mechanism
742 for DNS (EDNS, or EDNS(0)) offers a mechanism to send DNS data in
743 larger packets over UDP. To support EDNS, both the DNS server
744 and the network need to be properly prepared to support the larger
745 packet sizes and multiple fragments.
746
747 This is important for DNSSEC, since the ``+do`` bit that signals
748 DNSSEC-awareness is carried within EDNS, and DNSSEC responses are larger
749 than traditional DNS ones. If DNS servers and the network environment cannot
750 support large UDP packets, it will cause retransmission over TCP, or the
751 larger UDP responses will be discarded. Users will likely experience
752 slow DNS resolution or be unable to resolve certain names at all.
753
754 Note that EDNS applies regardless of whether you are validating DNSSEC, because
755 BIND has DNSSEC enabled by default.
756
757 Please see :ref:`network_requirements` for more information on what
758 DNSSEC expects from the network environment.
759
760 .. _edns_on_dns_servers:
761
762 EDNS on DNS Servers
763 ^^^^^^^^^^^^^^^^^^^
764
765 For many years, BIND has had EDNS enabled by default,
766 and the UDP packet size is set to a maximum of 4096 bytes. The DNS
767 administrator should not need to perform any reconfiguration. You can
768 use ``dig`` to verify that your server supports EDNS and see the UDP packet
769 size it allows with this ``dig`` command:
770
771 ::
772
773 $ dig @10.53.0.1 www.isc.org. A +dnssec +multiline
774
775 ; <<>> DiG 9.16.0 <<>> @10.53.0.1 ftp.isc.org a +dnssec +multiline
776 ; (1 server found)
777 ;; global options: +cmd
778 ;; Got answer:
779 ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 48742
780 ;; flags: qr rd ra ad; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
781
782 ;; OPT PSEUDOSECTION:
783 ; EDNS: version: 0, flags: do; udp: 4096
784 ; COOKIE: 29a9705c2160b08c010000005e67a4a102b9ae079c1b24c8 (good)
785 ;; QUESTION SECTION:
786 ;ftp.isc.org. IN A
787
788 ;; ANSWER SECTION:
789 ftp.isc.org. 300 IN A 149.20.1.49
790 ftp.isc.org. 300 IN RRSIG A 13 3 300 (
791 20200401191851 20200302184340 27566 isc.org.
792 e9Vkb6/6aHMQk/t23Im71ioiDUhB06sncsduoW9+Asl4
793 L3TZtpLvZ5+zudTJC2coI4D/D9AXte1cD6FV6iS6PQ== )
794
795 ;; Query time: 452 msec
796 ;; SERVER: 10.53.0.1#53(10.53.0.1)
797 ;; WHEN: Tue Mar 10 14:30:57 GMT 2020
798 ;; MSG SIZE rcvd: 187
799
800 There is a helpful testing tool available (provided by DNS-OARC) that
801 you can use to verify resolver behavior regarding EDNS support:
802 `<https://www.dns-oarc.net/oarc/services/replysizetest/>`__ .
803
804 Once you've verified that your name servers have EDNS enabled, that should be the
805 end of the story, right? Unfortunately, EDNS is a hop-by-hop extension
806 to DNS. This means the use of EDNS is negotiated between each pair of
807 hosts in a DNS resolution process, which in turn means if one of your
808 upstream name servers (for instance, your ISP's recursive name server
809 that your name server forwards to) does not support EDNS, you may experience DNS
810 lookup failures or be unable to perform DNSSEC validation.
811
812 .. _support_for_large_packets_network_equipment:
813
814 Support for Large Packets on Network Equipment
815 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
816
817 If both your recursive name server and your ISP's name servers
818 support EDNS, we are all good here, right? Not so fast. Since these large
819 packets have to traverse the network, the network infrastructure
820 itself must allow them to pass.
821
822 When data is physically transmitted over a network, it has to be broken
823 down into chunks. The size of the data chunk is known as the Maximum
824 Transmission Unit (MTU), and it can differ from network to
825 network. IP fragmentation occurs when a large data packet needs to be
826 broken down into chunks smaller than the
827 MTU; these smaller chunks then need to be reassembled back into the large
828 data packet at their destination. IP fragmentation is not necessarily a bad thing, and it most
829 likely occurs on your network today.
830
831 Some network equipment, such as a firewall, may make assumptions about
832 DNS traffic. One of these assumptions may be how large each DNS packet
833 is. When a firewall sees a larger DNS packet than it expects, it may either
834 reject the large packet or drop its fragments because the firewall
835 thinks it's an attack. This configuration probably didn't cause problems
836 in the past, since traditional DNS packets are usually pretty small in
837 size. However, with DNSSEC, these configurations need to be updated,
838 since DNSSEC traffic regularly exceeds 1500 bytes (a common MTU value).
839 If the configuration is not updated to support a larger DNS packet size,
840 it often results in the larger packets being rejected, and to the
841 end user it looks like the queries go unanswered. Or in the case of
842 fragmentation, only a part of the answer makes it to the validating
843 resolver, and your validating resolver may need to re-ask the question
844 again and again, creating the appearance for end users that the DNS/network is slow.
845
846 While you are updating the configuration on your network equipment, make
847 sure TCP port 53 is also allowed for DNS traffic.
848
849 .. _dns_uses_tcp:
850
851 Wait... DNS Uses TCP?
852 ^^^^^^^^^^^^^^^^^^^^^
853
854 Yes. DNS uses TCP port 53 as a fallback mechanism, when it cannot use
855 UDP to transmit data. This has always been the case, even long before
856 the arrival of DNSSEC. Traditional DNS relies on TCP port 53 for
857 operations such as zone transfer. The use of DNSSEC, or DNS with IPv6
858 records such as AAAA, increases the chance that DNS data will be
859 transmitted via TCP.
860
861 Due to the increased packet size, DNSSEC may fall back to TCP more often
862 than traditional (insecure) DNS. If your network blocks or
863 filters TCP port 53 today, you may already experience instability with
864 DNS resolution, before even deploying DNSSEC.
865