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 14Validation 15---------- 16 17.. _easy_start_guide_for_recursive_servers: 18 19Easy-Start Guide for Recursive Servers 20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 21 22This section provides the basic information needed to set up a 23working DNSSEC-aware recursive server, also known as a validating 24resolver. A validating resolver performs validation for each remote 25response received, following the chain of trust to verify that the answers it 26receives are legitimate, through the use of public key cryptography and 27hashing functions. 28 29.. _enabling_validation: 30 31Enabling DNSSEC Validation 32^^^^^^^^^^^^^^^^^^^^^^^^^^ 33 34So how do we turn on DNSSEC validation? It turns out that you may not need 35to reconfigure your name server at all, since the most recent versions of BIND 9 - 36including packages and distributions - have shipped with DNSSEC validation 37enabled by default. Before making any configuration changes, check 38whether you already have DNSSEC validation enabled by following the steps 39described in :ref:`how_to_test_recursive_server`. 40 41In earlier versions of BIND, including 9.11-ESV, DNSSEC 42validation must be explicitly enabled. To do this, you only need to 43add 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 53Restart :iscman:`named` or run :option:`rndc reconfig`, and your recursive server is 54now happily validating each DNS response. If this does not work for you, 55you may have some other network-related configurations that need to be 56adjusted. Take a look at :ref:`network_requirements` to make sure your network 57is ready for DNSSEC. 58 59.. _effect_of_enabling_validation: 60 61Effects of Enabling DNSSEC Validation 62^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 63 64Once DNSSEC validation is enabled, any DNS response that does not pass 65the validation checks results in a failure to resolve the domain name 66(often a SERVFAIL status seen by the client). If everything has 67been configured properly, this is the correct result; it means that an end user has 68been protected against a malicious attack. 69 70However, if there is a DNSSEC configuration issue (sometimes outside of 71the administrator's control), a specific name or sometimes entire 72domains may "disappear" from the DNS, and become unreachable 73through that resolver. For the end user, the issue may manifest itself 74as name resolution being slow or failing altogether; some parts of a URL 75not loading; or the web browser returning an error message indicating 76that the page cannot be displayed. For example, if root name 77servers were misconfigured with the wrong information about ``.org``, it 78could cause all validation for ``.org`` domains to fail. To end 79users, it would appear that all ``.org`` web sites were out of service. 80[#wrong_root_addr]_ Should you encounter DNSSEC-related problems, don't 81be tempted to disable validation; there is almost certainly a solution 82that leaves validation enabled. A basic troubleshooting guide can be 83found 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 92So You Think You Are Validating (How To Test A Recursive Server) 93~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 94 95Now that you have reconfigured your recursive server and 96restarted it, how do you know that your recursive name server is 97actually verifying each DNS query? There are several ways to check, and 98we've listed a few of them below. 99 100.. _using_web_based_tests_to_verify: 101 102Using Web-Based Tools to Verify 103^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 104 105For most people, the simplest way to check if a recursive name server 106is indeed validating DNS queries is to use one of the many web-based 107tools available. 108 109Configure your client computer to use the newly reconfigured recursive 110server for DNS resolution; then use one of these web-based tests to 111confirm 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 119Using :iscman:`dig` to Verify 120^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 121 122Web-based DNSSEC-verification tools often employ JavaScript. If you don't trust the 123JavaScript magic that the web-based tools rely on, you can take matters 124into your own hands and use a command-line DNS tool to check your 125validating resolver yourself. 126 127While :iscman:`nslookup` is popular, partly because it comes pre-installed on 128most systems, it is not DNSSEC-aware. :iscman:`dig`, on the other hand, fully 129supports the DNSSEC standard and comes as a part of BIND. If you do not 130have :iscman:`dig` already installed on your system, install it by downloading 131it from ISC's `website <https://www.isc.org/download>`__. 132 133:iscman:`dig` is a flexible tool for interrogating DNS name servers. It 134performs DNS lookups and displays the answers that are returned from the 135name servers that were queried. Most seasoned DNS administrators use 136:iscman:`dig` to troubleshoot DNS problems because of its flexibility, ease of 137use, and clarity of output. 138 139The example below shows how to use :iscman:`dig` to query the name server 10.53.0.1 140for 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; 142replace it with the actual address or host name of your 143recursive 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 174The important detail in this output is the presence of the ``ad`` flag 175in the header. This signifies that BIND has retrieved all related DNSSEC 176information related to the target of the query (``ftp.isc.org``) and that 177the answer received has passed the validation process described in 178:ref:`how_are_answers_verified`. We can have confidence in the 179authenticity and integrity of the answer, that ``ftp.isc.org`` really 180points to the IP address 149.20.1.49, and that it was not a spoofed answer 181from a clever attacker. 182 183Unlike earlier versions of BIND, the current versions of BIND always 184request DNSSEC records (by setting the ``do`` bit in the query they make 185to upstream servers), regardless of DNSSEC settings. However, with 186validation disabled, the returned signature is not checked. This can be 187seen by explicitly disabling DNSSEC validation. To do this, add the line 188``dnssec-validation no;`` to the "options" section of the configuration 189file, i.e.: 190 191:: 192 193 options { 194 ... 195 dnssec-validation no; 196 ... 197 }; 198 199If 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 231However, this time there is no ``ad`` flag in the header. Although 232:iscman:`dig` is still returning the DNSSEC-related resource records, it is 233not checking them, and thus cannot vouch for the authenticity of the answer. 234If you do carry out this test, remember to re-enable DNSSEC validation 235(by removing the ``dnssec-validation no;`` line from the configuration 236file) before continuing. 237 238.. _verifying_protection_from_bad_domains: 239 240Verifying Protection From Bad Domain Names 241~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 242 243It is also important to make sure that DNSSEC is protecting your network from 244domain names that fail to validate; such failures could be caused by 245attacks on your system, attempting to get it to accept false DNS 246information. Validation could fail for a number of reasons: maybe the 247answer doesn't verify because it's a spoofed response; maybe the 248signature was a replayed network attack that has expired; or maybe the 249child zone has been compromised along with its keys, and the parent 250zone's information tells us that things don't add up. There is a 251domain name specifically set up to fail DNSSEC validation, 252``www.dnssec-failed.org``. 253 254With DNSSEC validation enabled (the default), an attempt to look up that 255name 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 279On the other hand, if DNSSEC validation is disabled (by adding the 280statement ``dnssec-validation no;`` to the :namedconf:ref:`options` clause in the 281configuration 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 309Do not be tempted to disable DNSSEC validation just because some names 310are failing to resolve. Remember, DNSSEC protects your DNS lookup from 311hacking. The next section describes how to quickly check whether 312the failure to successfully look up a name is due to a validation 313failure. 314 315.. _how_do_i_know_validation_problem: 316 317How Do I Know I Have a Validation Problem? 318^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 319 320Since all DNSSEC validation failures result in a general ``SERVFAIL`` 321message, how do we know if it was really a validation error? 322Fortunately, there is a flag in :iscman:`dig`, ("CD" for "checking 323disabled") which tells the server to disable DNSSEC validation. If 324you receive a ``SERVFAIL`` message, re-run the query a second time 325and set the :option:`dig +cd` flag. If the query succeeds with :option:`dig +cd`, but 326ends in ``SERVFAIL`` without it, you know you are dealing with a 327validation problem. So using the previous example of 328``www.dnssec-failed.org`` and with DNSSEC validation enabled in the 329resolver: 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 357For more information on troubleshooting, please see 358:ref:`dnssec_troubleshooting`. 359 360.. _validation_easy_start_explained: 361 362Validation Easy Start Explained 363~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 364 365In :ref:`easy_start_guide_for_recursive_servers`, we used one line 366of configuration to turn on DNSSEC validation: the act of chasing down 367signatures and keys, making sure they are authentic. Now we are going to 368take 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 381This “auto” line enables automatic DNSSEC trust anchor configuration 382using the :any:`managed-keys` feature. In this case, no manual key 383configuration 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 398Let's discuss the difference between *yes* and *auto*. If set to 399*yes*, the trust anchor must be manually defined and maintained 400using 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 403action should be required as BIND includes a copy [#root_zone_key_update]_ of the root key. 404When set to *auto*, BIND automatically keeps the keys (also known as 405trust anchors, discussed in :ref:`trust_anchors_description`) 406up-to-date without intervention from the DNS administrator. 407 408When using *yes*, please note that if :any:`trust-anchors` does not include a 409valid root key, then validation does not take place for names which are not 410covered by any of the configured trust anchors. 411 412We recommend using the default *auto* unless there is a good reason to 413require a manual trust anchor. To learn more about trust anchors, 414please refer to :ref:`trusted_keys_and_managed_keys`. 415 416.. _how_does_dnssec_change_dns_lookup_revisited: 417 418How Does DNSSEC Change DNS Lookup (Revisited)? 419^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 420 421Now you've enabled validation on your recursive name server and 422verified that it works. What exactly changed? In 423:ref:`how_does_dnssec_change_dns_lookup` we looked at a very 424high-level, simplified version of the 12 steps of the DNSSEC validation process. Let's revisit 425that process now and see what your validating resolver is doing in more 426detail. Again, as an example we are looking up the A record for the 427domain name ``www.isc.org`` (see :ref:`dnssec_12_steps`): 428 4291. 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 4342. 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 4383. The validating resolver queries for the DNSKEY for ``isc.org``. 439 4404. 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 4435. The validating resolver queries the parent (``.org``) for the DS 444 record for ``isc.org``. 445 4466. 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 4507. The validating resolver queries for the DNSKEY for ``.org``. 451 4528. The ``.org`` name server responds with its DNSKEY and RRSIG. The DNSKEY 453 is used to verify the answers received in #6. 454 4559. The validating resolver queries the parent (root) for the DS record 456 for ``.org``. 457 45810. 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 46111. The validating resolver queries for the DNSKEY for root. 462 46312. The root name server responds with its DNSKEY and RRSIG. The DNSKEY is 464 used to verify the answers received in #10. 465 466After step #12, the validating resolver takes the DNSKEY received and 467compares it to the key or keys it has configured, to decide whether 468the received key can be trusted. We talk about these locally 469configured keys, or trust anchors, in :ref:`trust_anchors_description`. 470 471With DNSSEC, every response includes not just the 472answer, but a digital signature (RRSIG) as well, so the 473validating resolver can verify the answer received. That is what we 474look at in the next section, :ref:`how_are_answers_verified`. 475 476.. _how_are_answers_verified: 477 478How 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 491So how exactly are DNSSEC answers verified? Let's first see how verifiable information is 492generated. On the authoritative server, each DNS record (or message) is 493run through a hash function, and this hashed value is then encrypted by a 494private 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 502When the validating resolver queries for the resource record, it 503receives both the plain-text message and the digital signature(s). The 504validating resolver knows the hash function used (it is listed in the digital 505signature record itself), so it can take the plain-text message and run 506it through the same hash function to produce a hashed value, which we'll call 507hash value X. The validating resolver can also obtain the public key 508(published as DNSKEY records), decrypt the digital signature, and get 509back the original hashed value produced by the authoritative server, 510which we'll call hash value Y. If hash values X and Y are identical, and 511the time is correct (more on what this means below), the answer is 512verified, 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 522Take 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 528The 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 537When a validating resolver queries for the A record ``ftp.isc.org``, it 538receives both the A record and the RRSIG record. It runs the A record 539through a hash function (in this example, SHA256 as 540indicated by the number 13, signifying ECDSAP256SHA256) and produces 541hash value X. The resolver also fetches the appropriate DNSKEY record to 542decrypt the signature, and the result of the decryption is hash value Y. 543 544But wait, there's more! Just because X equals Y doesn't mean everything 545is good. We still have to look at the time. Remember we mentioned a 546little earlier that we need to check if the time is correct? Look 547at the two timestamps in our example above: 548 549- Signature Expiration: 20200401191851 550 551- Signature Inception: 20200302184340 552 553This tells us that this signature was generated UTC March 2nd, 2020, at 5546:43:40 PM (20200302184340), and it is good until UTC April 1st, 2020, 5557:18:51 PM (20200401191851). The validating resolver's current 556system time needs to fall between these two timestamps. If it does not, the 557validation fails, because it could be an attacker replaying an old 558captured answer set from the past, or feeding us a crafted one with 559incorrect future timestamps. 560 561If the answer passes both the hash value check and the timestamp check, it is 562validated and the authenticated data (``ad``) bit is set, and the response 563is sent to the client; if it does not verify, a SERVFAIL is returned to 564the client. 565 566.. _trust_anchors_description: 567 568Trust Anchors 569~~~~~~~~~~~~~ 570 571A trust anchor is a key that is placed into a validating resolver, so 572that the validator can verify the results of a given request with a 573known or trusted public key (the trust anchor). A validating resolver 574must have at least one trust anchor installed to perform DNSSEC 575validation. 576 577.. _how_trust_anchors_are_used: 578 579How Trust Anchors are Used 580~~~~~~~~~~~~~~~~~~~~~~~~~~ 581 582In the section :ref:`how_does_dnssec_change_dns_lookup_revisited`, 583we walked through the 12 steps of the DNSSEC lookup process. At the end 584of the 12 steps, a critical comparison happens: the key received from 585the remote server and the key we have on file are compared to see if we 586trust it. The key we have on file is called a trust anchor, sometimes 587also known as a trust key, trust point, or secure entry point. 588 589The 12-step lookup process describes the DNSSEC lookup in the ideal 590world, where every single domain name is signed and properly delegated, 591and where each validating resolver only needs to have one trust anchor - that 592is, the root's public key. But there is no restriction that the 593validating resolver must only have one trust anchor. In fact, in the 594early stages of DNSSEC adoption, it was not unusual for a validating 595resolver to have more than one trust anchor. 596 597For instance, before the root zone was signed (in July 2010), some 598validating resolvers that wished to validate domain names in the ``.gov`` 599zone needed to obtain and install the key for ``.gov``. A sample lookup 600process for ``www.fbi.gov`` at that time would have been eight steps rather 601than 12: 602 603.. figure:: ../dnssec-guide/img/dnssec-8-steps.png 604 :alt: DNSSEC Validation with ``.gov`` Trust Anchor 605 606 6071. The validating resolver queried ``fbi.gov`` name server for the A 608 record of ``www.fbi.gov``. 609 6102. The FBI's name server responded with the answer and its RRSIG. 611 6123. The validating resolver queried the FBI's name server for its DNSKEY. 613 6144. The FBI's name server responded with the DNSKEY and its RRSIG. 615 6165. The validating resolver queried a ``.gov`` name server for the DS 617 record of ``fbi.gov``. 618 6196. The ``.gov`` name server responded with the DS record and the 620 associated RRSIG for ``fbi.gov``. 621 6227. The validating resolver queried the ``.gov`` name server for its DNSKEY. 623 6248. The ``.gov`` name server responded with its DNSKEY and the associated 625 RRSIG. 626 627This all looks very similar, except it's shorter than the 12 steps that 628we 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 631DS record for ``.gov``, or ask the root name servers for their DNSKEY. 632 633In fact, whenever the validating resolver receives a DNSKEY, it checks 634to see if this is a configured trusted key to decide whether it 635needs to continue chasing down the validation chain. 636 637.. _trusted_keys_and_managed_keys: 638 639Trusted Keys and Managed Keys 640^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 641 642Since the resolver is validating, we must have at least one key (trust 643anchor) configured. How did it get here, and how do we maintain it? 644 645If 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. 648BIND already includes a copy of the root key, and automatically updates it 649when 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 664You can, of course, decide to manage this key manually yourself. 665First, you need to make sure that :any:`dnssec-validation` is set 666to *yes* rather than *auto*: 667 668:: 669 670 options { 671 dnssec-validation yes; 672 }; 673 674Then, download the root key manually from a trustworthy source, 675and 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 690While this :any:`trust-anchors` statement looks similar to the built-in 691version above, the built-in key has the ``initial-key`` modifier, whereas 692in the statement in the configuration file, that is replaced by 693``static-key``. There is an important difference between the two: a key 694defined with ``static-key`` is always trusted until it is deleted from the 695configuration file. With the ``initial-key`` modifier, keys are only 696trusted once: for as long as it takes to load the managed key database and 697start the key maintenance process. Thereafter, BIND uses the managed keys 698database (``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 711Explicit management of keys was common in the early days of DNSSEC, when 712neither the root zone nor many top-level domains were signed. Since 713then, `over 90% <https://ithi.research.icann.org/graph-m7.html>`__ of 714the top-level domains have been signed, including all the largest ones. 715Unless you have a particular need to manage keys yourself, it is best to 716use 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 725What's EDNS All About (And Why Should I Care)? 726~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 727 728.. _whats-edns0-all-about-overview: 729 730EDNS Overview 731^^^^^^^^^^^^^ 732 733Traditional DNS responses are typically small in size (less than 512 734bytes) and fit nicely into a small UDP packet. The Extension mechanism 735for DNS (EDNS, or EDNS(0)) offers a mechanism to send DNS data in 736larger packets over UDP. To support EDNS, both the DNS server 737and the network need to be properly prepared to support the larger 738packet sizes and multiple fragments. 739 740This is important for DNSSEC, since the :option:`dig +do` bit that signals 741DNSSEC-awareness is carried within EDNS, and DNSSEC responses are larger 742than traditional DNS ones. If DNS servers and the network environment cannot 743support large UDP packets, it will cause retransmission over TCP, or the 744larger UDP responses will be discarded. Users will likely experience 745slow DNS resolution or be unable to resolve certain names at all. 746 747Note that EDNS applies regardless of whether you are validating DNSSEC, because 748BIND has DNSSEC enabled by default. 749 750Please see :ref:`network_requirements` for more information on what 751DNSSEC expects from the network environment. 752 753.. _edns_on_dns_servers: 754 755EDNS on DNS Servers 756^^^^^^^^^^^^^^^^^^^ 757 758For many years, BIND has had EDNS enabled by default, 759and the UDP packet size is set to a maximum of 4096 bytes. The DNS 760administrator should not need to perform any reconfiguration. You can 761use :iscman:`dig` to verify that your server supports EDNS and see the UDP packet 762size 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 793There is a helpful testing tool available (provided by DNS-OARC) that 794you can use to verify resolver behavior regarding EDNS support: 795`<https://www.dns-oarc.net/oarc/services/replysizetest/>`__ . 796 797Once you've verified that your name servers have EDNS enabled, that should be the 798end of the story, right? Unfortunately, EDNS is a hop-by-hop extension 799to DNS. This means the use of EDNS is negotiated between each pair of 800hosts in a DNS resolution process, which in turn means if one of your 801upstream name servers (for instance, your ISP's recursive name server 802that your name server forwards to) does not support EDNS, you may experience DNS 803lookup failures or be unable to perform DNSSEC validation. 804 805.. _support_for_large_packets_network_equipment: 806 807Support for Large Packets on Network Equipment 808^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 809 810If both your recursive name server and your ISP's name servers 811support EDNS, we are all good here, right? Not so fast. Since these large 812packets have to traverse the network, the network infrastructure 813itself must allow them to pass. 814 815When data is physically transmitted over a network, it has to be broken 816down into chunks. The size of the data chunk is known as the Maximum 817Transmission Unit (MTU), and it can differ from network to 818network. IP fragmentation occurs when a large data packet needs to be 819broken down into chunks smaller than the 820MTU; these smaller chunks then need to be reassembled back into the large 821data packet at their destination. IP fragmentation is not necessarily a bad thing, and it most 822likely occurs on your network today. 823 824Some network equipment, such as a firewall, may make assumptions about 825DNS traffic. One of these assumptions may be how large each DNS packet 826is. When a firewall sees a larger DNS packet than it expects, it may either 827reject the large packet or drop its fragments because the firewall 828thinks it's an attack. This configuration probably didn't cause problems 829in the past, since traditional DNS packets are usually pretty small in 830size. However, with DNSSEC, these configurations need to be updated, 831since DNSSEC traffic regularly exceeds 1500 bytes (a common MTU value). 832If the configuration is not updated to support a larger DNS packet size, 833it often results in the larger packets being rejected, and to the 834end user it looks like the queries go unanswered. Or in the case of 835fragmentation, only a part of the answer makes it to the validating 836resolver, and your validating resolver may need to re-ask the question 837again and again, creating the appearance for end users that the DNS/network is slow. 838 839While you are updating the configuration on your network equipment, make 840sure TCP port 53 is also allowed for DNS traffic. 841 842.. _dns_uses_tcp: 843 844Wait... DNS Uses TCP? 845^^^^^^^^^^^^^^^^^^^^^ 846 847Yes. DNS uses TCP port 53 as a fallback mechanism, when it cannot use 848UDP to transmit data. This has always been the case, even long before 849the arrival of DNSSEC. Traditional DNS relies on TCP port 53 for 850operations such as zone transfer. The use of DNSSEC, or DNS with IPv6 851records such as AAAA, increases the chance that DNS data will be 852transmitted via TCP. 853 854Due to the increased packet size, DNSSEC may fall back to TCP more often 855than traditional (insecure) DNS. If your network blocks or 856filters TCP port 53 today, you may already experience instability with 857DNS resolution, before even deploying DNSSEC. 858