RFC 2535
Domain Name System Security Extensions
RFC 2535: Domain Name System Security Extensions ๐
okay bestie, this is RFC 2535 ๐ฆ, a Standards Track document from the Network Working Group. D. Eastlake at IBM wrote it, and it's dated March 1999. It obsoletes RFC 2065 and updates RFCs 2181, 1035, and 1034, so those older docs are getting a whole glow-up ๐
Status of This Memo ๐
this doc specifies an Internet standards track protocol for the Internet community, and it's asking for discussion and suggestions for improvements ๐ซถ for the current standardization state and status of this protocol, check the "Internet Official Protocol Standards" (STD 1), which is the official place to look. distribution of this memo is unlimited, so share it with everyone ๐
Copyright Notice ยฉ๏ธ
Copyright (C) The Internet Society (1999). All Rights Reserved. ๐
Abstract โจ
okay so the DNS (Domain Name System) is getting extensions that give data integrity and authentication to security aware resolvers and applications ๐ they do this with cryptographic digital signatures. those signatures are included in secured zones as resource records ๐ and sometimes security can also be provided through non-security aware DNS servers, which is lowkey iconic ๐
the extensions also let authenticated public keys get stored in the DNS ๐ that storage can support general public key distribution services as well as DNS security, which is giving versatile energy ๐ the stored keys let security aware resolvers learn the authenticating key of zones beyond the ones they were initially configured for ๐ง and keys tied to DNS names can be retrieved to support other protocols. there's also a whole variety of key types and algorithms ๐ธ
on top of that, the security extensions provide for the optional authentication of DNS protocol transactions and requests ๐
and fr, this document incorporates feedback on RFC 2065 from early implementers and potential users ๐ซถ
Acknowledgments ๐
the significant contributions and suggestions of the following persons (in alphabetic order) to DNS security are gratefully acknowledged, bestie ๐
- James M. Galvin
- John Gilmore
- Olafur Gudmundsson
- Charlie Kaufman
- Edward Lewis
- Thomas Narten
- Radia J. Perlman
- Jeffrey I. Schiller
- Steven (Xunhua) Wang
- Brian Wellington
Table of Contents ๐
Abstract...................................................1
Acknowledgments............................................2
1. Overview of Contents....................................4
2. Overview of the DNS Extensions..........................5
2.1 Services Not Provided..................................5
2.2 Key Distribution.......................................5
2.3 Data Origin Authentication and Integrity...............6
2.3.1 The SIG Resource Record..............................7
2.3.2 Authenticating Name and Type Non-existence...........7
2.3.3 Special Considerations With Time-to-Live.............7
2.3.4 Special Considerations at Delegation Points..........8
2.3.5 Special Considerations with CNAME....................8
2.3.6 Signers Other Than The Zone..........................9
2.4 DNS Transaction and Request Authentication.............9
3. The KEY Resource Record................................10
3.1 KEY RDATA format......................................10
3.1.1 Object Types, DNS Names, and Keys...................11
3.1.2 The KEY RR Flag Field...............................11
3.1.3 The Protocol Octet..................................13
3.2 The KEY Algorithm Number Specification................14
3.3 Interaction of Flags, Algorithm, and Protocol Bytes...15
3.4 Determination of Zone Secure/Unsecured Status.........15
3.5 KEY RRs in the Construction of Responses..............17
4. The SIG Resource Record................................17
4.1 SIG RDATA Format......................................17
4.1.1 Type Covered Field..................................18
4.1.2 Algorithm Number Field..............................18
4.1.3 Labels Field........................................18
4.1.4 Original TTL Field..................................19
4.1.5 Signature Expiration and Inception Fields...........19
4.1.6 Key Tag Field.......................................20
4.1.7 Signer's Name Field.................................20
4.1.8 Signature Field.....................................20
4.1.8.1 Calculating Transaction and Request SIGs..........21
4.2 SIG RRs in the Construction of Responses..............21
4.3 Processing Responses and SIG RRs......................22
4.4 Signature Lifetime, Expiration, TTLs, and Validity....23
5. Non-existent Names and Types...........................24
5.1 The NXT Resource Record...............................24
5.2 NXT RDATA Format......................................25
5.3 Additional Complexity Due to Wildcards................26
5.4 Example...............................................26
5.5 Special Considerations at Delegation Points...........27
5.6 Zone Transfers........................................27
5.6.1 Full Zone Transfers.................................28
5.6.2 Incremental Zone Transfers..........................28
6. How to Resolve Securely and the AD and CD Bits.........29
6.1 The AD and CD Header Bits.............................29
6.2 Staticly Configured Keys..............................31
6.3 Chaining Through The DNS..............................31
6.3.1 Chaining Through KEYs...............................31
6.3.2 Conflicting Data....................................33
6.4 Secure Time...........................................33
7. ASCII Representation of Security RRs...................34
7.1 Presentation of KEY RRs...............................34
7.2 Presentation of SIG RRs...............................35
7.3 Presentation of NXT RRs...............................36
8. Canonical Form and Order of Resource Records...........36
8.1 Canonical RR Form.....................................36
8.2 Canonical DNS Name Order..............................37
8.3 Canonical RR Ordering Within An RRset.................37
8.4 Canonical Ordering of RR Types........................37
9. Conformance............................................37
9.1 Server Conformance....................................37
9.2 Resolver Conformance..................................38
10. Security Considerations...............................38
11. IANA Considerations...................................39
References................................................39
Author's Address..........................................41
Appendix A: Base 64 Encoding..............................42
Appendix B: Changes from RFC 2065.........................44
Appendix C: Key Tag Calculation...........................46
Full Copyright Statement..................................47
1. Overview of Contents ๐บ๏ธ
this doc standardizes extensions of the Domain Name System (DNS) protocol to support DNS security and public key distribution ๐ฅ it assumes you already know the DNS, especially as described in RFCs 1033, 1034, 1035 and later RFCs. an earlier version of these extensions is in RFC 2065, and this one is the replacement, built on early implementation experience and requests from potential users ๐
Section 2 gives an overview of the extensions and the key distribution, data origin authentication, and transaction and request security they provide โจ
Section 3 talks about the KEY resource record: its structure and how it's used in DNS responses ๐ these resource records represent the public keys of entities named in the DNS and are used for key distribution.
Section 4 talks about the SIG digital signature resource record, its structure, and its use in DNS responses ๐๏ธ these are used to authenticate other resource records in the DNS and, optionally, to authenticate DNS transactions and requests.
Section 5 covers the NXT resource record (RR) and how it's used in DNS responses, including full and incremental zone transfers ๐ง the NXT RR permits authenticated denial of the existence of a name, or of an RR type for an existing name.
Section 6 discusses how a resolver can be configured with a starting key or keys and then go on to securely resolve DNS requests ๐ it also covers interactions between resolvers and servers for various combinations of security aware and security non-aware. two additional DNS header bits are defined for signaling between resolvers and servers.
Section 7 describes the ASCII representation of the security resource records, for use in master files and elsewhere ๐
Section 8 defines the canonical form and order of RRs for DNS security purposes ๐ธ
Section 9 defines levels of conformance for resolvers and servers ๐
Section 10 gives a few paragraphs on overall security considerations ๐
Section 11 specifies IANA considerations for allocating additional values of parameters defined in this document ๐ฆ
Appendix A gives details of base 64 encoding, which is used in the file representation of some RRs defined in this document ๐
Appendix B summarizes changes between this memo and RFC 2065 ๐
Appendix C specifies how to calculate the simple checksum used as a key tag in most SIG RRs ๐ข
the key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119]. these are the BCP 14 key words, so read them carefully, iykyk ๐ซถ
2. Overview of the DNS Extensions ๐ซ
the DNS protocol security extensions give you three distinct services ๐ first is key distribution (see Section 2.2 below). second is data origin authentication (see Section 2.3 below). third is transaction and request authentication (described in Section 2.4 below).
special considerations related to "time to live", CNAMEs, and delegation points are also discussed in Section 2.3 ๐ง
2.1 Services Not Provided ๐ โโ๏ธ
it's part of the design philosophy of the DNS that the data in it is public and that the DNS gives the same answers to all inquirers ๐ฃ following that philosophy, no attempt has been made to include any sort of access control lists or other means to differentiate inquirers. no main character access control here, periodt ๐
no effort has been made to provide any confidentiality for queries or responses ๐คซ (this service may be available via IPSEC [RFC 2401], TLS, or other security protocols.)
protection is not provided against denial of service ๐ญ
2.2 Key Distribution ๐
a resource record format is defined to associate keys with DNS names ๐ this permits the DNS to be used as a public key distribution mechanism, in support of DNS security itself and other protocols. it's giving multitasking ๐ฆ
the syntax of a KEY resource record (RR) is described in Section 3 ๐ it includes an algorithm identifier, the actual public key parameter(s), and a variety of flags. those flags include ones indicating the type of entity the key is associated with, and/or asserting that there is no key associated with that entity โจ
under conditions described in Section 3.5, security aware DNS servers will automatically attempt to return KEY resources as additional information, along with the resource records actually requested ๐ง this is to minimize the number of queries needed. efficient and iconic ๐
2.3 Data Origin Authentication and Integrity ๐
Okay so, authentication works by attaching cryptographically generated digital signatures to resource record sets (RRsets [RFC 2181]) in the DNS. Usually there's one private key that signs an entire zone, but you might have multiple keys for different algorithms, signers, etc. ๐๏ธ If a security aware resolver reliably learns a zone's public key, it can check that signed data read from that zone really comes from someone authorized. Bestie, the most secure setup is keeping the zone private key(s) off-line and using them to re-sign every record in the zone now and then. ๐ง But sometimes DNS private keys have to be on-line, like with dynamic update [RFCs 2136, 2137] [RFC 2541]. ๐ป
The data origin authentication key(s) belong to the zone, not to the servers that store copies of the data. ๐ So if a secondary server gets compromised, or even the primary server when the key(s) are kept off-line, that won't necessarily change how much a resolver trusts that it can tell whether data is genuine. Main character energy for the keys, honestly. ๐
A resolver can learn a zone's public key either by reading it from the DNS or by having it statically configured. ๐ To reliably learn a public key by reading it from the DNS, the key itself must be signed with a key the resolver trusts. ๐ The resolver must be configured with at least one public key that authenticates a zone as a starting point. โญ From there, it can securely read the public keys of other zones, as long as the zones in between in the DNS tree are secure and their signed keys are accessible. ๐ณ
Adding data origin authentication and integrity doesn't require any change to the "on-the-wire" DNS protocol beyond adding the signature resource type and the key resource type needed for key distribution. ๐ (Data non-existence authentication also requires the NXT RR as described in 2.3.2.) This service can be supported by existing resolver and caching server implementations, as long as they can handle the additional resource types (see Section 9). ๐ The one exception: CNAME referrals in a secure zone can't be authenticated if they come from non-security aware servers (see Section 2.3.5). ๐
If signatures get retrieved and verified separately from the information they authenticate, there will be more trips to the server and performance will suffer. ๐ญ Security aware servers help with that by trying to send the signature(s) that are needed (see Section 4.2). ๐
2.3.1 The SIG Resource Record โ๏ธ
The syntax of a SIG resource record (signature) is described in Section 4. ๐ It cryptographically binds the RRset being signed to the signer and a validity interval. ๐ฆ
Every name in a secured zone will have at least one SIG resource record associated with it for each resource type under that name, except for glue address RRs and delegation point NS RRs. ๐ง A security aware server will try to return the corresponding SIGs along with the RRs it retrieves. โจ If a server isn't security aware, the resolver must retrieve all the SIG records for a name and pick the one or ones that sign the resource record set(s) it's interested in. ๐
2.3.2 Authenticating Name and Type Non-existence ๐ซฅ
The mechanism above only gives a way to sign existing RRsets in a zone. ๐ "Data origin" authentication isn't obviously provided for the non-existence of a domain name in a zone, or for the non-existence of a type on an existing name. ๐ณ๏ธ This gap gets filled by the NXT RR, which authenticatably asserts a range of non-existent names in a zone, plus the non-existence of types for the existing name just before that range. ๐
Section 5 below covers the NXT RR. ๐
2.3.3 Special Considerations With Time-to-Live โณ
A digital signature will fail to verify if anything has changed in the data between the time it was originally signed and the time the signature is verified. ๐ This clashes with what we want, which is for the time-to-live (TTL) field of resource records to tick down while they're cached. ๐ฉ
You could avoid this by leaving the time-to-live out of the digital signature, but then unscrupulous servers could set arbitrarily long TTL values and nobody would notice. ๐ So instead, we include the "original" TTL in the signature and send that data along with the current TTL. ๐งพ Under this scheme, unscrupulous servers can still manipulate the TTL, but a security aware resolver will bound the TTL value it uses at the original signed value. ๐ก๏ธ Signatures also include a signature inception time and a signature expiration time. โฐ A resolver that knows the absolute time can securely determine whether a signature is in effect. ๐ It isn't possible to rely only on the signature expiration as a substitute for the TTL, though, since the TTL is primarily a database consistency mechanism, and non-security aware servers that depend on TTL still have to be supported. ๐ซถ
2.3.4 Special Considerations at Delegation Points ๐ง
DNS security would love to view each zone as a unit of data completely under the control of the zone owner, with each entry (RRset) signed by a special private key held by the zone manager. ๐ But the DNS protocol sees the leaf nodes in a zone, which are also the apex nodes of a subzone (i.e., delegation points), as "really" belonging to the subzone. ๐คทโโ๏ธ These nodes show up in two master files and might have RRs signed by both the upper and lower zone's keys. ๐ A retrieval could get a mixture of these RRs and SIGs, especially since one server could be serving both the zone above and the zone below a delegation point. [RFC 2181] ๐ฅด
There MUST be a zone KEY RR, signed by its superzone, for every subzone if the superzone is secure. ๐ This will normally appear in the subzone and may also be included in the superzone. ๐ธ But if a subzone is unsecured and can't or won't be modified to add any security RRs, a KEY declaring the subzone to be unsecured MUST appear with the superzone signature in the superzone, provided the superzone is secure. ๐
โโ๏ธ For all but one other RR type, the data from the subzone is more authoritative, so only the subzone KEY RR should be signed in the superzone if it appears there. ๐ The NS and any glue address RRs SHOULD only be signed in the subzone. ๐ง The SOA and any other RRs that have the zone name as owner should appear only in the subzone and so are signed only there. ๐ก The NXT RR type is the exceptional case: it will always appear differently and authoritatively in both the superzone and the subzone, if both are secure, as described in Section 5. โญ
2.3.5 Special Considerations with CNAME ๐ช
There's a problem when security related RRs with the same owner name as a CNAME RR get retrieved from a non-security-aware server. ๐ฌ In particular, an initial retrieval for the CNAME or any other type may not retrieve any associated SIG, KEY, or NXT RR. โ For retrieved types other than CNAME, it will retrieve that type at the target name of the CNAME (or chain of CNAMEs) and will also return the CNAME. ๐ Specifically, a retrieval for type SIG won't get the SIG, if there is one, at the original CNAME domain name, but rather a SIG at the target name. ๐ซ
Security aware servers must be used to securely CNAME in DNS. ๐ก๏ธ Security aware servers MUST (1) allow KEY, SIG, and NXT RRs along with CNAME RRs, (2) suppress CNAME processing on retrieval of these types as well as on retrieval of the type CNAME, and (3) automatically return SIG RRs authenticating the CNAME or CNAMEs encountered in resolving a query. ๐ฏ This is a change from the previous DNS standard [RFCs 1034/1035], which prohibited any other RR type at a node where a CNAME RR was present. ๐
2.3.6 Signers Other Than The Zone ๐โโ๏ธ
There are cases where the signer in a SIG resource record is someone other than the private key(s) used to authenticate a zone. ๐ญ
One is support for dynamic update [RFC 2136] (or future requests which require secure authentication), where an entity is permitted to authenticate/update its records [RFC 2137] and the zone is operating in a mode where the zone key isn't on-line. ๐ The entity's public key must be present in the DNS and be signed by a zone level key, but the other RR(s) may be signed with the entity's key. ๐๏ธ
A second case is support for transaction and request authentication, as described in Section 2.4. ๐งพ
Additionally, signatures can be included on resource records within the DNS for use by applications other than DNS. ๐ DNS related signatures authenticate that data originated with the authority of a zone owner, or that a request or transaction originated with the relevant entity. ๐ Other signatures can provide other types of assurances. โจ
2.4 DNS Transaction and Request Authentication ๐จ
The data origin authentication service described above protects retrieved resource records and the non-existence of resource records, but it gives zero protection to DNS requests or to message headers. ๐ โโ๏ธ
If header bits get falsely set by a bad server, there's not much that can be done. ๐ค However, it is possible to add transaction authentication. ๐ This means a resolver can be sure it's at least getting messages from the server it thinks it queried, and that the response comes from the query it sent (i.e., that these messages haven't been diddled in transit). ๐ต๏ธโโ๏ธ It's accomplished by optionally adding a special SIG resource record at the end of the reply, which digitally signs the concatenation of the server's response and the resolver's query. ๐
Requests can also be authenticated by including a special SIG RR at the end of the request. ๐ฌ Authenticating requests serves no function in older DNS servers, and requests with a non-empty additional information section produce error returns or may even get ignored by many of them. ๐ However, this syntax for signing requests is defined as a way of authenticating secure dynamic update requests [RFC 2137] or future requests requiring authentication. ๐
The private keys used in transaction security belong to the entity composing the reply, not to the zone involved. ๐ท๏ธ Request authentication may also involve the private key of the host or other entity composing the request, or other private keys, depending on the request authority it's meant to establish. ๐งฉ The corresponding public key(s) are normally stored in, and retrieved from, the DNS for verification. ๐
Because requests and replies are highly variable, message authentication SIGs can't be pre-calculated. ๐ So it's necessary to keep the private key on-line, for example in software or in a directly connected piece of hardware. ๐ปโจ
3. The KEY Resource Record ๐๏ธ
The KEY resource record (RR) is used to store a public key that is associated with a Domain Name System (DNS) name. ๐ This can be the public key of a zone, a user, a host, or another end entity. ๐ซถ Security aware DNS implementations MUST be designed to handle at least two simultaneously valid keys of the same type associated with the same name. ๐
The type number for the KEY RR is 25. ๐ข
A KEY RR is, like any other RR, authenticated by a SIG RR. ๐ KEY RRs must be signed by a zone level key. ๐
3.1 KEY RDATA format โจ
okay so the RDATA for a KEY RR is made of four things: the flags, a protocol octet, the algorithm number octet, and the public key itself ๐ here's the layout bestie:
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| flags | protocol | algorithm |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| /
/ public key /
/ /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-|
The KEY RR is not meant for storing certificates ๐ โโ๏ธ because there's a separate certificate RR built for that exact job, defined in [RFC 2538]. ngl that's very organized of them.
The owner name, flags, and protocol octet meanings are covered in Sections 3.1.1 through 3.1.5 below ๐ The flags and algorithm must be examined before any data following the algorithm octet, because they control whether that data exists and what format it's in. The algorithm and public key fields are explained in Section 3.2, and the public key format depends on the algorithm.
KEY RRs don't spell out their own validity period ๐ฐ๏ธ but their authenticating SIG RR(s) do, as described in Section 4 below. main character energy for the SIG RR fr.
3.1.1 Object Types, DNS Names, and Keys
The public key in a KEY RR belongs to the object named in the owner name ๐ฏ
Here's the tea: one DNS name can refer to three different kinds of things. Take foo.host.example. It could be (1) a zone, (2) a host or other end entity, or (3) the DNS-name version of the user or account foo@host.example ๐ง So there are flag bits, explained below, that tell you which of these roles the owner name and public key are paired with. And an appropriate zone KEY RR MUST occur at the apex node of a secure zone, while zone KEY RRs occur only at delegation points ๐ธ
3.1.2 The KEY RR Flag Field
In the "flags" field:
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| A/C | Z | XT| Z | Z | NAMTYP| Z | Z | Z | Z | SIG |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
Bits 0 and 1 are the key "type" bits, and they mean the following ๐ฆ
10: Use of the key is prohibited for authentication.01: Use of the key is prohibited for confidentiality.00: Use of the key for authentication and/or confidentiality is permitted. Note that DNS security only uses keys for authentication. The confidentiality flagging is there for keys used in other protocols ๐ Implementations not intended to support key distribution for confidentiality MAY require that the confidentiality use prohibited bit be on for keys they serve.11: If both bits are one, that's the "no key" value. There's no key info and the RR stops right after the algorithm octet ๐ With this "no key" value, a signed KEY RR can authenticatably assert that, for example, a zone is not secured. See section 3.4 below.
Bit 2 is reserved and must be zero.
Bit 3 is reserved as a flag extension bit. If it's a one, a second 16 bit flag field gets added after the algorithm octet and before the key data. This bit MUST NOT be set unless one or more such additional bits have been defined and are non-zero ๐
Bits 4-5 are reserved and must be zero.
Bits 6 and 7 form a field that encodes the name type ๐ The values mean:
00: this is a key tied to a "user" or "account" at an end entity, usually a host. The owner name is written the same way as the responsible individual mailbox in the SOA and RP RRs, so the user name becomes a node under the entity name. For example, "j_random_user" on host.subdomain.example could have a public key attached through a KEY RR named j_random_user.host.subdomain.example. This could be used in a security protocol where authenticating a user is the goal. It might be useful in IP or other security for user-level services like telnet, ftp, rlogin, etc. ๐01: this is a zone key for the zone named by the KEY RR owner name. This is the public key behind the main DNS security feature of data origin authentication ๐ Zone KEY RRs occur only at delegation points.10: this is a key tied to the non-zone "entity" named by the RR owner name. That'll usually be a host, but in some parts of the DNS tree it could be something else, like a telephone number [RFC 1530] or a numeric IP address ๐ This is the public key used with DNS request and transaction authentication services. It could also be used in an IP-security protocol where authentication at the host level, rather than the user level, is wanted, like routing, NTP, etc.11: reserved.
Bits 8-11 are reserved and must be zero.
Bits 12-15 are the "signatory" field โ๏ธ If it's non-zero, the key can validly sign things as specified in DNS dynamic update [RFC 2137]. Also, zone keys (see bits 6 and 7 above) always have the authority to sign any RRs in the zone, no matter what the signatory field says ๐ธ
3.1.3 The Protocol Octet
It's expected that keys stored in DNS will get used with a bunch of different Internet protocols ๐ The plan is that the protocol octet, plus maybe some of the currently unused bits in the KEY RR flags (the ones that must be zero for now), will later be used to show whether a key is valid for different protocols ๐งฉ
These values of the Protocol Octet are reserved, as shown:
VALUE Protocol
0 -reserved
1 TLS
2 email
3 dnssec
4 IPSEC
5-254 - available for assignment by IANA
255 All
In more detail:
1is reserved for use with TLS.2is reserved for use with email.3is used for DNS security. The protocol field SHOULD be set to this value for zone keys and other keys used in DNS security. Implementations that can tell a key is a DNS security key because the flags label it a zone key or the signatory flag field is non-zero are NOT REQUIRED to check the protocol field ๐4is reserved to refer to the Oakley/IPSEC [RFC 2401] protocol, and it means this key is valid for use with that security standard. This key could be used for secured communication on behalf of an end entity or user whose name is the KEY RR owner name, if the entity or user flag bits are set. Having a KEY resource with this protocol value is an assertion that the host speaks Oakley/IPSEC ๐ง255means the key can be used with any protocol that has KEY RR protocol octet values defined. Using this value is discouraged, and using different keys for different protocols is encouraged ๐ โโ๏ธ
3.2 The KEY Algorithm Number Specification
This octet is the key algorithm, and it lines up with the same field in the SIG resource described in Section 4.1 ๐ค These values are assigned:
VALUE Algorithm
0 - reserved, see Section 11
1 RSA/MD5 [RFC 2537] - recommended
2 Diffie-Hellman [RFC 2539] - optional, key only
3 DSA [RFC 2536] - MANDATORY
4 reserved for elliptic curve crypto
5-251 - available, see Section 11
252 reserved for indirect keys
253 private - domain name (see below)
254 private - OID (see below)
255 - reserved, see Section 11
Algorithm-specific formats and procedures live in separate documents ๐ The mandatory to implement algorithm for interoperability is number 3, DSA. It's recommended that RSA/MD5, number 1, be implemented too. Algorithm 2 is for Diffie-Hellman keys, and algorithm 4 is reserved for elliptic curve ๐ธ
Algorithm number 252 means an indirect key format, where the actual key material is somewhere else. That format is going to be defined in a separate document ๐๏ธ
Algorithm numbers 253 and 254 are reserved for private use, and they'll never be assigned a specific algorithm ๐ For 253, the public key area and the signature both start with a wire encoded domain name. Only local domain name compression is permitted. The domain name says which private algorithm to use, and whatever's left of the public key area is whatever that algorithm needs. For 254, the public key area for the KEY RR and the signature both start with an unsigned length byte, followed by a BER encoded Object Identifier (ISO OID) of that length. The OID says which private algorithm is in use, and the rest of the area is whatever that algorithm needs. Entities should only use domain names and OIDs they control to name their private algorithms ๐ซถ
Values 0 and 255 are reserved, but the value 0 gets used in the algorithm field when that field isn't used. An example is a KEY RR with the top two flag bits on, the "no-key" value, where no key is present ๐
3.3 Interaction of Flags, Algorithm, and Protocol Bytes
Lots of combinations of the no-key type flags, algorithm byte, protocol byte, and any future protocol-indicating flags are possible ๐ Here's what each combination means. Quick decoder:
NK= no key type (flags bits 0 and 1 on)AL= algorithm bytePR= protocols indicated by protocol byte or future assigned flagsxrepresents any valid non-zero value(s).
AL PR NK Meaning
0 0 0 Illegal, claims key but has bad algorithm field.
0 0 1 Specifies total lack of security for owner zone.
0 x 0 Illegal, claims key but has bad algorithm field.
0 x 1 Specified protocols unsecured, others may be secure.
x 0 0 Gives key but no protocols to use it.
x 0 1 Denies key for specific algorithm.
x x 0 Specifies key for protocols.
x x 1 Algorithm not understood for protocol.
3.4. Determination of Zone Secure/Unsecured Status โจ
okay so a zone KEY RR with the "no-key" type field value (both key type flag bits 0 and 1 on) means the zone is unsecured ๐ and a zone KEY RR with a key present means the zone is secure ๐. the secured vs unsecured status can change depending on the cryptographic algorithm, and even for the same algorithm you can end up with conflicting zone KEY RRs floating around ๐
zone KEY RRs (like every RR) are only trusted if a SIG RR authenticates them. that SIG's signer field has to be a signer whose public key the resolver trusts, AND resolver policy has to allow that signer to sign for the KEY owner name ๐ซถ untrusted zone KEY RRs MUST be ignored when figuring out the zone's security status. BUT you can have multiple sets of trusted zone KEY RRs for one zone, split by different algorithms, signers, etc. it's giving layers ๐ง
for any particular algorithm, a zone can be:
- secure: any retrieved RR has to be authenticated by a SIG RR or it gets thrown out as bogus ๐ซ
- unsecured: SIG RRs aren't expected or required for RRs from the zone ๐ธ
- experimentally secure: SIG RRs might or might not be there, but if they are, they must be checked ๐งช
here's how the zone's status gets decided:
- if, for a zone and algorithm, every trusted zone KEY RR says there's no key for that zone, the zone is unsecured for that algorithm ๐ท
- if there's at least one trusted no-key zone KEY RR AND at least one trusted key specifying zone KEY RR, then the zone is only experimentally secure for that algorithm. the resolver should accept both authenticated and non-authenticated RRs from it โจ
- if every trusted zone KEY RR the zone and algorithm has is key specifying, then it's secure for that algorithm and only authenticated RRs from it get accepted ๐
Examples:
(1) A resolver initially trusts only signatures by the superzone of zone Z within the DNS hierarchy. Thus it will look only at the KEY RRs that are signed by the superzone. If it finds only no-key KEY RRs, it will assume the zone is not secure. If it finds only key specifying KEY RRs, it will assume the zone is secure and reject any unsigned responses. If it finds both, it will assume the zone is experimentally secure
(2) A resolver trusts the superzone of zone Z (to which it got securely from its local zone) and a third party, cert-auth.example. When considering data from zone Z, it may be signed by the superzone of Z, by cert-auth.example, by both, or by neither. The following table indicates whether zone Z will be considered secure, experimentally secure, or unsecured, depending on the signed zone KEY RRs for Z;
c e r t - a u t h . e x a m p l e
KEY RRs| None | NoKeys | Mixed | Keys |
S --+-----------+-----------+----------+----------+
u None | illegal | unsecured | experim. | secure |
p --+-----------+-----------+----------+----------+
e NoKeys | unsecured | unsecured | experim. | secure |
r --+-----------+-----------+----------+----------+
Z Mixed | experim. | experim. | experim. | secure |
o --+-----------+-----------+----------+----------+
n Keys | secure | secure | secure | secure |
e +-----------+-----------+----------+----------+
3.5. KEY RRs in the Construction of Responses ๐
an explicit request for KEY RRs doesn't trigger any special extra processing, except of course for the matching SIG RR from a security aware server (see Section 4.2) ๐
security aware DNS servers include KEY RRs as additional information in responses, when a KEY is available, in these cases:
(1) when SOA or NS RRs are retrieved, the KEY RRset with the same name (maybe just a zone key) SHOULD be included as additional information if there's space. if not all the additional info fits, type A and AAAA glue RRs get higher priority than KEY RR(s) ๐ง
(2) when type A or AAAA RRs are retrieved, the KEY RRset with the same name (usually just a host RR and NOT the zone key (which usually would have a different name)) SHOULD be included if there's space. when A or AAAA RRs get included as additional info, the KEY RRset with the same name should also be included, but with lower priority than the A or AAAA RRs ๐
4. The SIG Resource Record ๐
the SIG or "signature" resource record (RR) is the fundamental way data gets authenticated in the secure Domain Name System (DNS). so honestly? it's the heart of the whole security situation ๐
the SIG RR unforgably authenticates an RRset [RFC 2181] of a particular type, class, and name, and binds it to a time interval and the signer's domain name. this is done with cryptographic techniques and the signer's private key. the signer is frequently the owner of the zone the RR came from ๐
the type number for the SIG RR type is 24 ๐ฆ
4.1. SIG RDATA Format ๐
the RDATA portion of a SIG RR looks like this. the integrity of the RDATA info is protected by the signature field ๐ก๏ธ
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| type covered | algorithm | labels |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| original TTL |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| signature expiration |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| signature inception |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| key tag | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ signer's name +
| /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-/
/ /
/ signature /
/ /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
4.1.1. Type Covered Field ๐ง
the "type covered" is the type of the other RRs covered by this SIG ๐ฏ
4.1.2. Algorithm Number Field ๐ข
this octet is as described in section 3.2 ๐
4.1.3. Labels Field ๐ท๏ธ
the "labels" octet is an unsigned count of how many labels there are in the original SIG RR owner name. it doesn't count the null label for root, and it doesn't count any initial "*" for a wildcard. if a secured retrieval is the result of wild card substitution, the resolver needs the original form of the name to verify the digital signature. this field makes it easy to figure out that original form ๐
if, on retrieval, the RR appears to have a longer name than "labels" says, the resolver can tell it came from wildcard substitution. if the RR owner name looks shorter than the labels count, the SIG RR must be considered corrupt and ignored ๐ โโ๏ธ the maximum number of labels allowed in the current DNS is 127, but the entire octet is reserved and would be required should DNS names ever get expanded to 255 labels ๐ the table below gives some examples. the value of "labels" is at the top, the retrieved owner name is on the left, and the table entry is the name to use in signature verification, except that "bad" means the RR is corrupt ๐
labels= | 0 | 1 | 2 | 3 | 4 |
--------+-----+------+--------+----------+----------+
.| . | bad | bad | bad | bad |
d.| *. | d. | bad | bad | bad |
c.d.| *. | *.d. | c.d. | bad | bad |
b.c.d.| *. | *.d. | *.c.d. | b.c.d. | bad |
a.b.c.d.| *. | *.d. | *.c.d. | *.b.c.d. | a.b.c.d. |
4.1.4. Original TTL Field โณ
the "original TTL" field is in the RDATA portion so that (1) caching servers don't cause authentication problems by decrementing the real TTL field, and (2) unscrupulous servers can't cause security problems by messing with the real TTL field ๐ this original TTL is protected by the signature, but the current TTL field isn't ๐
NOTE: The "original TTL" must be restored into the covered RRs when the signature is verified (see Section 8). This generaly implies that all RRs for a particular type, name, and class, that is, all the RRs in any particular RRset, must have the same TTL to start with. โ ๏ธ
4.1.5. Signature Expiration and Inception Fields ๐
the SIG is valid from the "signature inception" time until the "signature expiration" time. both are unsigned numbers of seconds since the start of 1 January 1970, GMT, ignoring leap seconds. (See also Section 4.4.) ring arithmetic is used, same as for DNS SOA serial numbers [RFC 1982], which means these times can never be more than about 68 years in the past or the future. so these times are ambiguous modulo ~136.09 years. however, there's no security flaw, because keys are required to be changed to new random keys by [RFC 2541] at least every five years. this means the probability that the same key is in use N*136.09 years later should be the same as the probability that a random guess will work ๐ฒ
a SIG RR may have an expiration time numerically less than its inception time if the expiration time is near the 32 bit wrap around point and/or the signature is long lived ๐
(To prevent misordering of network requests to update a zone dynamically, monotonically increasing "signature inception" times may be necessary.)
a secure zone must be considered changed for SOA serial number purposes not only when its data is updated, but also when new SIG RRs are inserted (ie, the zone or any part of it is re-signed) ๐
4.1.6. Key Tag Field ๐
the "key Tag" is a two octet quantity used to efficiently pick between multiple keys that might apply. it lets you check that a public key about to be used for the computationally expensive job of checking the signature is possibly valid ๐ง for algorithm 1 (MD5/RSA) as defined in [RFC 2537], it's the next to the bottom two octets of the public key modulus needed to decode the signature field. that is to say, the most significant 16 of the least significant 24 bits of the modulus, in network (big endian) order. for all other algorithms, including private algorithms, it's calculated as a simple checksum of the KEY RR, as described in Appendix C ๐งฎ
4.1.7. Signer's Name Field โ๏ธ
the "signer's name" field is the domain name of the signer that generated the SIG RR. this is the owner name of the public KEY RR that can be used to verify the signature. it's frequently the zone that contained the RRset being authenticated. which signers should be authorized to sign what is a significant resolver policy question, as discussed in Section 6. the signer's name may be compressed with standard DNS name compression when it's sent over the network ๐ซง
4.1.8 Signature Field
okay so the signature field is the thing that actually locks everything together ๐โจ it binds the other RDATA fields to the RRset of the "type covered" RRs with that owner name and class, which means that covered RRset gets authenticated ๐ to build the data sequence, you do this:
data = RDATA | RR(s)...
where "|" is concatenation, and:
- RDATA is the wire format of all the RDATA fields in the SIG RR itself (including the canonical form of the signer's name) before but not including the signature.
- RR(s) is the RRset of the RR(s) of the type covered with the same owner name and class as the SIG RR, in canonical form and order as defined in Section 8.
how that data sequence gets turned into the signature is algorithm dependent ๐ง those algorithm dependent formats and procedures live in separate documents (Section 3.2).
SIGs SHOULD NOT be included in a zone for any "meta-type" such as ANY, AXFR, etc. (but see section 5.6.2 with regard to IXFR). ๐ โโ๏ธ
4.1.8.1 Calculating Transaction and Request SIGs
a response message from a security aware server may optionally contain a special SIG at the end of the additional information section to authenticate the whole transaction ๐ฆ
this SIG has a "type covered" field of zero, which is not a valid RR type ๐ it's calculated using a "data" (see Section 4.1.8) of the entire preceding DNS reply message, including the DNS header but not the IP header, and before the reply RR counts have been adjusted for the inclusion of any transaction SIG. that gets concatenated with the entire DNS query message that produced the response, including the query's DNS header and any request SIGs but not its IP header. so basically:
data = full response (less transaction SIG) | full query
verifying the transaction SIG (which is signed by the server host key, not the zone key) is how the requesting resolver shows that the query and response were not tampered with in transit, that the response corresponds to the intended query, and that the response comes from the queried server ๐ต๏ธโโ๏ธ๐
a DNS request may be optionally signed by including one or more SIGs at the end of the query. those SIGs are identified by having a "type covered" field of zero. they sign the preceding DNS request message, including the DNS header but not the IP header or any request SIGs at the end, and before the request RR counts have been adjusted for the inclusion of any request SIG(s). ๐ธ
WARNING: Request SIGs are unnecessary for any currently defined request other than update [RFC 2136, 2137] and will cause some old DNS servers to give an error return or ignore a query. However, such SIGs may in the future be needed for other requests. ๐
except where needed to authenticate an update or similar privileged request, servers are not required to check request SIGs. ๐ซถ
4.2 SIG RRs in the Construction of Responses
security aware DNS servers SHOULD, for every authenticated RRset the query will return, attempt to send the available SIG RRs which authenticate the requested RRset. the following rules apply to including SIG RRs in responses ๐
- when an RRset is placed in a response, its SIG RR has a higher priority for inclusion than additional RRs that may need to be included. if space does not permit its inclusion, the response MUST be considered truncated except as provided in 2 below. ๐จ
- when a SIG RR is present in the zone for an additional information section RR, the response MUST NOT be considered truncated merely because space does not permit the inclusion of the SIG RR with the additional information. ๐ โโ๏ธโจ
- SIGs to authenticate glue records and NS RRs for subzones at a delegation point are unnecessary and MUST NOT be sent. ๐ซ
- if a SIG covers any RR that would be in the answer section of the response, its automatic inclusion MUST be in the answer section. if it covers an RR that would appear in the authority section, its automatic inclusion MUST be in the authority section. if it covers an RR that would appear in the additional information section, it MUST appear in the additional information section. this is a change in the existing standard [RFCs 1034, 1035], which contemplates only NS and SOA RRs in the authority section. ๐
- optionally, DNS transactions may be authenticated by a SIG RR at the end of the response in the additional information section (Section 4.1.8.1). such SIG RRs are signed by the DNS server originating the response. although the signer field MUST be a name of the originating server host, the owner name, class, TTL, and original TTL, are meaningless. the class and TTL fields SHOULD be zero. to conserve space, the owner name SHOULD be root (a single zero octet). if transaction authentication is desired, that SIG RR must be considered the highest priority for inclusion. ๐ง
4.3 Processing Responses and SIG RRs
the following rules apply to processing SIG RRs included in a response ๐
- a security aware resolver that receives a response from a security aware server via a secure communication with the AD bit (see Section 6.1) set MAY choose to accept the RRs as received without verifying the zone SIG RRs. ๐ฆ
- in other cases, a security aware resolver SHOULD verify the SIG RRs for the RRs of interest. this may involve initiating additional queries for SIG or KEY RRs, especially in the case of getting a response from a server that does not implement security. (as explained in 2.3.5 above, it will not be possible to secure CNAMEs being served up by non-secure resolvers.) ๐ง
NOTE: Implementers might expect the above SHOULD to be a MUST. However, local policy or the calling application may not require the security services. ๐
- if SIG RRs are received in response to a user query explicitly specifying the SIG type, no special processing is required. ๐
if the message does not pass integrity checks, or the SIG does not check against the signed RRs, the SIG RR is invalid and should be ignored. if all of the SIG RR(s) purporting to authenticate an RRset are invalid, then the RRset is not authenticated. ๐ฅ
if the SIG RR is the last RR in a response in the additional information section and has a type covered of zero, it is a transaction signature of the response and the query that produced the response. it MAY be optionally checked, and the message rejected if the checks fail. but even if the checks succeed, such a transaction authentication SIG does NOT directly authenticate any RRs in the message. only a proper SIG RR signed by the zone, or by a key tracing its authority to the zone or to static resolver configuration, can directly authenticate RRs, depending on resolver policy (see Section 6). if a resolver does not implement transaction and/or request SIGs, it MUST ignore them without error. ๐
if all checks indicate that the SIG RR is valid, then RRs verified by it should be considered authenticated. โ
4.4 Signature Lifetime, Expiration, TTLs, and Validity
security aware servers MUST NOT consider SIG RRs to authenticate anything before their signature inception or after its expiration time (see also Section 6). security aware servers MUST NOT consider any RR to be authenticated after all its signatures have expired. โฐ
when a secure server caches authenticated data, if the TTL would expire at a time further in the future than the authentication expiration time, the server SHOULD trim the TTL in the cache entry so it doesn't extend beyond the authentication expiration time. within these constraints, servers should continue to follow DNS TTL aging. thus, authoritative servers should continue to follow the zone refresh and expire parameters, and a non-authoritative server should count down the TTL and discard RRs when the TTL is zero (even for a SIG that has not yet reached its authentication expiration time). ๐งฎ
in addition, when RRs are transmitted in a query response, the TTL should be trimmed so that current time plus the TTL does not extend beyond the authentication expiration time. so in general, the TTL on a transmitted RR would be:
min(authExpTim,max(zoneMinTTL,min(originalTTL,currentTTL)))
when signatures are generated, signature expiration times should be set far enough in the future that it is quite certain new signatures can be generated before the old ones expire. however, setting expiration too far into the future could mean a long time to flush any bad data or signatures that may have been generated. ๐
it is recommended that signature lifetime be a small multiple of the TTL (ie, 4 to 16 times the TTL) but not less than a reasonable maximum re-signing interval and not less than the zone expiry time. ๐
5. Non-existent Names and Types ๐
the SIG RR mechanism described in Section 4 above provides strong authentication of RRs that exist in a zone. but it is not clear above how to verifiably deny the existence of a name in a zone, or a type for an existent name. ๐ค
the nonexistence of a name in a zone is indicated by the NXT ("next") RR for a name interval containing the nonexistent name. an NXT RR or RRs and its or their SIG(s) are returned in the authority section, along with the error, if the server is security aware. the same is true for a non-existent type under an existing name, except that there is no error indication other than an empty answer section accompanying the NXT(s). this is a change in the existing standard [RFCs 1034/1035], which contemplates only NS and SOA RRs in the authority section. NXT RRs will also be returned if an explicit query is made for the NXT type. ๐ซ
the existence of a complete set of NXT records in a zone means that any query for any name and any type to a security aware server serving the zone will result in a reply containing at least one signed RR, unless it is a query for delegation point NS or glue A or AAAA RRs. ๐
5.1 The NXT Resource Record
the NXT resource record is used to securely indicate that RRs with an owner name in a certain name interval do not exist in a zone, and to indicate what RR types are present for an existing name. ๐ง
the owner name of the NXT RR is an existing name in the zone. It's RDATA is a "next" name and a type bit map. thus, the NXT RRs in a zone create a chain of all of the literal owner names in that zone, including unexpanded wildcards but omitting the owner name of glue address records unless they would otherwise be included. this implies a canonical ordering of all domain names in a zone, as described in Section 8. the presence of the NXT RR means that no name between its owner name and the name in its RDATA area exists, and that no other types exist under its owner name. ๐
there is a potential problem with the last NXT in a zone, as it wants to have an owner name which is the last existing name in canonical order (which is easy), but it is not obvious what name to put in its RDATA to indicate the entire remainder of the name space. this is handled by treating the name space as circular and putting the zone name in the RDATA of the last NXT in a zone. ๐โจ
the NXT RRs for a zone SHOULD be automatically calculated and added to the zone when SIGs are added. the NXT RR's TTL SHOULD NOT exceed the zone minimum TTL. โฑ๏ธ
the type number for the NXT RR is 30. ๐ข
NXT RRs are only signed by zone level keys. ๐
5.2 NXT RDATA Format โจ
okay so the RDATA for an NXT RR is honestly so simple ๐ it's just a domain name followed by a bit map. Here's the layout:
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| next domain name /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| type bit map /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
the type bit map is the main character here ๐ฆ right now the format only uses one bit per RR type that's present for the owner name. a one bit means at least one RR of that type exists for the owner name, and a zero means none does. any bits past the end of the bit map are assumed to be zero, so you don't have to store them ๐
bit 30 (for NXT) is always on, so the minimum bit map length is actually four octets. also, trailing zero octets are prohibited in this format, so no padding them out ๐
the first bit represents RR type zero, which is an illegal type that can not be present, so it's always zero in this format ๐ข this format also isn't used if there's an RR with a type number greater than 127. if the zero bit of the type bit map is a one, that means a different format is being used instead, and that's always the case if a type number greater than 127 is present โจ
the domain name can be compressed with standard DNS name compression when it's sent over the network ๐ง and you can figure out the size of the bit map from the RDLENGTH and the length of the next domain name, which is kinda genius honestly ๐ค
5.3 Additional Complexity Due to Wildcards ๐
okay so proving that a non-existent name response is correct, or that a wildcard expansion response is correct, gets a little more complicated ๐
here's the deal: when a non-existent name response comes back, an NXT must be returned showing that the exact name that was queried didn't exist. but in general, one or more extra NXTs also need to be returned to prove that there wasn't a wildcard that should have been expanded instead. (there's no need to return multiple copies of the same NXT ๐ โโ๏ธ) any of these NXTs are returned in the authority section of the response ๐
and if a wildcard expansion is returned in a response, one or more NXTs usually need to come along in the authority section too. their job is to prove that no more specific name existed (including possibly more specific wildcards in the zone) that the response should have been based on ๐ต๏ธโโ๏ธ
5.4 Example ๐
let's say zone foo.nil has entries for:
big.foo.nil,
medium.foo.nil.
small.foo.nil.
tiny.foo.nil.
so if a query goes to a security aware server for huge.foo.nil, it would give back an error reply with an RCODE of NXDOMAIN, and the authority section would include something like this ๐
foo.nil. NXT big.foo.nil NS KEY SOA NXT ;prove no *.foo.nil
foo.nil. SIG NXT 1 2 ( ;type-cov=NXT, alg=1, labels=2
19970102030405 ;signature expiration
19961211100908 ;signature inception
2143 ;key identifier
foo.nil. ;signer
AIYADP8d3zYNyQwW2EM4wXVFdslEJcUx/fxkfBeH1El4ixPFhpfHFElxbvKoWmvjDTCm
fiYy2X+8XpFjwICHc398kzWsTMKlxovpz2FnCTM= ;signature (640 bits)
)
big.foo.nil. NXT medium.foo.nil. A MX SIG NXT ;prove no huge.foo.nil
big.foo.nil. SIG NXT 1 3 ( ;type-cov=NXT, alg=1, labels=3
19970102030405 ;signature expiration
19961211100908 ;signature inception
2143 ;key identifier
foo.nil. ;signer
MxFcby9k/yvedMfQgKzhH5er0Mu/vILz45IkskceFGgiWCn/GxHhai6VAuHAoNUz4YoU
1tVfSCSqQYn6//11U6Nld80jEeC8aTrO+KKmCaY= ;signature (640 bits)
)
the big.foo.nil NXT in there tells us that big.foo.nil is an existing name in the zone, so it has other RR types associated with it besides NXT ๐ but only the NXT (and its SIG) RR shows up in the response to the huge.foo.nil query, since that name doesn't exist at all ๐ซถ
5.5 Special Considerations at Delegation Points ๐ง
a name (other than root) that's the head of a zone also shows up as the leaf in a superzone ๐ณ if both are secure, there will always be two different NXT RRs with the same name. the good news is you can tell them apart by their signers, their next domain name fields, whether the SOA type bit is set, etc. ๐ security aware servers should return the correct NXT automatically when they're needed to authenticate that a name doesn't exist, and both NXTs (if they're available) when there's an explicit query for type NXT โจ
non-security aware servers will never automatically return an NXT, and some old implementations may only return the NXT from the subzone on explicit queries ๐ฆ
5.6 Zone Transfers ๐
the subsections below cover how full and incremental zone transfers get secured ๐
SIG RRs secure all authoritative RRs that get transferred, for both full and incremental [RFC 1995] zone transfers ๐ NXT RRs are an essential part of secure zone transfers, and they make sure every authoritative name and type is present. however, if there are multiple SIGs with the same name and type covered, only a subset of the SIGs could be sent, as long as at least one is present. and for unsigned delegation point NS or glue A or AAAA RRs, a subset of those RRs (or a modified set) could be sent, as long as at least one of each type is included ๐งฉ
when an incremental or full zone transfer request comes in with the same or a newer version number than the server's copy of the zone, the reply is just the SOA RR of the server's current version, plus the SIG RRset that verifies that SOA RR ๐
the complete NXT chains in this document let a resolver obtain all of the names in a zone by making successive queries that chain through the NXTs, even if zone transfers are prohibited ๐ different format NXTs may be specified in the future to avoid this ๐
5.6.1 Full Zone Transfers ๐ก๏ธ
to provide server authentication that a complete transfer has happened, transaction authentication SHOULD be used on full zone transfers ๐ซก this gives strong server based protection for the entire zone while it's in transit ๐ฅ
5.6.2 Incremental Zone Transfers ๐
individual RRs in an incremental (IXFR) transfer [RFC 1995] can be verified the same way as in a full zone transfer ๐ the integrity of the NXT name chain and the correctness of the NXT type bits for the zone after the incremental RR deletes and adds can check each disjoint area of the zone that got updated. but the completeness of an incremental transfer can not be confirmed, because usually neither the deleted RR section nor the added RR section has a complete zone NXT chain ๐ญ so a server that securely supports IXFR must handle IXFR SIG RRs for each incremental transfer set that it maintains ๐
the IXFR SIG is calculated over the incremental zone update collection of RRs, in the order they're transmitted: old SOA, then deleted RRs, then new SOA and added RRs. within each section, RRs must be ordered as specified in Section 8 ๐ if the zone owner condenses adjacent incremental update sets, the original IXFR SIG for each set in the condensation must be discarded, and a new IXFR SIG gets calculated to cover the resulting condensed set ๐ง
the IXFR SIG really belongs to the zone as a whole, not to the zone name. even though it SHOULD be correct for the zone name, the labels field of an IXFR SIG is otherwise meaningless ๐คทโโ๏ธ the IXFR SIG is only sent as part of an incremental zone transfer. after the IXFR SIG is validated, the transferred RRs MAY be considered valid without verifying the internal SIGs, if that kind of trust in the server fits the local policy ๐ซถ
6. How to Resolve Securely and the AD and CD Bits ๐โจ
okay so retrieving or resolving secure data from the Domain Name System (DNS) starts with one or more trusted public keys that have been statically configured at the resolver ๐๏ธ with starting trusted keys, a resolver that's willing to do cryptography can move securely through the secure DNS structure to the zone of interest, as described in Section 6.3. those trusted public keys would normally be configured in a way similar to what's described in Section 6.2. but as a practical matter, a security aware resolver would still gain some confidence in the results it returns, even if it wasn't configured with any keys, as long as it trusted what it got from a local well known server as if that server were statically configured ๐ธ
data stored at a security aware server needs to be internally categorized as Authenticated, Pending, or Insecure ๐๏ธ there's also a fourth transient state, Bad, which means all SIG checks have explicitly failed on the data. Bad data is not retained at a security aware server ๐๏ธ Authenticated means the data has a valid SIG under a KEY that's traceable, through a chain of zero or more SIG and KEY RRs allowed by the resolver's policies, to a KEY that's statically configured at the resolver โ Pending data has no authenticated SIGs and at least one additional SIG that the resolver is still trying to authenticate โณ Insecure data is data that's known can never be either Authenticated or found Bad in the zone where it was found, because it's in or has been reached through an unsecured zone, or because it's unsigned glue address or delegation point NS data ๐ how control of and flagging based on these data labels behaves is described in Section 6.1 ๐ฉ
the proper validation of signatures requires a reasonably secure shared opinion of the absolute time between resolvers and servers, as described in Section 6.4 โฐ๐
6.1 The AD and CD Header Bits โจ
okay bestie, two bits that were just sitting there doing nothing got a promotion ๐ They're allocated out of the DNS query/response header. The AD (authentic data) bit is the server saying "everything in my answer and authority parts has been authenticated by me, per my own policies" ๐ซถ The CD (checking disabled) bit is a query saying "Pending (non-authenticated) data is fine with me, I'll take it" ๐
These bits come out of the old must-be-zero Z field, like this ๐ฆ
1 1 1 1 1 1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| ID |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|QR| Opcode |AA|TC|RD|RA| Z|AD|CD| RCODE |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| QDCOUNT |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| ANCOUNT |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| NSCOUNT |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| ARCOUNT |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
Here's the vibe check: old servers and resolvers have these bits set to zero, so the responses from old servers never look authenticated to security aware resolvers ๐ And queries from non-security aware resolvers don't assert the CD bit, so security aware servers only answer them with Authenticated or Insecure data. Super cute, super safe.
Security aware resolvers MUST NOT trust the AD bit unless they trust the server they're talking to AND either have a secure path to it or use DNS transaction security. No shortcuts, periodt ๐ฅ
Any security aware resolver that's willing to do cryptography SHOULD assert the CD bit on all queries. This lets it impose its own policies, and it also cuts DNS latency, because security aware servers are allowed to answer with Pending data ๐
Security aware servers MUST NOT return Bad data. Ever. ๐ญ For non-security aware resolvers, or security aware resolvers that asked for service by leaving the CD bit clear, security aware servers MUST return only Authenticated or Insecure data in the answer and authority sections, with the AD bit set in the response. For security aware resolvers that ask for it by asserting the CD bit, security aware servers SHOULD return Pending data, with the AD bit clear in the response ๐
The AD bit MUST NOT be set on a response unless all of the RRs in the answer and authority sections are either Authenticated or Insecure. And the AD bit does not cover the additional information section, so don't let that one trick you ๐
6.2 Staticly Configured Keys ๐ง
The public key used to authenticate a zone SHOULD be defined in local configuration files before that zone is loaded at the primary server, so the zone can be authenticated. Think of it as getting your ID ready before the club opens ๐
Now, you'd think everyone should just start with a public key for the root zone and hardcode it into every resolver, right? Nope, not so fast ๐ โโ๏ธ Updating every DNS resolver in the world if that key ever changed would be an absolute nightmare. Plus, lots of organizations want their "interior" DNS implementations to trust ONLY their own DNS servers. Those interior resolvers can go through the organization's zone servers to reach data outside the organization's domain, and they don't need keys above the organization's DNS apex. Boundaries, iconic ๐
Host resolvers that aren't part of a larger organization may be configured with a key for the domain of their local ISP, whose recursive secure DNS caching server they use ๐ธ
6.3 Chaining Through The DNS ๐ฆ
Okay so starting with one or more trusted keys for any zone, it should be possible to retrieve signed keys for that zone's subzones that have a key. A secure sub-zone is indicated by a KEY RR with non-null key information appearing with the NS RRs in the sub-zone, and it may also be present in the parent. These are what let you climb down the tree of zones, one step at a time โจ
6.3.1 Chaining Through KEYs ๐
Generally, some RRset you want to validate in the secure DNS will be signed by one or more SIG RRs. Each of those SIG RRs has a signer, and under that signer's name is stored the public KEY used to authenticate the SIG. Each of those KEYs will, generally, also be signed with a SIG, and those SIGs have signer names that point to KEYs too. And so on, and so on ๐ So authentication ends up as chains of alternating SIG and KEY RRs. The first SIG signs the original data whose authenticity you want to show, and the final KEY is some trusted key that's staticly configured at the resolver doing the authenticating ๐ซถ
When you test a chain, the validity periods of the SIGs you run into must be intersected to find the validity period of the data's authentication. That part is purely algorithmic, no vibes needed ๐งฎ Each SIG over the data, checked against a KEY, also has to pass the objective cryptographic test implied by the algorithm used (though even here, the resolver may have policies about which algorithms and key lengths it trusts). The big one is the judgement call: deciding that a SIG with a particular signer name can authenticate data with a particular owner name (possibly a KEY RRset). That's mainly a policy question, and it's local to the resolver and to any clients that depend on that resolver's decisions. It is, however, recommended that the policy below be adopted ๐
Let A < B mean that A is a shorter domain name than B formed by
dropping one or more whole labels from the left end of B, i.e.,
A is a direct or indirect superdomain of B. Let A = B mean that
A and B are the same domain name (i.e., are identical after
letter case canonicalization). Let A > B mean that A is a
longer domain name than B formed by adding one or more whole
labels on the left end of B, i.e., A is a direct or indirect
subdomain of B
Let Static be the owner names of the set of staticly configured
trusted keys at a resolver.
Then Signer is a valid signer name for a SIG authenticating an
RRset (possibly a KEY RRset) with owner name Owner at the
resolver if any of the following three rules apply:
(1) Owner > or = Signer (except that if Signer is root, Owner
must be root or a top level domain name). That is, Owner is the
same as or a subdomain of Signer.
(2) ( Owner < Signer ) and ( Signer > or = some Static ). That
is, Owner is a superdomain of Signer and Signer is staticly
configured or a subdomain of a staticly configured key.
(3) Signer = some Static. That is, the signer is exactly some
staticly configured key.
Rule 1 is the rule for going down the DNS tree. It also has a special prohibition on the root zone key, because the root zone is only allowed to be one label deep. It's the most fundamental rule, so know it by heart ๐
Rule 2 is the rule for going back up the DNS tree from one or more staticly configured keys. Rule 2 has no effect if only root zone keys are staticly configured ๐
Rule 3 is the rule that permits direct cross certification. Rule 3 also has no effect if only root zone keys are staticly configured ๐ธ
Great care should be taken to fully consider the consequences before making any local policy adjustments to these rules. (The one exception is dispensing with rules 2 and 3 when only root zone keys are staticly configured.) Don't be reckless with this, bestie ๐
6.3.2 Conflicting Data ๐ฅ
It's possible that multiple SIG-KEY chains will look like they authenticate conflicting RRset answers to the same query. In that case, a resolver should choose only the most reliable answer to return and discard the rest ๐๏ธ What counts as "most reliable" is a matter of local policy, and it could take into account things like how much the resolver trusts certain algorithms, key sizes, staticly configured keys, the zones traversed, and so on. The technique below is recommended for taking SIG-KEY chain length into account.
A resolver should keep track of the number of successive secure zones traversed from a staticly configured key starting point to any secure zone it can reach. In general, the lower that distance number is, the more confidence you can have in the data. Staticly configured data should be given a distance number of zero ๐ฅ If a query runs into different Authenticated data for the same query with different distance values, the one with the larger value should be ignored, unless some other local policy covers the case.
A security conscious resolver should completely refuse to step from a secure zone into an unsecured zone, unless that unsecured zone is certified to be non-secure by the presence of an authenticated KEY RR for the unsecured zone with the no-key type value. Otherwise, the resolver is getting bogus or spoofed data ๐จ
If legitimate unsecured zones show up while traversing the DNS tree, then no zone reachable only through information from those non-secure zones can be trusted as secure. The unsecured zone data could have been spoofed, so the "secure" zone reached through it could be counterfeit ๐ต๏ธโโ๏ธ The "distance" to data in such zones, or to zones reached via such zones, could be set to 256 or more, since that's bigger than the largest possible distance through secure zones in the DNS.
6.4 Secure Time โฐ
Coordinated interpretation of the time fields in SIG RRs requires that reasonably consistent time be available to the hosts implementing the DNS security extensions. Time has to be on the same page, or nothing lines up ๐
A variety of time synchronization protocols exist, including the Network Time Protocol (NTP [RFC 1305, 2030]). If such protocols are used, they MUST be used securely so that time can not be spoofed. Non-negotiable ๐ค
Otherwise, a host could get its clock turned back and then believe old SIG RRs, and the data they authenticate, which were valid once but are no longer ๐ That's a whole time-travel exploit waiting to happen, so keep the clock honest ๐ฐ๏ธ
7. ASCII Representation of Security RRs ๐
This section covers the format for master file and other ASCII presentation of the three DNS security resource records. It's basically how these records look when you write them in plain text ๐
The algorithm field in KEY and SIG RRs can be represented as either an unsigned integer or symbolicly. The following initial symbols are defined as indicated:
Value Symbol
001 RSAMD5
002 DH
003 DSA
004 ECC
252 INDIRECT
253 PRIVATEDNS
254 PRIVATEOID
7.1 Presentation of KEY RRs โจ
okay so KEY RRs are allowed to show up as single logical lines in a zone data master file [RFC 1033]. ๐
The flag field can be written as an unsigned integer, OR as a bunch of mnemonics stuck together with the vertical bar ("|") character. Here's the breakdown ๐
BIT Mnemonic Explanation
0-1 key type
NOCONF =1 confidentiality use prohibited
NOAUTH =2 authentication use prohibited
NOKEY =3 no key present
2 FLAG2 - reserved
3 EXTEND flags extension
4 FLAG4 - reserved
5 FLAG5 - reserved
6-7 name type
USER =0 (default, may be omitted)
ZONE =1
HOST =2 (host or other end entity)
NTYP3 - reserved
8 FLAG8 - reserved
9 FLAG9 - reserved
10 FLAG10 - reserved
11 FLAG11 - reserved
12-15 signatory field, values 0 to 15
can be represented by SIG0, SIG1, ... SIG15
No flag mnemonic needs to show up if the bit or field it stands for is zero. Lowkey so clean ๐ง
The protocol octet can be written as a number or as a symbol. These are the starter symbols that are defined ๐
000 NONE
001 TLS
002 EMAIL
003 DNSSEC
004 IPSEC
255 ALL
Note that if the type flags field has the NOKEY value, nothing shows up after the algorithm octet. ๐
The rest of the public key is written in base 64 (see Appendix A). It can be chopped up into any number of substrings separated by white space, all the way down to single base 64 digits, and they get glued back together to form the full key. These substrings can run across lines using the standard parenthesis. โจ
Also, the public key might have its own internal sub-fields, but those never show up in the master file. For example, with algorithm 1 there's a public exponent size, then a public exponent, then a modulus. With algorithm 254, there's an OID size, an OID, and algorithm dependent information. But either way, only one single logical base 64 string appears in the master file. Iconic restraint ๐
7.2 Presentation of SIG RRs ๐ฆ
A data SIG RR can be written as a single logical line in a zone data file [RFC 1033]. There are a few special considerations, though, which I'll get into. (It doesn't make sense to include a transaction or request authenticating SIG RR in a file, since those are transient authentications that cover data including an ephemeral transaction number. They have to be calculated in real time, bestie.) ๐ฅ
The signer, covered type, and times are no big deal. The time fields look like YYYYMMDDHHMMSS, where YYYY is the year, the first MM is the month number (01-12), DD is the day of the month (01-31), HH is the hour in 24 hour notation (00-23), the second MM is the minute (00-59), and SS is the second (00-59). ๐ธ
The original TTL field is an unsigned integer. โจ
If the original TTL, the one that applies to the signed type, is the same as the TTL of the SIG RR itself, it can be left out. The date field that comes after it is bigger than the maximum possible TTL, so there's no ambiguity. Clean ๐งผ
The "labels" field is an unsigned integer. The key tag is an unsigned number. ๐
BUT the signature itself can be super long, so it's the last data field and it's written in base 64 (see Appendix A). Same deal as before: it can be split into any number of white space separated substrings, down to single base 64 digits, which get concatenated to give the full signature. These substrings can be split between lines using the standard parenthesis. The signature is the main character of the whole line ๐
7.3 Presentation of NXT RRs ๐
NXT RRs don't show up in original unsigned zone master files, because they should be derived from the zone as it's being signed. If a signed file with NXTs added gets printed, or NXTs get printed by debugging code, they show up as the next domain name followed by the RR type present bits, written as an unsigned integer or a sequence of RR mnemonics. ๐ง
8. Canonical Form and Order of Resource Records โจ
This section lays out, for DNS security purposes, the canonical form of resource records (RRs), their name order, and their overall order. A canonical name order is necessary to build the NXT name chain. A canonical form and ordering within an RRset is necessary to consistently construct and verify SIG RRs. A canonical ordering of types within a name is required for incremental transfer (Section 5.6.2). It's giving organized ๐๐
8.1 Canonical RR Form ๐
For DNS security, the canonical form of an RR is the wire format of the RR with the following things:
- domain names fully expanded (no name compression via pointers),
- all domain name letters set to lower case,
- owner name wild cards in master file form (no substitution made for *), and
- the original TTL substituted for the current TTL.
8.2 Canonical DNS Name Order ๐ฆ
For DNS security, owner names are put in canonical order by sorting the individual labels as unsigned left justified octet strings. An absent octet sorts before a zero value octet, and upper case letters are treated as lower case letters. Names in a zone get sorted by the highest level label first, then, within names that share that highest level label, by the next lower label, and so on, all the way down to the leaf node labels. Inside a zone, the zone name itself always exists, and every other name is the zone name with some prefix of lower level labels tacked on. So the zone name always sorts first. Main character energy ๐
Example:
foo.example
a.foo.example
yljkjljk.a.foo.example
Z.a.foo.example
zABC.a.FOO.EXAMPLE
z.foo.example
*.z.foo.example
\200.z.foo.example
8.3 Canonical RR Ordering Within An RRset ๐
Within any particular owner name and type, RRs are sorted by RDATA as a left justified unsigned octet sequence. An absent octet sorts before the zero octet. ๐ซถ
8.4 Canonical Ordering of RR Types โจ
When RRs with the same name but different types have to be ordered, they're ordered by type, treating the type as an unsigned integer. The exception is that SIG RRs go immediately after the type they cover. So for example, an A record goes before an MX record, because A is type 1 and MX is type 15. But if both were signed, the order would be A < SIG(A) < MX < SIG(MX). Ordering is lowkey everything ๐ธ
9. Conformance ๐
Levels of server and resolver conformance are defined below. ๐ฆ
9.1 Server Conformance ๐ง
Two levels of server conformance for DNS security are defined:
BASIC: Basic server compliance is the ability to store and retrieve (including zone transfer) SIG, KEY, and NXT RRs. Any secondary or caching server for a secure zone MUST have at least basic compliance, and even then some things, such as secure CNAMEs, won't work without full compliance. ๐ญ
FULL: Full server compliance adds the following to basic compliance: (1) ability to read SIG, KEY, and NXT RRs in zone files, and (2) ability, given a zone file and private key, to add appropriate SIG and NXT RRs, possibly via a separate application, (3) proper automatic inclusion of SIG, KEY, and NXT RRs in responses, (4) suppression of CNAME following on retrieval of the security type RRs, (5) recognize the CD query header bit and set the AD query header bit, as appropriate, and (6) proper handling of the two NXT RRs at delegation points. Primary servers for secure zones MUST be fully compliant. For complete secure operation, all secondary, caching, and other servers handling the zone SHOULD be fully compliant as well. It's giving full commitment ๐ฅ๐ซถ
9.2 Resolver Conformance ๐
Two levels of resolver compliance (including the resolver portion of a server) are defined for DNS Security:
BASIC: A basic compliance resolver can handle SIG, KEY, and NXT RRs when they're explicitly requested. ๐
FULL: A fully compliant resolver (1) understands KEY, SIG, and NXT RRs, including verification of SIGs at least for the mandatory algorithm, (2) maintains appropriate information in its local caches and database to indicate which RRs have been authenticated and to what extent they have been authenticated, (3) performs additional queries as necessary to attempt to obtain KEY, SIG, or NXT RRs when needed, and (4) normally sets the CD query header bit on its queries. Iconic behavior ๐โจ
10. Security Considerations ๐
This document specifies extensions to the Domain Name System (DNS) protocol to provide data integrity and data origin authentication, public key distribution, and optional transaction and request security. ๐
It should be noted that, at most, these extensions guarantee the validity of resource records, including KEY resource records, retrieved from the DNS. They do NOT magically solve other security problems! For example, using secure DNS you can have high confidence in the IP address you retrieve for a host name. However, this does not stop someone from substituting an unauthorized host at that address, or from capturing packets sent to that address and falsely responding with packets that apparently come from that address. Any reasonably complete security system will require the protection of many additional facets of the Internet beyond DNS. Not the whole answer, bestie ๐ญ๐
The implementation of NXT RRs as described herein enables a resolver to determine all the names in a zone even if zone transfers are prohibited (section 5.6). This is an active area of work and may change. ๐
A number of precautions in DNS implementation have evolved over the years to harden the insecure DNS against spoofing. These precautions should not be abandoned. They should be considered to provide additional protection in case of key compromise in secure DNS. Layers, babe ๐ง ๐ก๏ธ
11. IANA Considerations ๐ง
KEY RR flag bits 2 and 8-11, and all flag extension field bits, can be assigned by IETF consensus as defined in RFC 2434. The remaining values of the NAMTYP flag field, and flag bits 4 and 5 (which could conceivably become an extension of the NAMTYP field), can only be assigned by an IETF Standards Action [RFC 2434]. ๐
Algorithm numbers 5 through 251 are available for assignment should sufficient reason arise. However, designating a new algorithm could have a major impact on interoperability and requires an IETF Standards Action [RFC 2434]. The existence of the private algorithm types 253 and 254 should satisfy most needs for private or proprietary algorithms. ๐
Additional values of the Protocol Octet (5-254) can be assigned by IETF Consensus [RFC 2434]. ๐ธ
The meaning of the first bit of the NXT RR "type bit map" being a one can only be assigned by a standards action. ๐
References โจ
- [RFC 1033] Lottor, M., "Domain Administrators Operations Guide", RFC 1033, November 1987.
- [RFC 1034] Mockapetris, P., "Domain Names - Concepts and Facilities", STD 13, RFC 1034, November 1987.
- [RFC 1035] Mockapetris, P., "Domain Names - Implementation and Specifications", STD 13, RFC 1035, November 1987.
- [RFC 1305] Mills, D., "Network Time Protocol (v3)", RFC 1305, March 1992.
- [RFC 1530] Malamud, C. and M. Rose, "Principles of Operation for the TPC.INT Subdomain: General Principles and Policy", RFC 1530, October 1993.
- [RFC 2401] Kent, S. and R. Atkinson, "Security Architecture for the Internet Protocol", RFC 2401, November 1998.
- [RFC 1982] Elz, R. and R. Bush, "Serial Number Arithmetic", RFC 1982, September 1996.
- [RFC 1995] Ohta, M., "Incremental Zone Transfer in DNS", RFC 1995, August 1996.
- [RFC 2030] Mills, D., "Simple Network Time Protocol (SNTP) Version 4 for IPv4, IPv6 and OSI", RFC 2030, October 1996.
- [RFC 2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies", RFC 2045, November 1996.
- [RFC 2065] Eastlake, D. and C. Kaufman, "Domain Name System Security Extensions", RFC 2065, January 1997.
- [RFC 2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.
- [RFC 2136] Vixie, P., Thomson, S., Rekhter, Y. and J. Bound, "Dynamic Updates in the Domain Name System (DNS UPDATE)", RFC 2136, April 1997.
- [RFC 2137] Eastlake, D., "Secure Domain Name System Dynamic Update", RFC 2137, April 1997.
- [RFC 2181] Elz, R. and R. Bush, "Clarifications to the DNS Specification", RFC 2181, July 1997.
- [RFC 2434] Narten, T. and H. Alvestrand, "Guidelines for Writing an IANA Considerations Section in RFCs", BCP 26, RFC 2434, October 1998.
- [RFC 2537] Eastlake, D., "RSA/MD5 KEYs and SIGs in the Domain Name System (DNS)", RFC 2537, March 1999.
- [RFC 2539] Eastlake, D., "Storage of Diffie-Hellman Keys in the Domain Name System (DNS)", RFC 2539, March 1999.
- [RFC 2536] Eastlake, D., "DSA KEYs and SIGs in the Domain Name System (DNS)", RFC 2536, March 1999.
- [RFC 2538] Eastlake, D. and O. Gudmundsson, "Storing Certificates in the Domain Name System", RFC 2538, March 1999.
- [RFC 2541] Eastlake, D., "DNS Operational Security Considerations", RFC 2541, March 1999.
- [RSA FAQ] - RSADSI Frequently Asked Questions periodic posting.
Author's Address ๐
Donald E. Eastlake 3rd
IBM
65 Shindegan Hill Road
RR #1
Carmel, NY 10512
Phone: +1-914-784-7913 (w)
+1-914-276-2668 (h)
Fax: +1-914-784-3833 (w-fax)
EMail: dee3@us.ibm.com
Appendix A: Base 64 Encoding ๐ง
Okay so this encoding technique is taken from [RFC 2045] by N. Borenstein and N. Freed, and it's been reproduced here in an edited form just for convenience ๐ซถ
It uses a 65-character subset of US-ASCII, so each printable character carries 6 bits. The extra 65th character, =, is used to signify a special processing function โจ
The encoding process takes 24-bit groups of input bits and turns them into output strings of 4 encoded characters. Going from left to right, a 24-bit input group is made by sticking 3 8-bit input groups together. Those 24 bits then get split into 4 six-bit groups, and each one is translated into a single digit in the base 64 alphabet ๐
Each 6-bit group works as an index into an array of 64 printable characters, and whichever character that index points to goes into the output string. Here's the whole alphabet:
Table 1: The Base 64 Alphabet
Value Encoding Value Encoding Value Encoding Value Encoding
0 A 17 R 34 i 51 z
1 B 18 S 35 j 52 0
2 C 19 T 36 k 53 1
3 D 20 U 37 l 54 2
4 E 21 V 38 m 55 3
5 F 22 W 39 n 56 4
6 G 23 X 40 o 57 5
7 H 24 Y 41 p 58 6
8 I 25 Z 42 q 59 7
9 J 26 a 43 r 60 8
10 K 27 b 44 s 61 9
11 L 28 c 45 t 62 +
12 M 29 d 46 u 63 /
13 N 30 e 47 v
14 O 31 f 48 w (pad) =
15 P 32 g 49 x
16 Q 33 h 50 y
Now for the special processing, which happens when fewer than 24 bits are left at the end of the data being encoded ๐ A full encoding quantum always gets completed at the end of a quantity. If there are fewer than 24 input bits in an input group, zero bits get added on the right to make an integral number of 6-bit groups. Padding at the end of the data is done with the = character. Since all base 64 input is an integral number of octets, only three cases can happen:
- The final quantum of encoding input is an integral multiple of 24 bits. Here the final unit of encoded output is an integral multiple of 4 characters, with no
=padding. - The final quantum of encoding input is exactly 8 bits. Here the final unit of encoded output is two characters followed by two
=padding characters. - The final quantum of encoding input is exactly 16 bits. Here the final unit of encoded output is three characters followed by one
=padding character.
Appendix B: Changes from RFC 2065 ๐
This section is the tea โ It sums up the most important changes made since RFC 2065.
- Most of Section 7 of [RFC 2065], called "Operational Considerations", has been removed and may be made into a separate document [RFC 2541] ๐ธ
- The KEY RR got a glow-up ๐ (2a) The "experimental" flag was eliminated as unnecessary. (2b) A flag bit was reserved for flags expansion. (2c) A number of bit fields are now encoded more compactly, in a way that leaves unchanged the bits the limited code already deployed actually uses. (2d) The IPSEC and email flag bits were eliminated, since they're replaced by values of the protocol field, and a protocol field value was added for DNS security itself. (2e) Material was added saying zone KEY RRs occur only at delegation points. (2f) The description of the RSA/MD5 algorithm was moved to a separate document [RFC 2537]. Section 3.4, which describes what various combinations of "no-key" and key present KEY RRs mean, was added, and the secure / unsecure status of a zone was clarified as being per algorithm ๐ฅ
- The SIG RR also got updated โจ (3a) The "time signed" field was renamed to the "signature inception" field. (3b) It's now clarified that signature expiration and inception use serial number ring arithmetic. (3c) The definition of the key footprint/tag was changed for algorithms other than 1, and Appendix C was added to specify its calculation. Also, the SIG covering type AXFR was eliminated, while one covering IXFR [RFC 1995] was added (see section 5.6) ๐ฆ
- Algorithm 3, the DSA algorithm, is now the mandatory to implement algorithm ๐ Algorithm 1, the RSA/MD5 algorithm, is now a recommended option. Algorithms 2 and 4 are designated as the Diffie-Hellman key and elliptic cryptography algorithms respectively, and all of them are to be defined in separate documents. Algorithm code point 252 is designated to indicate "indirect" keys, which are to be defined in a separate document, where the actual key is elsewhere. Both the KEY and SIG RR definitions were simplified by eliminating the "null" algorithm 253 that [RFC 2065] had defined. That algorithm had been included because at the time it was thought it might be useful in DNS dynamic update [RFC 2136]. It was in fact not used that way, so it got dropped to simplify DNS security. That algorithm number has been re-used to indicate private algorithms where a domain name specifies the algorithm ๐
- The NXT RR has been changed so that: (5a) the NXT RRs in a zone cover all names, including wildcards as literal names without expansion, except for glue address records whose names would not otherwise appear; (5b) all NXT bit map areas whose first octet has bit zero set have been reserved for future definition; (5c) the number of and circumstances under which an NXT must be returned in connection with wildcard names has been extended; and (5d) in connection with the bit map, references to the WKS RR have been removed and vertical bars (
|) have been added between the RR type mnemonics in the ASCII representation ๐ - Information on the canonical form and ordering of RRs has been moved into a separate Section 8 ๐ง
- A subsection covering incremental and full zone transfer has been added in Section 5 ๐
- Concerning DNS chaining, further specification and policy recommendations on secure resolution have been added, mainly in Section 6.3.1 ๐ฅ It's now clearly stated that authenticated data has a validity period equal to the intersection of the validity periods of the SIG RRs in its authentication chain. The requirement to statically configure a superzone's key, signed by a zone, in all of the zone's authoritative servers has been removed. The recommendation to continue DNS security checks in a secure island of DNS data that is separated from other parts of the DNS tree by insecure zones, and that does not contain a zone for which a key has been statically configured, was dropped ๐
- It was clarified that the presence of the AD bit in a response does not apply to the additional information section or to glue address or delegation point NS RRs. The AD bit only indicates that the answer and authority sections of the response are authoritative ๐
- It is now required that KEY RRs and NXT RRs be signed only with zone-level keys ๐
- An IANA Considerations section was added, along with references to RFC 2434 ๐
Appendix C: Key Tag Calculation โจ
okay so the key tag field in the SIG RR is basically a shortcut ๐ซถ It helps you find the right KEY RR faster when there's more than one KEY RR candidate floating around, like when you're verifying a signature. Two candidate keys can end up with the same tag, and if that happens, you just try each one until one works or they all fail ๐
Here's the reference implementation for calculating the Key Tag for every algorithm except algorithm 1. It's written in ANSI C, and it's built for clarity, not speed ๐ง (For algorithm 1 keys, check section 4.1.6 to see how the Key Tag is determined.)
/* assumes int is at least 16 bits
first byte of the key tag is the most significant byte of return
value
second byte of the key tag is the least significant byte of
return value
*/
int keytag (
unsigned char key[], /* the RDATA part of the KEY RR */
unsigned int keysize, /* the RDLENGTH */
)
{
long int ac; /* assumed to be 32 bits or larger */
for ( ac = 0, i = 0; i < keysize; ++i )
ac += (i&1) ? key[i] : key[i]<<8;
ac += (ac>>16) & 0xFFFF;
return ac & 0xFFFF;
}
Full Copyright Statement ๐
Copyright (C) The Internet Society (1999). All Rights Reserved.
okay the legal stuff, but make it cute ๐ You're allowed to copy and share this document, and to translate it, and you can also make derivative works that comment on it, explain it, or help people implement it. You can publish and distribute those in whole or in part with no restrictions, as long as the copyright notice and this paragraph stay on every copy and every derivative work. The one thing you can't do is modify this document itself, like removing the copyright notice or the references to the Internet Society or other Internet organizations. The exception is when you're developing Internet standards, where the Internet Standards process copyright procedures must be followed. You can also translate it into languages other than English ๐
These permissions are perpetual, and the Internet Society or its successors or assigns won't revoke them โจ
This document and the information in it are provided on an "AS IS" basis. THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ๐
๐ฆ where this page comes from
- ietf: rfc2535 1999-03
- ๐ girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms