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