Home | History | Annotate | Line # | Download | only in dnssec-guide
      1  1.1.1.2  christos .. Copyright (C) Internet Systems Consortium, Inc. ("ISC")
      2  1.1.1.2  christos ..
      3  1.1.1.2  christos .. SPDX-License-Identifier: MPL-2.0
      4  1.1.1.2  christos ..
      5  1.1.1.2  christos .. This Source Code Form is subject to the terms of the Mozilla Public
      6  1.1.1.2  christos .. License, v. 2.0.  If a copy of the MPL was not distributed with this
      7  1.1.1.2  christos .. file, you can obtain one at https://mozilla.org/MPL/2.0/.
      8  1.1.1.2  christos ..
      9  1.1.1.2  christos .. See the COPYRIGHT file distributed with this work for additional
     10  1.1.1.2  christos .. information regarding copyright ownership.
     11      1.1  christos 
     12      1.1  christos .. _dnssec_advanced_discussions:
     13      1.1  christos 
     14      1.1  christos Advanced Discussions
     15      1.1  christos --------------------
     16      1.1  christos 
     17      1.1  christos .. _signature_validity_periods:
     18      1.1  christos 
     19      1.1  christos Signature Validity Periods and Zone Re-Signing Intervals
     20      1.1  christos ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     21      1.1  christos 
     22      1.1  christos In :ref:`how_are_answers_verified`, we saw that record signatures
     23      1.1  christos have a validity period outside of which they are not valid. This means
     24      1.1  christos that at some point, a signature will no longer be valid and a query for
     25      1.1  christos the associated record will fail DNSSEC validation. But how long should a
     26      1.1  christos signature be valid for?
     27      1.1  christos 
     28      1.1  christos The maximum value for the validity period should be determined by the impact of a
     29      1.1  christos replay attack: if this is low, the period can be long; if high,
     30      1.1  christos the period should be shorter. There is no "right" value, but periods of
     31      1.1  christos between a few days to a month are common.
     32      1.1  christos 
     33      1.1  christos Deciding a minimum value is probably an easier task. Should something
     34      1.1  christos fail (e.g., a hidden primary distributing to secondary servers that
     35      1.1  christos actually answer queries), how long will it take before the failure is
     36      1.1  christos noticed, and how long before it is fixed? If you are a large 24x7
     37      1.1  christos operation with operators always on-site, the answer might be less than
     38      1.1  christos an hour. In smaller companies, if the failure occurs
     39      1.1  christos just after everyone has gone home for a long weekend, the answer might
     40      1.1  christos be several days.
     41      1.1  christos 
     42      1.1  christos Again, there are no "right" values - they depend on your circumstances. The
     43      1.1  christos signature validity period you decide to use should be a value between
     44      1.1  christos the two bounds. At the time of this writing (mid-2020), the default policy used by BIND
     45      1.1  christos sets a value of 14 days.
     46      1.1  christos 
     47      1.1  christos To keep the zone valid, the signatures must be periodically refreshed
     48      1.1  christos since they expire - i.e., the zone must be periodically
     49      1.1  christos re-signed. The frequency of the re-signing depends on your network's
     50      1.1  christos individual needs. For example, signing puts a load on your server, so if
     51      1.1  christos the server is very highly loaded, a lower re-signing frequency is better. Another
     52      1.1  christos consideration is the signature lifetime: obviously the intervals between
     53      1.1  christos signings must not be longer than the signature validity period. But if
     54      1.1  christos you have set a signature lifetime close to the minimum (see above), the
     55      1.1  christos signing interval must be much shorter. What would happen if the system
     56      1.1  christos failed just before the zone was re-signed?
     57      1.1  christos 
     58      1.1  christos Again, there is no single "right" answer; it depends on your circumstances. The
     59      1.1  christos BIND 9 default policy sets the signature refresh interval to 5 days.
     60      1.1  christos 
     61      1.1  christos .. _advanced_discussions_proof_of_nonexistence:
     62      1.1  christos 
     63      1.1  christos Proof of Non-Existence (NSEC and NSEC3)
     64      1.1  christos ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     65      1.1  christos 
     66      1.1  christos How do you prove that something does not exist? This zen-like question
     67      1.1  christos is an interesting one, and in this section we provide an overview
     68      1.1  christos of how DNSSEC solves the problem.
     69      1.1  christos 
     70      1.1  christos Why is it even important to have authenticated denial of existence in DNS?
     71      1.1  christos Couldn't we just send back "hey, what you asked for does not exist,"
     72      1.1  christos and somehow generate a digital signature to go with it, proving it
     73      1.1  christos really is from the correct authoritative source? Aside from the technical
     74      1.1  christos challenge of signing something that doesn't exist, this solution has flaws, one of
     75      1.1  christos which is it gives an attacker a way to create the appearance of denial
     76      1.1  christos of service by replaying this message on the network.
     77      1.1  christos 
     78      1.1  christos Let's use a little story, told three different ways, to
     79      1.1  christos illustrate how proof of nonexistence works. In our story, we run a small
     80      1.1  christos company with three employees: Alice, Edward, and Susan. For reasons that
     81      1.1  christos are far too complicated to go into, they don't have email accounts;
     82      1.1  christos instead, email for them is sent to a single account and a nameless
     83      1.1  christos intern passes the message to them. The intern has access to our private
     84      1.1  christos DNSSEC key to create signatures for their responses.
     85      1.1  christos 
     86      1.1  christos If we followed the approach of giving back the same answer no matter
     87      1.1  christos what was asked, when people emailed and asked for the message to be
     88      1.1  christos passed to "Bob," our intern would simply answer "Sorry, that person
     89      1.1  christos doesnt work here" and sign this message. This answer could be validated
     90      1.1  christos because our intern signed the response with our private DNSSEC key.
     91      1.1  christos However, since the signature doesnt change, an attacker could record
     92      1.1  christos this message. If the attacker were able to intercept our email, when the next
     93      1.1  christos person emailed asking for the message to be passed to Susan, the attacker
     94      1.1  christos could return the exact same message: "Sorry, that person doesnt work
     95      1.1  christos here," with the same signature. Now the attacker has successfully fooled
     96      1.1  christos the sender into thinking that Susan doesnt work at our company, and
     97      1.1  christos might even be able to convince all senders that no one works at this
     98      1.1  christos company.
     99      1.1  christos 
    100      1.1  christos To solve this problem, two different solutions were created. We will
    101      1.1  christos look at the first one, NSEC, next.
    102      1.1  christos 
    103      1.1  christos .. _advanced_discussions_nsec:
    104  1.1.1.2  christos .. _NSEC:
    105      1.1  christos 
    106      1.1  christos NSEC
    107      1.1  christos ^^^^
    108      1.1  christos 
    109      1.1  christos The NSEC record is used to prove that something does not exist, by
    110      1.1  christos providing the name before it and the name after it. Using our tiny
    111      1.1  christos company example, this would be analogous to someone sending an email for
    112      1.1  christos Bob and our nameless intern responding with with: "I'm sorry, that
    113      1.1  christos person doesn't work here. The name before the location where 'Bob'
    114      1.1  christos would be is Alice, and the name after that is Edward." Let's say
    115      1.1  christos another email was received for a
    116      1.1  christos non-existent person, this time Oliver; our intern would respond "I'm
    117      1.1  christos sorry, that person doesn't work here. The name before the location
    118      1.1  christos where 'Oliver' would be is Edward,
    119      1.1  christos and the name after that is Susan." If another sender asked for Todd, the
    120      1.1  christos answer would be: "I'm sorry, that person doesn't work here. The name
    121      1.1  christos before the location where 'Todd' would be is Susan, and there are no
    122      1.1  christos other names after that."
    123      1.1  christos 
    124      1.1  christos So we end up with four NSEC records:
    125      1.1  christos 
    126      1.1  christos ::
    127      1.1  christos 
    128  1.1.1.2  christos    example.com.        300 IN  NSEC    alice.example.com.  A RRSIG NSEC
    129      1.1  christos    alice.example.com.  300 IN  NSEC    edward.example.com. A RRSIG NSEC
    130      1.1  christos    edward.example.com. 300 IN  NSEC    susan.example.com.  A RRSIG NSEC
    131      1.1  christos    susan.example.com.  300 IN  NSEC    example.com.        A RRSIG NSEC
    132      1.1  christos 
    133      1.1  christos What if the attacker tried to use the same replay method described
    134      1.1  christos earlier? If someone sent an email for Edward, none of the four answers
    135      1.1  christos would fit. If attacker replied with message #2, "I'm sorry, that person
    136      1.1  christos doesn't work here. The name before it is Alice, and the name after it is
    137      1.1  christos Edward," it is obviously false, since "Edward" is in the response; and the same
    138      1.1  christos goes for #3, Edward and Susan. As for #1 and #4, Edward does not fall in
    139      1.1  christos the alphabetical range before Alice or after Susan, so the sender can logically deduce
    140      1.1  christos that it was an incorrect answer.
    141      1.1  christos 
    142      1.1  christos When BIND signs your zone, the zone data is automatically sorted on
    143      1.1  christos the fly before generating NSEC records, much like how a phone directory
    144      1.1  christos is sorted.
    145      1.1  christos 
    146      1.1  christos The NSEC record allows for a proof of non-existence for record types. If
    147      1.1  christos you ask a signed zone for a name that exists but for a record type that
    148      1.1  christos doesn't (for that name), the signed NSEC record returned lists all of
    149      1.1  christos the record types that *do* exist for the requested domain name.
    150      1.1  christos 
    151      1.1  christos NSEC records can also be used to show whether a record was generated as
    152      1.1  christos the result of a wildcard expansion. The details of this are not
    153      1.1  christos within the scope of this document, but are described well in
    154      1.1  christos :rfc:`7129`.
    155      1.1  christos 
    156      1.1  christos Unfortunately, the NSEC solution has a few drawbacks, one of which is
    157      1.1  christos trivial "zone walking." In our story, a curious person can keep sending emails, and
    158      1.1  christos our nameless, gullible intern keeps divulging information about our
    159      1.1  christos employees. Imagine if the sender first asked: "Is Bob there?" and
    160      1.1  christos received back the names Alice and Edward. Our sender could then email
    161      1.1  christos again: "Is Edwarda there?", and will get back Edward and Susan. (No,
    162      1.1  christos "Edwarda" is not a real name. However, it is the first name
    163      1.1  christos alphabetically after "Edward" and that is enough to get the intern to reply
    164      1.1  christos with a message telling us the next valid name after Edward.) Repeat the
    165      1.1  christos process enough times and the person sending the emails eventually
    166      1.1  christos learns every name in our company phone directory. For many of you, this
    167      1.1  christos may not be a problem, since the very idea of DNS is similar to a public
    168      1.1  christos phone book: if you don't want a name to be known publicly, don't put it
    169      1.1  christos in DNS! Consider using DNS views (split DNS) and only display your
    170      1.1  christos sensitive names to a select audience.
    171      1.1  christos 
    172  1.1.1.2  christos The second potential drawback of NSEC is a bigger zone file and memory consumption;
    173  1.1.1.2  christos there is no opt-out mechanism for insecure child zones, so each name
    174  1.1.1.2  christos in the zone will get an additional NSEC record and a RRSIG record to go with
    175  1.1.1.2  christos it. In practice this is a problem only for parent-zone operators dealing with
    176  1.1.1.2  christos mostly insecure child zones, such as ``com.``. To learn more about opt-out,
    177  1.1.1.2  christos please see :ref:`advanced_discussions_nsec3_optout`.
    178      1.1  christos 
    179      1.1  christos .. _advanced_discussions_nsec3:
    180  1.1.1.2  christos .. _nsec3:
    181      1.1  christos 
    182      1.1  christos NSEC3
    183      1.1  christos ^^^^^
    184      1.1  christos 
    185      1.1  christos NSEC3 adds two additional features that NSEC does not have:
    186      1.1  christos 
    187      1.1  christos 1. It offers no easy zone enumeration.
    188      1.1  christos 
    189      1.1  christos 2. It provides a mechanism for the parent zone to exclude insecure
    190      1.1  christos    delegations (i.e., delegations to zones that are not signed) from the
    191      1.1  christos    proof of non-existence.
    192      1.1  christos 
    193      1.1  christos Recall that in :ref:`advanced_discussions_nsec` we provided a range of
    194      1.1  christos names to prove that something does not exist. But as it turns
    195      1.1  christos out, even disclosing these ranges of names becomes a problem: this made
    196      1.1  christos it very easy for the curious-minded to look at our entire zone. Not
    197      1.1  christos only that, unlike a zone transfer, this "zone walking" is more
    198      1.1  christos resource-intensive. So how do we disclose something without actually disclosing
    199      1.1  christos it?
    200      1.1  christos 
    201      1.1  christos The answer is actually quite simple: hashing functions, or one-way
    202      1.1  christos hashes. Without going into many details, think of it like a magical meat
    203      1.1  christos grinder. A juicy piece of ribeye steak goes in one end, and out comes a
    204      1.1  christos predictable shape and size of ground meat (hash) with a somewhat unique
    205      1.1  christos pattern. No matter how hard you try, you cannot turn the ground meat
    206      1.1  christos back into the ribeye steak: that's what we call a one-way hash.
    207      1.1  christos 
    208      1.1  christos NSEC3 basically runs the names through a one-way hash before giving them
    209      1.1  christos out, so the recipients can verify the non-existence without any
    210  1.1.1.2  christos knowledge of the other names in the zone.
    211      1.1  christos 
    212      1.1  christos So let's tell our little story for the third time, this
    213      1.1  christos time with NSEC3. In this version, our intern is not given a list of actual
    214      1.1  christos names; he is given a list of "hashed" names. So instead of Alice,
    215      1.1  christos Edward, and Susan, the list he is given reads like this (hashes
    216      1.1  christos shortened for easier reading):
    217      1.1  christos 
    218      1.1  christos ::
    219      1.1  christos 
    220      1.1  christos    FSK5.... (produced from Edward)
    221      1.1  christos    JKMA.... (produced from Susan)
    222      1.1  christos    NTQ0.... (produced from Alice)
    223      1.1  christos 
    224      1.1  christos Then, an email is received for Bob again. Our intern takes the name Bob
    225      1.1  christos through a hash function, and the result is L8J2..., so he replies: "I'm
    226      1.1  christos sorry, that person doesn't work here. The name before that is JKMA...,
    227      1.1  christos and the name after that is NTQ0...". There, we proved Bob doesn't exist,
    228      1.1  christos without giving away any names! To put that into proper NSEC3 resource
    229      1.1  christos records, they would look like this (again, hashes shortened for
    230      1.1  christos ease of display):
    231      1.1  christos 
    232      1.1  christos ::
    233      1.1  christos 
    234  1.1.1.2  christos    FSK5....example.com. 300 IN NSEC3 1 0 0 -  JKMA... A RRSIG
    235  1.1.1.2  christos    JKMA....example.com. 300 IN NSEC3 1 0 0 -  NTQ0... A RRSIG
    236  1.1.1.2  christos    NTQ0....example.com. 300 IN NSEC3 1 0 0 -  FSK5... A RRSIG
    237      1.1  christos 
    238      1.1  christos .. note::
    239      1.1  christos 
    240      1.1  christos    Just because we employed one-way hash functions does not mean there is
    241      1.1  christos    no way for a determined individual to figure out our zone data.
    242  1.1.1.2  christos 
    243  1.1.1.2  christos Most names published in the DNS are rarely secret or unpredictable. They are
    244  1.1.1.2  christos published to be memorable, used and consumed by humans. They are often recorded
    245  1.1.1.2  christos in many other network logs such as email logs, certificate transparency logs,
    246  1.1.1.2  christos web page links, intrusion detection systems, malware scanners, email archives,
    247  1.1.1.2  christos etc. Many times a simple dictionary of commonly used domain-name prefixes
    248  1.1.1.2  christos (www, mail, imap, login, database, etc.) can be used to quickly reveal a large
    249  1.1.1.2  christos number of labels within a zone. Additionally, if an adversary really wants to
    250  1.1.1.2  christos expend significant CPU resources to mount an offline dictionary attack on a
    251  1.1.1.2  christos zone's NSEC3 chain, they will likely be able to find most of the "guessable"
    252  1.1.1.2  christos names despite any level of hashing.
    253  1.1.1.2  christos 
    254  1.1.1.2  christos Also, it is still possible to gather all of our NSEC3 records and hashed
    255  1.1.1.2  christos names and perform an offline brute-force attack by trying all
    256  1.1.1.2  christos possible combinations to figure out what the original name is. In our
    257  1.1.1.2  christos meat-grinder analogy, this would be like someone
    258  1.1.1.2  christos buying all available cuts of meat and grinding them up at home using
    259  1.1.1.2  christos the same model of meat grinder, and comparing the output with the meat
    260  1.1.1.2  christos you gave him. It is expensive and time-consuming (especially with
    261  1.1.1.2  christos real meat), but like everything else in cryptography, if someone has
    262  1.1.1.2  christos enough resources and time, nothing is truly private forever. If you
    263  1.1.1.2  christos are concerned about someone performing this type of attack on your
    264  1.1.1.2  christos zone data, use some of the special techniques described in :rfc:`4470`.
    265      1.1  christos 
    266      1.1  christos .. _advanced_discussions_nsec3param:
    267      1.1  christos 
    268      1.1  christos NSEC3PARAM
    269      1.1  christos ++++++++++
    270      1.1  christos 
    271  1.1.1.2  christos .. warning::
    272  1.1.1.2  christos    Before we dive into the details of NSEC3 parametrization, please note:
    273  1.1.1.2  christos    the defaults should not be changed without a strong justification and a full
    274  1.1.1.4  christos    understanding of the potential impact. See :rfc:`9276`.
    275  1.1.1.2  christos 
    276  1.1.1.2  christos The above NSEC3 examples used four parameters: 1, 0, 0, and
    277  1.1.1.2  christos zero-length salt. 1 represents the algorithm, 0 represents the opt-out
    278  1.1.1.2  christos flag, 0 represents the number of additional iterations, and - is the
    279      1.1  christos salt. Let's look at how each one can be configured:
    280      1.1  christos 
    281  1.1.1.2  christos .. glossary::
    282      1.1  christos 
    283  1.1.1.2  christos    Algorithm
    284  1.1.1.2  christos    NSEC3 Hashing Algorithm
    285  1.1.1.2  christos       The only currently defined value is 1 for SHA-1, so there
    286  1.1.1.2  christos       is no configuration field for it.
    287  1.1.1.2  christos 
    288  1.1.1.2  christos    Opt-out
    289  1.1.1.2  christos       Setting this bit to 1 enables NSEC3 opt-out, which is
    290  1.1.1.2  christos       discussed in :ref:`advanced_discussions_nsec3_optout`.
    291  1.1.1.2  christos 
    292  1.1.1.2  christos    Iterations
    293  1.1.1.2  christos       Iterations defines the number of _additional_ times to
    294  1.1.1.2  christos       apply the algorithm when generating an NSEC3 hash. More iterations
    295  1.1.1.2  christos       consume more resources for both authoritative servers and validating
    296  1.1.1.2  christos       resolvers. The considerations here are similar to those seen in
    297  1.1.1.2  christos       :ref:`key_sizes`, of security versus resources.
    298  1.1.1.2  christos 
    299  1.1.1.2  christos       .. warning::
    300  1.1.1.2  christos          Do not use values higher than zero. A value of zero provides one round
    301  1.1.1.2  christos          of SHA-1 hashing and protects from non-determined attackers.
    302  1.1.1.2  christos 
    303  1.1.1.2  christos          A greater number of additional iterations causes interoperability problems
    304  1.1.1.2  christos          and opens servers to CPU-exhausting DoS attacks, while providing
    305  1.1.1.2  christos          only doubtful security benefits.
    306  1.1.1.2  christos 
    307  1.1.1.2  christos    Salt
    308  1.1.1.2  christos       A salt value, which can be combined with an FQDN to influence the
    309  1.1.1.2  christos       resulting hash. Salt is discussed in more detail in
    310  1.1.1.2  christos       :ref:`advanced_discussions_nsec3_salt`.
    311      1.1  christos 
    312  1.1.1.2  christos .. _advanced_discussions_nsec3_optout:
    313      1.1  christos 
    314  1.1.1.2  christos NSEC3 Opt-Out
    315  1.1.1.2  christos +++++++++++++
    316      1.1  christos 
    317  1.1.1.2  christos First things first: For most DNS administrators who do not manage a huge number
    318  1.1.1.4  christos of insecure delegations, the NSEC3 opt-out featuere is not relevant. See :rfc:`9276`.
    319      1.1  christos 
    320  1.1.1.2  christos Opt-out allows for blocks of unsigned delegations to be covered by a single NSEC3
    321  1.1.1.2  christos record. In other words, use of the opt-out allows large registries to only sign as
    322  1.1.1.2  christos many NSEC3 records as there are signed DS or other RRsets in the zone; with
    323  1.1.1.2  christos opt-out, unsigned delegations do not require additional NSEC3 records. This
    324  1.1.1.2  christos sacrifices the tamper-resistance proof of non-existence offered by NSEC3 in
    325  1.1.1.2  christos order to reduce memory and CPU overheads, and decreases the effectiveness of the cache
    326  1.1.1.2  christos (:rfc:`8198`).
    327  1.1.1.2  christos 
    328  1.1.1.2  christos Why would that ever be desirable? If a significant number of delegations
    329  1.1.1.2  christos are not yet securely delegated, meaning they lack DS records and are still
    330  1.1.1.2  christos insecure or unsigned, generating DNSSEC records for all their NS records
    331  1.1.1.2  christos might consume lots of memory and is not strictly required by the child zones.
    332  1.1.1.2  christos 
    333  1.1.1.2  christos This resource-saving typically makes a difference only for *huge* zones like ``com.``.
    334  1.1.1.2  christos Imagine that you are the operator of busy top-level domains such as ``com.``,
    335  1.1.1.2  christos with millions of insecure delegated domain names.
    336  1.1.1.2  christos As of mid-2022, around 3% of all ``com.`` zones are signed. Basically,
    337  1.1.1.2  christos without opt-out, with 1,000,000 delegations, only 30,000 of which are secure, you
    338  1.1.1.2  christos still have to generate NSEC RRsets for the other 970,000 delegations; with
    339  1.1.1.2  christos NSEC3 opt-out, you will have saved yourself 970,000 sets of records.
    340  1.1.1.2  christos 
    341  1.1.1.2  christos In contrast, for a small zone the difference is operationally negligible
    342  1.1.1.2  christos and the drawbacks outweigh the benefits.
    343  1.1.1.2  christos 
    344  1.1.1.2  christos If NSEC3 opt-out is truly essential for a zone, the following
    345  1.1.1.3  christos configuration can be added to :any:`dnssec-policy`; for example, to create an
    346  1.1.1.2  christos NSEC3 chain using the SHA-1 hash algorithm, with the opt-out flag,
    347  1.1.1.2  christos no additional iterations, and no extra salt, use:
    348      1.1  christos 
    349  1.1.1.2  christos .. code-block:: none
    350      1.1  christos 
    351      1.1  christos    dnssec-policy "nsec3" {
    352      1.1  christos        ...
    353  1.1.1.2  christos        nsec3param iterations 0 optout yes salt-length 0;
    354      1.1  christos    };
    355      1.1  christos 
    356      1.1  christos 
    357      1.1  christos 
    358      1.1  christos To learn more about how to configure NSEC3 opt-out, please see
    359      1.1  christos :ref:`recipes_nsec3_optout`.
    360      1.1  christos 
    361      1.1  christos .. _advanced_discussions_nsec3_salt:
    362      1.1  christos 
    363      1.1  christos NSEC3 Salt
    364      1.1  christos ++++++++++
    365      1.1  christos 
    366  1.1.1.2  christos .. warning::
    367  1.1.1.2  christos    Contrary to popular belief, adding salt provides little value.
    368  1.1.1.2  christos    Each DNS zone is always uniquely salted using the zone name. **Operators should
    369  1.1.1.2  christos    use a zero-length salt value.**
    370  1.1.1.2  christos 
    371  1.1.1.2  christos The properties of this extra salt are complicated and beyond scope of this
    372  1.1.1.2  christos document. For detailed description why the salt in the context of DNSSEC
    373  1.1.1.4  christos provides little value please see :rfc:`9276`.
    374      1.1  christos 
    375      1.1  christos .. _advanced_discussions_nsec_or_nsec3:
    376      1.1  christos 
    377      1.1  christos NSEC or NSEC3?
    378      1.1  christos ^^^^^^^^^^^^^^
    379      1.1  christos 
    380  1.1.1.2  christos So which is better: NSEC or NSEC3? There is no single right
    381  1.1.1.2  christos answer here that fits everyone; it comes down to a given network's needs or
    382  1.1.1.2  christos requirements.
    383  1.1.1.2  christos 
    384  1.1.1.2  christos In most cases, NSEC is a good choice for zone administrators. It
    385  1.1.1.2  christos relieves the authoritative servers and resolver of the additional cryptographic
    386  1.1.1.2  christos operations that NSEC3 requires, and NSEC is comparatively easier to
    387  1.1.1.2  christos troubleshoot than NSEC3.
    388  1.1.1.2  christos 
    389  1.1.1.2  christos NSEC3 comes with many drawbacks and should be implemented only if zone
    390  1.1.1.2  christos enumeration prevention is really needed, or when opt-out provides a
    391  1.1.1.2  christos significant reduction in memory and CPU overheads (in other words, with a
    392  1.1.1.2  christos huge zone with mostly insecure delegations).
    393      1.1  christos 
    394      1.1  christos .. _advanced_discussions_key_generation:
    395      1.1  christos 
    396      1.1  christos DNSSEC Keys
    397      1.1  christos ~~~~~~~~~~~
    398      1.1  christos 
    399      1.1  christos Types of Keys
    400      1.1  christos ^^^^^^^^^^^^^
    401      1.1  christos 
    402      1.1  christos Although DNSSEC
    403      1.1  christos documentation talks about three types of keys, they are all the same
    404      1.1  christos thing - but they have different roles. The roles are:
    405      1.1  christos 
    406      1.1  christos Zone-Signing Key (ZSK)
    407      1.1  christos    This is the key used to sign the zone. It signs all records in the
    408      1.1  christos    zone apart from the DNSSEC key-related RRsets: DNSKEY, CDS, and
    409      1.1  christos    CDNSKEY.
    410      1.1  christos 
    411      1.1  christos Key-Signing Key (KSK)
    412      1.1  christos    This is the key used to sign the DNSSEC key-related RRsets and is the
    413      1.1  christos    key used to link the parent and child zones. The parent zone stores a
    414      1.1  christos    digest of the KSK. When a resolver verifies the chain of trust it
    415      1.1  christos    checks to see that the DS record in the parent (which holds the
    416      1.1  christos    digest of a key) matches a key in the DNSKEY RRset, and that it is
    417      1.1  christos    able to use that key to verify the DNSKEY RRset. If it can do
    418      1.1  christos    that, the resolver knows that it can trust the DNSKEY resource
    419      1.1  christos    records, and so can use one of them to validate the other records in
    420      1.1  christos    the zone.
    421      1.1  christos 
    422      1.1  christos Combined Signing Key (CSK)
    423      1.1  christos    A CSK combines the functionality of a ZSK and a KSK. Instead of
    424      1.1  christos    having one key for signing the zone and one for linking the parent
    425      1.1  christos    and child zones, a CSK is a single key that serves both roles.
    426      1.1  christos 
    427      1.1  christos It is important to realize the terms ZSK, KSK, and CSK describe how the
    428      1.1  christos keys are used - all these keys are represented by DNSKEY records. The
    429      1.1  christos following examples are the DNSKEY records from a zone signed with a KSK
    430      1.1  christos and ZSK:
    431      1.1  christos 
    432      1.1  christos ::
    433      1.1  christos 
    434      1.1  christos    $ dig @192.168.1.12 example.com DNSKEY
    435      1.1  christos 
    436      1.1  christos    ; <<>> DiG 9.16.0 <<>> @192.168.1.12 example.com dnskey +multiline
    437      1.1  christos    ; (1 server found)
    438      1.1  christos    ;; global options: +cmd
    439      1.1  christos    ;; Got answer:
    440      1.1  christos    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 54989
    441      1.1  christos    ;; flags: qr aa rd; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
    442      1.1  christos    ;; WARNING: recursion requested but not available
    443      1.1  christos 
    444      1.1  christos    ;; OPT PSEUDOSECTION:
    445      1.1  christos    ; EDNS: version: 0, flags:; udp: 4096
    446      1.1  christos    ; COOKIE: 5258d7ed09db0d76010000005ea1cc8c672d8db27a464e37 (good)
    447      1.1  christos    ;; QUESTION SECTION:
    448      1.1  christos    ;example.com.       IN DNSKEY
    449      1.1  christos 
    450      1.1  christos    ;; ANSWER SECTION:
    451      1.1  christos    example.com.        60 IN DNSKEY 256 3 13 (
    452      1.1  christos                    tAeXLtIQ3aVDqqS/1UVRt9AE6/nzfoAuaT1Vy4dYl2CK
    453      1.1  christos                    pLNcUJxME1Z//pnGXY+HqDU7Gr5HkJY8V0W3r5fzlw==
    454      1.1  christos                    ) ; ZSK; alg = ECDSAP256SHA256 ; key id = 63722
    455      1.1  christos    example.com.        60 IN DNSKEY 257 3 13 (
    456      1.1  christos                    cxkNegsgubBPXSra5ug2P8rWy63B8jTnS4n0IYSsD9eW
    457      1.1  christos                    VhiyQDmdgevKUhfG3SE1wbLChjJc2FAbvSZ1qk03Nw==
    458      1.1  christos                    ) ; KSK; alg = ECDSAP256SHA256 ; key id = 42933
    459      1.1  christos 
    460      1.1  christos ... and a zone signed with just a CSK:
    461      1.1  christos 
    462      1.1  christos ::
    463      1.1  christos 
    464      1.1  christos    $ dig @192.168.1.13 example.com DNSKEY
    465      1.1  christos 
    466      1.1  christos    ; <<>> DiG 9.16.0 <<>> @192.168.1.13 example.com dnskey +multiline
    467      1.1  christos    ; (1 server found)
    468      1.1  christos    ;; global options: +cmd
    469      1.1  christos    ;; Got answer:
    470      1.1  christos    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 22628
    471      1.1  christos    ;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
    472      1.1  christos    ;; WARNING: recursion requested but not available
    473      1.1  christos 
    474      1.1  christos    ;; OPT PSEUDOSECTION:
    475      1.1  christos    ; EDNS: version: 0, flags:; udp: 4096
    476      1.1  christos    ; COOKIE: bf19ee914b5df46e010000005ea1cd02b66c06885d274647 (good)
    477      1.1  christos    ;; QUESTION SECTION:
    478      1.1  christos    ;example.com.       IN DNSKEY
    479      1.1  christos 
    480      1.1  christos    ;; ANSWER SECTION:
    481      1.1  christos    example.com.        60 IN DNSKEY 257 3 13 (
    482      1.1  christos                    p0XM6AJ68qid2vtOdyGaeH1jnrdk2GhZeVvGzXfP/PNa
    483      1.1  christos                    71wGtzR6jdUrTbXo5Z1W5QeeJF4dls4lh4z7DByF5Q==
    484      1.1  christos                    ) ; KSK; alg = ECDSAP256SHA256 ; key id = 1231
    485      1.1  christos 
    486      1.1  christos The only visible difference between the records (apart from the key data
    487      1.1  christos itself) is the value of the flags fields; this is 256
    488      1.1  christos for a ZSK and 257 for a KSK or CSK. Even then, the flags field is only a
    489      1.1  christos hint to the software using it as to the role of the key: zones can be
    490      1.1  christos signed by any key. The fact that a CSK and KSK both have the same flags
    491      1.1  christos emphasizes this. A KSK usually only signs the DNSSEC key-related RRsets
    492      1.1  christos in a zone, whereas a CSK is used to sign all records in the zone.
    493      1.1  christos 
    494      1.1  christos The original idea of separating the function of the key into a KSK and
    495      1.1  christos ZSK was operational. With a single key, changing it for any reason is
    496      1.1  christos "expensive," as it requires interaction with the parent zone
    497      1.1  christos (e.g., uploading the key to the parent may require manual interaction
    498      1.1  christos with the organization running that zone). By splitting it, interaction
    499      1.1  christos with the parent is required only if the KSK is changed; the ZSK can be
    500      1.1  christos changed as often as required without involving the parent.
    501      1.1  christos 
    502      1.1  christos The split also allows the keys to be of different lengths. So the ZSK,
    503      1.1  christos which is used to sign the record in the zone, can be of a (relatively)
    504      1.1  christos short length, lowering the load on the server. The KSK, which is used
    505      1.1  christos only infrequently, can be of a much longer length. The relatively
    506      1.1  christos infrequent use also allows the private part of the key to be stored in a
    507      1.1  christos way that is more secure but that may require more overhead to access, e.g., on
    508      1.1  christos an HSM (see :ref:`hardware_security_modules`).
    509      1.1  christos 
    510      1.1  christos In the early days of DNSSEC, the idea of splitting the key went more or
    511      1.1  christos less unchallenged. However, with the advent of more powerful computers
    512      1.1  christos and the introduction of signaling methods between the parent and child
    513      1.1  christos zones (see :ref:`cds_cdnskey`), the advantages of a ZSK/KSK split are
    514      1.1  christos less clear and, for many zones, a single key is all that is required.
    515      1.1  christos 
    516      1.1  christos As with many questions related to the choice of DNSSEC policy, the
    517      1.1  christos decision on which is "best" is not clear and depends on your circumstances.
    518      1.1  christos 
    519      1.1  christos Which Algorithm?
    520      1.1  christos ^^^^^^^^^^^^^^^^
    521      1.1  christos 
    522      1.1  christos There are three algorithm choices for DNSSEC as of this writing
    523      1.1  christos (mid-2020):
    524      1.1  christos 
    525      1.1  christos -  RSA
    526      1.1  christos 
    527      1.1  christos -  Elliptic Curve DSA (ECDSA)
    528      1.1  christos 
    529      1.1  christos -  Edwards Curve Digital Security Algorithm (EdDSA)
    530      1.1  christos 
    531      1.1  christos All are supported in BIND 9, but only RSA and ECDSA (specifically
    532      1.1  christos RSASHA256 and ECDSAP256SHA256) are mandatory to implement in DNSSEC.
    533      1.1  christos However, RSA is a little long in the tooth, and ECDSA/EdDSA are emerging
    534      1.1  christos as the next new cryptographic standards. In fact, the US federal
    535      1.1  christos government recommended discontinuing RSA use altogether by September 2015
    536      1.1  christos and migrating to using ECDSA or similar algorithms.
    537      1.1  christos 
    538      1.1  christos For now, use ECDSAP256SHA256 but keep abreast of developments in this
    539      1.1  christos area. For details about rolling over DNSKEYs to a new algorithm, see
    540      1.1  christos :ref:`advanced_discussions_DNSKEY_algorithm_rollovers`.
    541      1.1  christos 
    542      1.1  christos .. _key_sizes:
    543      1.1  christos 
    544      1.1  christos Key Sizes
    545      1.1  christos ^^^^^^^^^
    546      1.1  christos 
    547      1.1  christos If using RSA keys, the choice of key sizes is a classic issue of finding
    548      1.1  christos the balance between performance and security. The larger the key size,
    549      1.1  christos the longer it takes for an attacker to crack the key; but larger keys
    550      1.1  christos also mean more resources are needed both when generating signatures
    551      1.1  christos (authoritative servers) and verifying signatures (recursive servers).
    552      1.1  christos 
    553      1.1  christos Of the two sets of keys, ZSK is used much more frequently. ZSK is used whenever zone
    554      1.1  christos data changes or when signatures expire, so performance
    555      1.1  christos certainly is of a bigger concern. As for KSK, it is used less
    556      1.1  christos frequently, so performance is less of a factor, but its impact is bigger
    557      1.1  christos because of its role in signing other keys.
    558      1.1  christos 
    559      1.1  christos In earlier versions of this guide, the following key lengths were
    560      1.1  christos chosen for each set, with the recommendation that they be rotated more
    561      1.1  christos frequently for better security:
    562      1.1  christos 
    563      1.1  christos -  *ZSK*: RSA 1024 bits, rollover every year
    564      1.1  christos 
    565      1.1  christos -  *KSK*: RSA 2048 bits, rollover every five years
    566      1.1  christos 
    567      1.1  christos These should be considered minimum RSA key sizes. At the time
    568      1.1  christos of this writing (mid-2020), the root zone and many TLDs are already using 2048
    569      1.1  christos bit ZSKs. If you choose to implement larger key sizes, keep in mind that
    570      1.1  christos larger key sizes result in larger DNS responses, which this may mean more
    571      1.1  christos load on network resources. Depending on your network configuration, end users
    572      1.1  christos may even experience resolution failures due to the increased response
    573      1.1  christos sizes, as discussed in :ref:`whats_edns0_all_about`.
    574      1.1  christos 
    575      1.1  christos ECDSA key sizes can be much smaller for the same level of security, e.g.,
    576      1.1  christos an ECDSA key length of 224 bits provides the same level of security as a
    577      1.1  christos 2048-bit RSA key. Currently BIND 9 sets a key size of 256 for all ECDSA keys.
    578      1.1  christos 
    579      1.1  christos .. _advanced_discussions_key_storage:
    580      1.1  christos 
    581      1.1  christos Key Storage
    582      1.1  christos ^^^^^^^^^^^
    583      1.1  christos 
    584      1.1  christos Public Key Storage
    585      1.1  christos ++++++++++++++++++
    586      1.1  christos 
    587      1.1  christos The beauty of a public key cryptography system is that the public key
    588      1.1  christos portion can and should be distributed to as many people as possible. As
    589      1.1  christos the administrator, you may want to keep the public keys on an easily
    590      1.1  christos accessible file system for operational ease, but there is no need to
    591      1.1  christos securely store them, since both ZSK and KSK public keys are published in
    592      1.1  christos the zone data as DNSKEY resource records.
    593      1.1  christos 
    594      1.1  christos Additionally, a hash of the KSK public key is also uploaded to the
    595      1.1  christos parent zone (see :ref:`working_with_parent_zone` for more details),
    596      1.1  christos and is published by the parent zone as DS records.
    597      1.1  christos 
    598      1.1  christos Private Key Storage
    599      1.1  christos +++++++++++++++++++
    600      1.1  christos 
    601      1.1  christos Ideally, private keys should be stored offline, in secure devices such
    602      1.1  christos as a smart card. Operationally, however, this creates certain
    603      1.1  christos challenges, since the private key is needed to create RRSIG resource
    604      1.1  christos records, and it is a hassle to bring the private key out of
    605      1.1  christos storage every time the zone file changes or signatures expire.
    606      1.1  christos 
    607      1.1  christos A common approach to strike the balance between security and
    608      1.1  christos practicality is to have two sets of keys: a ZSK set and a KSK set. A ZSK
    609      1.1  christos private key is used to sign zone data, and can be kept online for ease
    610      1.1  christos of use, while a KSK private key is used to sign just the DNSKEY (the ZSK); it is
    611      1.1  christos used less frequently, and can be stored in a much more secure and
    612      1.1  christos restricted fashion.
    613      1.1  christos 
    614      1.1  christos For example, a KSK private key stored on a USB flash drive that is kept
    615      1.1  christos in a fireproof safe, only brought online once a year to sign a new pair
    616      1.1  christos of ZSKs, combined with a ZSK private key stored on the network
    617      1.1  christos file system and available for routine use, may be a good balance between
    618      1.1  christos operational flexibility and security.
    619      1.1  christos 
    620      1.1  christos For more information on changing keys, please see
    621      1.1  christos :ref:`key_rollovers`.
    622      1.1  christos 
    623      1.1  christos .. _hardware_security_modules:
    624      1.1  christos 
    625      1.1  christos Hardware Security Modules (HSMs)
    626      1.1  christos ++++++++++++++++++++++++++++++++
    627      1.1  christos 
    628      1.1  christos A Hardware Security Module (HSM) may come in different shapes and sizes,
    629      1.1  christos but as the name indicates, it is a physical device or devices, usually
    630      1.1  christos with some or all of the following features:
    631      1.1  christos 
    632      1.1  christos -  Tamper-resistant key storage
    633      1.1  christos 
    634      1.1  christos -  Strong random-number generation
    635      1.1  christos 
    636      1.1  christos -  Hardware for faster cryptographic operations
    637      1.1  christos 
    638      1.1  christos Most organizations do not incorporate HSMs into their security practices
    639      1.1  christos due to cost and the added operational complexity.
    640      1.1  christos 
    641      1.1  christos BIND supports Public Key Cryptography Standard #11 (PKCS #11) for
    642      1.1  christos communication with HSMs and other cryptographic support devices. For
    643      1.1  christos more information on how to configure BIND to work with an HSM, please
    644      1.1  christos refer to the `BIND 9 Administrator Reference
    645      1.1  christos Manual <https://bind9.readthedocs.io/en/latest/index.html>`_.
    646      1.1  christos 
    647      1.1  christos .. _advanced_discussions_key_management:
    648      1.1  christos 
    649      1.1  christos Rollovers
    650      1.1  christos ~~~~~~~~~
    651      1.1  christos 
    652      1.1  christos .. _key_rollovers:
    653      1.1  christos 
    654      1.1  christos Key Rollovers
    655      1.1  christos ^^^^^^^^^^^^^
    656      1.1  christos 
    657      1.1  christos A key rollover is where one key in a zone is replaced by a new one.
    658      1.1  christos There are arguments for and against regularly rolling keys. In essence
    659      1.1  christos these are:
    660      1.1  christos 
    661      1.1  christos Pros:
    662      1.1  christos 
    663      1.1  christos 1. Regularly changing the key hinders attempts at determination of the
    664      1.1  christos    private part of the key by cryptanalysis of signatures.
    665      1.1  christos 
    666      1.1  christos 2. It gives administrators practice at changing a key; should a key ever need to be
    667      1.1  christos    changed in an emergency, they would not be doing it for the first time.
    668      1.1  christos 
    669      1.1  christos Cons:
    670      1.1  christos 
    671      1.1  christos 1. A lot of effort is required to hack a key, and there are probably
    672      1.1  christos    easier ways of obtaining it, e.g., by breaking into the systems on
    673      1.1  christos    which it is stored.
    674      1.1  christos 
    675      1.1  christos 2. Rolling the key adds complexity to the system and introduces the
    676      1.1  christos    possibility of error. We are more likely to
    677      1.1  christos    have an interruption to our service than if we had not rolled it.
    678      1.1  christos 
    679      1.1  christos Whether and when to roll the key is up to you. How serious would the
    680      1.1  christos damage be if a key were compromised without you knowing about it? How
    681      1.1  christos serious would a key roll failure be?
    682      1.1  christos 
    683      1.1  christos Before going any further, it is worth noting that if you sign your zone
    684  1.1.1.5  christos with :any:`dnssec-policy`, you don't really need to concern yourself with the
    685  1.1.1.5  christos details of a key rollover: BIND 9 takes care of it all for you. If you are
    686  1.1.1.5  christos doing a manual key roll, you do need to familiarize yourself with the various
    687  1.1.1.5  christos steps involved and the timing details.
    688      1.1  christos 
    689      1.1  christos Rolling a key is not as simple as replacing the DNSKEY statement in the
    690      1.1  christos zone. That is an essential part of it, but timing is everything. For
    691      1.1  christos example, suppose that we run the ``example.com`` zone and that a friend
    692      1.1  christos queries for the AAAA record of ``www.example.com``. As part of the
    693      1.1  christos resolution process (described in
    694      1.1  christos :ref:`how_does_dnssec_change_dns_lookup`), their recursive server
    695      1.1  christos looks up the keys for the ``example.com`` zone and uses them to verify
    696      1.1  christos the signature associated with the AAAA record. We'll assume that the
    697      1.1  christos records validated successfully, so they can use the
    698      1.1  christos address to visit ``example.com``'s website.
    699      1.1  christos 
    700      1.1  christos Let's also assume that immediately after the lookup, we want to roll the ZSK
    701      1.1  christos for ``example.com``. Our first attempt at this is to remove the old
    702      1.1  christos DNSKEY record and signatures, add a new DNSKEY record, and re-sign the
    703      1.1  christos zone with it. So one minute our server is serving the old DNSKEY and
    704      1.1  christos records signed with the old key, and the next minute it is serving the
    705      1.1  christos new key and records signed with it. We've achieved our goal - we are
    706      1.1  christos serving a zone signed with the new keys; to check this is really the
    707      1.1  christos case, we booted up our laptop and looked up the AAAA record
    708      1.1  christos ``ftp.example.com``. The lookup succeeded so all must be well. Or is it?
    709      1.1  christos Just to be sure, we called our friend and asked them to check. They
    710      1.1  christos tried to lookup ``ftp.example.com`` but got a SERVFAIL response from
    711      1.1  christos their recursive server. What's going on?
    712      1.1  christos 
    713      1.1  christos The answer, in a word, is "caching." When our friend looked up
    714      1.1  christos ``www.example.com``, their recursive server retrieved and cached
    715      1.1  christos not only the AAAA record, but also a lot of other records. It cached
    716      1.1  christos the NS records for ``com`` and ``example.com``, as well as
    717      1.1  christos the AAAA (and A) records for those name servers (and this action may, in turn, have
    718      1.1  christos caused the lookup and caching of other NS and AAAA/A records). Most
    719      1.1  christos importantly for this example, it also looked up and cached the DNSKEY
    720      1.1  christos records for the root, ``com``, and ``example.com`` zones. When a query
    721      1.1  christos was made for ``ftp.example.com``, the recursive server believed it
    722      1.1  christos already had most of the information
    723      1.1  christos we needed. It knew what nameservers served ``example.com`` and their
    724      1.1  christos addresses, so it went directly to one of those to get the AAAA record for
    725      1.1  christos ``ftp.example.com`` and its associated signature. But when it tried to
    726      1.1  christos validate the signature, it used the cached copy of the DNSKEY, and that
    727      1.1  christos is when our friend had the problem. Their recursive server had a copy of
    728      1.1  christos the old DNSKEY in its cache, but the AAAA record for ``ftp.example.com``
    729      1.1  christos was signed with the new key. So, not surprisingly, the signature could not
    730      1.1  christos validate.
    731      1.1  christos 
    732      1.1  christos How should we roll the keys for ``example.com``? A clue to the
    733      1.1  christos answer is to note that the problem came about because the DNSKEY records
    734      1.1  christos were cached by the recursive server. What would have happened had our
    735      1.1  christos friend flushed the DNSKEY records from the recursive server's cache before
    736      1.1  christos making the query? That would have worked; those records would have been
    737      1.1  christos retrieved from ``example.com``'s nameservers at the same time that we
    738      1.1  christos retrieved the AAAA record for ``ftp.example.com``. Our friend's server would have
    739      1.1  christos obtained the new key along with the AAAA record and associated signature
    740      1.1  christos created with the new key, and all would have been well.
    741      1.1  christos 
    742      1.1  christos As it is obviously impossible for us to notify all recursive server
    743      1.1  christos operators to flush our DNSKEY records every time we roll a key, we must
    744      1.1  christos use another solution. That solution is to wait
    745      1.1  christos for the recursive servers to remove old records from caches when they
    746      1.1  christos reach their TTL. How exactly we do this depends on whether we are trying
    747      1.1  christos to roll a ZSK, a KSK, or a CSK.
    748      1.1  christos 
    749      1.1  christos .. _zsk_rollover_methods:
    750      1.1  christos 
    751      1.1  christos ZSK Rollover Methods
    752      1.1  christos ++++++++++++++++++++
    753      1.1  christos 
    754      1.1  christos The ZSK can be rolled in one of the following two ways:
    755      1.1  christos 
    756      1.1  christos 1. *Pre-Publication*: Publish the new ZSK into zone data before it is
    757      1.1  christos    actually used. Wait at least one TTL interval, so the world's recursive servers
    758      1.1  christos    know about both keys, then stop using the old key and generate a new
    759      1.1  christos    RRSIG using the new key. Wait at least another TTL, so the cached old
    760      1.1  christos    key data is expunged from the world's recursive servers, and then remove
    761      1.1  christos    the old key.
    762      1.1  christos 
    763      1.1  christos    The benefit of the pre-publication approach is it does not
    764      1.1  christos    dramatically increase the zone size; however, the duration of the rollover
    765      1.1  christos    is longer. If insufficient time has passed after the new ZSK is
    766      1.1  christos    published, some resolvers may only have the old ZSK cached when the
    767      1.1  christos    new RRSIG records are published, and validation may fail. This is the
    768      1.1  christos    method described in :ref:`recipes_zsk_rollover`.
    769      1.1  christos 
    770      1.1  christos 2. *Double-Signature*: Publish the new ZSK and new RRSIG, essentially
    771      1.1  christos    doubling the size of the zone. Wait at least one TTL interval, and then remove
    772      1.1  christos    the old ZSK and old RRSIG.
    773      1.1  christos 
    774      1.1  christos    The benefit of the double-signature approach is that it is easier to
    775      1.1  christos    understand and execute, but it causes a significantly increased zone size
    776      1.1  christos    during a rollover event.
    777      1.1  christos 
    778      1.1  christos .. _ksk_rollover_methods:
    779      1.1  christos 
    780      1.1  christos KSK Rollover Methods
    781      1.1  christos ++++++++++++++++++++
    782      1.1  christos 
    783      1.1  christos Rolling the KSK requires interaction with the parent zone, so
    784      1.1  christos operationally this may be more complex than rolling ZSKs. There are
    785      1.1  christos three methods of rolling the KSK:
    786      1.1  christos 
    787      1.1  christos 1. *Double-KSK*: Add the new KSK to the DNSKEY RRset, which is then
    788      1.1  christos    signed with both the old and new keys. After waiting for the old RRset
    789      1.1  christos    to expire from caches, change the DS record in the parent zone.
    790      1.1  christos    After waiting a further TTL interval for this change to be reflected in
    791      1.1  christos    caches, remove the old key from the RRset.
    792      1.1  christos 
    793      1.1  christos    Basically, the new KSK is added first at the child zone and
    794      1.1  christos    used to sign the DNSKEY; then the DS record is changed, followed by the
    795      1.1  christos    removal of the old KSK. Double-KSK keeps the interaction with the
    796      1.1  christos    parent zone to a minimum, but for the duration of the rollover, the
    797      1.1  christos    size of the DNSKEY RRset is increased.
    798      1.1  christos 
    799      1.1  christos 2. *Double-DS*: Publish the new DS record. After waiting for this
    800      1.1  christos    change to propagate into caches, change the KSK. After a further TTL
    801      1.1  christos    interval during which the old DNSKEY RRset expires from caches, remove the
    802      1.1  christos    old DS record.
    803      1.1  christos 
    804      1.1  christos    Double-DS is the reverse of Double-KSK: the new DS is published at
    805      1.1  christos    the parent first, then the KSK at the child is updated, then
    806      1.1  christos    the old DS at the parent is removed. The benefit is that the size of the DNSKEY
    807      1.1  christos    RRset is kept to a minimum, but interactions with the parent zone are
    808      1.1  christos    increased to two events. This is the method described in
    809      1.1  christos    :ref:`recipes_ksk_rollover`.
    810      1.1  christos 
    811      1.1  christos 3. *Double-RRset*: Add the new KSK to the DNSKEY RRset, which is
    812      1.1  christos    then signed with both the old and new key, and add the new DS record
    813      1.1  christos    to the parent zone. After waiting a suitable interval for the
    814      1.1  christos    old DS and DNSKEY RRsets to expire from caches, remove the old DNSKEY and
    815      1.1  christos    old DS record.
    816      1.1  christos 
    817      1.1  christos    Double-RRset is the fastest way to roll the KSK (i.e., it has the shortest rollover
    818      1.1  christos    time), but has the drawbacks of both of the other methods: a larger
    819      1.1  christos    DNSKEY RRset and two interactions with the parent.
    820      1.1  christos 
    821      1.1  christos .. _csk_rollover_methods:
    822      1.1  christos 
    823      1.1  christos CSK Rollover Methods
    824      1.1  christos ++++++++++++++++++++
    825      1.1  christos 
    826      1.1  christos Rolling the CSK is more complex than rolling either the ZSK or KSK, as
    827      1.1  christos the timing constraints relating to both the parent zone and the caching
    828      1.1  christos of records by downstream recursive servers must be taken into
    829      1.1  christos account. There are numerous possible methods that are a combination of ZSK
    830      1.1  christos rollover and KSK rollover methods. BIND 9 automatic signing uses a
    831      1.1  christos combination of ZSK Pre-Publication and Double-KSK rollover.
    832      1.1  christos 
    833      1.1  christos .. _advanced_discussions_emergency_rollovers:
    834      1.1  christos 
    835      1.1  christos Emergency Key Rollovers
    836      1.1  christos ^^^^^^^^^^^^^^^^^^^^^^^
    837      1.1  christos 
    838      1.1  christos Keys are generally rolled on a regular schedule - if you choose
    839      1.1  christos to roll them at all. But sometimes, you may have to rollover keys
    840      1.1  christos out-of-schedule due to a security incident. The aim of an emergency
    841      1.1  christos rollover is to re-sign the zone with a new key as soon as possible, because
    842      1.1  christos when a key is suspected of being compromised, a malicious attacker (or
    843      1.1  christos anyone who has access to the key) could impersonate your server and trick other
    844      1.1  christos validating resolvers into believing that they are receiving authentic,
    845      1.1  christos validated answers.
    846      1.1  christos 
    847      1.1  christos During an emergency rollover, follow the same operational
    848      1.1  christos procedures described in :ref:`recipes_rollovers`, with the added
    849      1.1  christos task of reducing the TTL of the current active (potentially compromised) DNSKEY
    850      1.1  christos RRset, in an attempt to phase out the compromised key faster before the new
    851      1.1  christos key takes effect. The time frame should be significantly reduced from
    852      1.1  christos the 30-days-apart example, since you probably do not want to wait up to
    853      1.1  christos 60 days for the compromised key to be removed from your zone.
    854      1.1  christos 
    855      1.1  christos Another method is to carry a spare key with you at all times. If
    856      1.1  christos you have a second key pre-published and that one
    857      1.1  christos is not compromised at the same time as the first key,
    858      1.1  christos you could save yourself some time by immediately
    859      1.1  christos activating the spare key if the active
    860      1.1  christos key is compromised. With pre-publication, all validating resolvers should already
    861      1.1  christos have this spare key cached, thus saving you some time.
    862      1.1  christos 
    863      1.1  christos With a KSK emergency rollover, you also need to consider factors
    864      1.1  christos related to your parent zone, such as how quickly they can remove the old
    865      1.1  christos DS records and publish the new ones.
    866      1.1  christos 
    867      1.1  christos As with many other facets of DNSSEC, there are multiple aspects to take into
    868      1.1  christos account when it comes to emergency key rollovers. For more in-depth
    869      1.1  christos considerations, please check out :rfc:`7583`.
    870      1.1  christos 
    871      1.1  christos .. _advanced_discussions_DNSKEY_algorithm_rollovers:
    872      1.1  christos 
    873      1.1  christos Algorithm Rollovers
    874      1.1  christos ^^^^^^^^^^^^^^^^^^^
    875      1.1  christos 
    876      1.1  christos From time to time, new digital signature algorithms with improved
    877      1.1  christos security are introduced, and it may be desirable for administrators to
    878      1.1  christos roll over DNSKEYs to a new algorithm, e.g., from RSASHA1 (algorithm 5 or
    879      1.1  christos 7) to RSASHA256 (algorithm 8). The algorithm rollover steps must be followed with
    880      1.1  christos care to avoid breaking DNSSEC validation.
    881      1.1  christos 
    882  1.1.1.3  christos If you are managing DNSSEC by using the :any:`dnssec-policy` configuration,
    883  1.1.1.5  christos :iscman:`named` handles these steps for you. Simply change the algorithm
    884  1.1.1.3  christos for the relevant keys, and :iscman:`named` uses the new algorithm when the
    885      1.1  christos key is next rolled. It performs a smooth transition to the new
    886      1.1  christos algorithm, ensuring that the zone remains valid throughout rollover.
    887      1.1  christos 
    888      1.1  christos Other Topics
    889      1.1  christos ~~~~~~~~~~~~
    890      1.1  christos 
    891      1.1  christos DNSSEC and Dynamic Updates
    892      1.1  christos ^^^^^^^^^^^^^^^^^^^^^^^^^^
    893      1.1  christos 
    894      1.1  christos Dynamic DNS (DDNS) is actually independent of DNSSEC. DDNS provides a
    895      1.1  christos mechanism, separate from editing the zone file or zone database, to edit DNS
    896      1.1  christos data. Most DNS clients and servers are able to handle dynamic
    897      1.1  christos updates, and DDNS can also be integrated as part of your DHCP
    898      1.1  christos environment.
    899      1.1  christos 
    900      1.1  christos When you have both DNSSEC and dynamic updates in your environment,
    901      1.1  christos updating zone data works the same way as with traditional (insecure)
    902  1.1.1.3  christos DNS: you can use :option:`rndc freeze` before editing the zone file, and
    903  1.1.1.3  christos :option:`rndc thaw` when you have finished editing, or you can use the
    904  1.1.1.3  christos command :iscman:`nsupdate` to add, edit, or remove records like this:
    905      1.1  christos 
    906      1.1  christos ::
    907      1.1  christos 
    908      1.1  christos    $ nsupdate
    909      1.1  christos    > server 192.168.1.13
    910      1.1  christos    > update add xyz.example.com. 300 IN A 1.1.1.1
    911      1.1  christos    > send
    912      1.1  christos    > quit
    913      1.1  christos 
    914  1.1.1.3  christos The examples provided in this guide make :iscman:`named` automatically
    915      1.1  christos re-sign the zone whenever its content has changed. If you decide to sign
    916      1.1  christos your own zone file manually, you need to remember to execute the
    917  1.1.1.3  christos :iscman:`dnssec-signzone` command whenever your zone file has been updated.
    918      1.1  christos 
    919      1.1  christos As far as system resources and performance are concerned, be mindful that
    920      1.1  christos with a DNSSEC zone that changes frequently, every time the zone
    921      1.1  christos changes your system is executing a series of cryptographic operations
    922      1.1  christos to (re)generate signatures and NSEC or NSEC3 records.
    923      1.1  christos 
    924      1.1  christos .. _dnssec_on_private_networks:
    925      1.1  christos 
    926      1.1  christos DNSSEC on Private Networks
    927      1.1  christos ^^^^^^^^^^^^^^^^^^^^^^^^^^
    928      1.1  christos 
    929      1.1  christos Let's clarify what we mean: in this section, "private networks" really refers to
    930      1.1  christos a private or internal DNS view. Most DNS products offer the ability to
    931      1.1  christos have different versions of DNS answers, depending on the origin of the
    932      1.1  christos query. This feature is often called "DNS views" or "split DNS," and is most
    933      1.1  christos commonly implemented as an "internal" versus an "external" setup.
    934      1.1  christos 
    935      1.1  christos For instance, your organization may have a version of ``example.com``
    936      1.1  christos that is offered to the world, and its names most likely resolve to
    937      1.1  christos publicly reachable IP addresses. You may also have an internal version
    938      1.1  christos of ``example.com`` that is only accessible when you are on the company's
    939      1.1  christos private networks or via a VPN connection. These private networks typically
    940      1.1  christos fall under 10.0.0.0/8, 172.16.0.0/12, or 192.168.0.0/16 for IPv4.
    941      1.1  christos 
    942      1.1  christos So what if you want to offer DNSSEC for your internal version of
    943      1.1  christos ``example.com``? This can be done: the golden rule is to use the same
    944      1.1  christos key for both the internal and external versions of the zones. This
    945      1.1  christos avoids problems that can occur when machines (e.g., laptops) move
    946      1.1  christos between accessing the internal and external zones, when it is possible
    947      1.1  christos that they may have cached records from the wrong zone.
    948      1.1  christos 
    949      1.1  christos .. _introduction_to_dane:
    950      1.1  christos 
    951      1.1  christos Introduction to DANE
    952      1.1  christos ^^^^^^^^^^^^^^^^^^^^
    953      1.1  christos 
    954      1.1  christos With your DNS infrastructure secured with DNSSEC, information can
    955      1.1  christos now be stored in DNS and its integrity and authenticity can be proved.
    956      1.1  christos One of the new features that takes advantage of this is the DNS-Based
    957      1.1  christos Authentication of Named Entities, or DANE. This improves security in a
    958      1.1  christos number of ways, including:
    959      1.1  christos 
    960      1.1  christos -  The ability to store self-signed X.509 certificates and bypass having to pay a third
    961      1.1  christos    party (such as a Certificate Authority) to sign the certificates
    962      1.1  christos    (:rfc:`6698`).
    963      1.1  christos 
    964      1.1  christos -  Improved security for clients connecting to mail servers (:rfc:`7672`).
    965      1.1  christos 
    966      1.1  christos -  A secure way of getting public PGP keys (:rfc:`7929`).
    967      1.1  christos 
    968      1.1  christos Disadvantages of DNSSEC
    969      1.1  christos ~~~~~~~~~~~~~~~~~~~~~~~
    970      1.1  christos 
    971      1.1  christos DNSSEC, like many things in this world, is not without its problems.
    972      1.1  christos Below are a few challenges and disadvantages that DNSSEC faces.
    973      1.1  christos 
    974      1.1  christos 1. *Increased, well, everything*: With DNSSEC, signed zones are larger,
    975      1.1  christos    thus taking up more disk space; for DNSSEC-aware servers, the
    976      1.1  christos    additional cryptographic computation usually results in increased
    977      1.1  christos    system load; and the network packets are bigger, possibly putting
    978      1.1  christos    more strains on the network infrastructure.
    979      1.1  christos 
    980      1.1  christos 2. *Different security considerations*: DNSSEC addresses many security
    981      1.1  christos    concerns, most notably cache poisoning. But at the same time, it may
    982      1.1  christos    introduce a set of different security considerations, such as
    983      1.1  christos    amplification attack and zone enumeration through NSEC. These
    984      1.1  christos    concerns are still being identified and addressed by the Internet
    985      1.1  christos    community.
    986      1.1  christos 
    987      1.1  christos 3. *More complexity*: If you have read this far, you have probably already
    988      1.1  christos    concluded this yourself. With additional resource records, keys,
    989      1.1  christos    signatures, and rotations, DNSSEC adds many more moving pieces on top of
    990      1.1  christos    the existing DNS machine. The job of the DNS administrator changes,
    991      1.1  christos    as DNS becomes the new secure repository of everything from spam
    992      1.1  christos    avoidance to encryption keys, and the amount of work involved to
    993      1.1  christos    troubleshoot a DNS-related issue becomes more challenging.
    994      1.1  christos 
    995      1.1  christos 4. *Increased fragility*: The increased complexity means more
    996      1.1  christos    opportunities for things to go wrong. Before DNSSEC, DNS
    997      1.1  christos    was essentially "add something to the zone and forget it." With DNSSEC,
    998      1.1  christos    each new component - re-signing, key rollover, interaction with
    999      1.1  christos    parent zone, key management - adds more opportunity for error. It is
   1000      1.1  christos    entirely possible that a failure to validate a name may come down to
   1001      1.1  christos    errors on the part of one or more zone operators rather than the
   1002      1.1  christos    result of a deliberate attack on the DNS.
   1003      1.1  christos 
   1004      1.1  christos 5. *New maintenance tasks*: Even if your new secure DNS infrastructure
   1005      1.1  christos    runs without any hiccups or security breaches, it still requires
   1006      1.1  christos    regular attention, from re-signing to key rollovers. While most of
   1007      1.1  christos    these can be automated, some of the tasks, such as KSK rollover,
   1008      1.1  christos    remain manual for the time being.
   1009      1.1  christos 
   1010      1.1  christos 6. *Not enough people are using it today*: While it's estimated (as of
   1011      1.1  christos    mid-2020) that roughly 30% of the global Internet DNS traffic is
   1012  1.1.1.5  christos    validating, [#apnic_validating_stats]_ that doesn't mean that many of
   1013  1.1.1.5  christos    the DNS zones are actually signed. What this means is, even if your
   1014  1.1.1.5  christos    company's zone is signed today, fewer than 30% of the Internet's
   1015  1.1.1.5  christos    servers are taking advantage of this extra security. It gets worse:
   1016  1.1.1.5  christos    with less than 1.5% of the ``com.`` domains signed, even if your
   1017  1.1.1.5  christos    DNSSEC validation is enabled today, it's not likely to buy you or
   1018  1.1.1.5  christos    your users a whole lot more protection until these popular domain
   1019  1.1.1.5  christos    names decide to sign their zones.
   1020      1.1  christos 
   1021      1.1  christos The last point may have more impact than you realize. Consider this:
   1022      1.1  christos HTTP and HTTPS make up the majority of traffic on the Internet. While you may have
   1023      1.1  christos secured your DNS infrastructure through DNSSEC, if your web hosting is
   1024      1.1  christos outsourced to a third party that does not yet support DNSSEC in its
   1025      1.1  christos own domain, or if your web page loads contents and components from
   1026      1.1  christos insecure domains, end users may experience validation problems when
   1027      1.1  christos trying to access your web page. For example, although you may have signed
   1028      1.1  christos the zone ``company.com``, the web address ``www.company.com`` may actually be a
   1029      1.1  christos CNAME to ``foo.random-cloud-provider.com``. As long as
   1030      1.1  christos ``random-cloud-provider.com`` remains an insecure DNS zone, users cannot
   1031      1.1  christos fully validate everything when they visit your web page and could be
   1032      1.1  christos redirected elsewhere by a cache poisoning attack.
   1033      1.1  christos 
   1034  1.1.1.5  christos .. [#apnic_validating_stats]
   1035      1.1  christos    Based on APNIC statistics at
   1036      1.1  christos    `<https://stats.labs.apnic.net/dnssec/XA>`__
   1037