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