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