RFC 6698

The DNS-Based Authentication of Named Entities (DANE) Transport Layer Security (TLS) Protocol: TLSA

๐Ÿ“… published August 2012, from ietf

RFC 6698 ๐Ÿ“œโœจ

okay bestie, this is RFC 6698 ๐Ÿ’– and the title is The DNS-Based Authentication of Named Entities (DANE) Transport Layer Security (TLS) Protocol: TLSA. It's from the IETF ๐ŸŒธ. The authors are P. Hoffman (VPN Consortium) and J. Schlyter (Kirei AB). It's a Standards Track doc ๐Ÿ’…, dated August 2012, with ISSN 2070-1721 ๐ŸŽ€. It doesn't obsolete or update anything, since the title block doesn't list any RFCs there. Iconic clean slate ๐Ÿงš


Abstract โœจ

okay so encrypted communication on the Internet usually runs on Transport Layer Security (TLS) ๐Ÿ”, and TLS leans on third parties to certify the keys it uses ๐Ÿ‘€. This document makes that situation better by letting domain name administrators specify the keys used by their domain's TLS servers ๐Ÿฆ‹. It needs matching upgrades in TLS client software, but no change in TLS server software ๐Ÿ’œ

Status of This Memo ๐ŸŒท

this is an Internet Standards Track document ๐ŸŽ€

it's a product of the Internet Engineering Task Force (IETF) ๐ŸŒธ. It represents the consensus of the IETF community ๐Ÿซถ. It got public review and was approved for publication by the Internet Engineering Steering Group (IESG) โœ…. More info on Internet Standards is in Section 2 of RFC 5741 ๐Ÿ“–

info about the current status of this doc, any errata, and how to give feedback is at http://www.rfc-editor.org/info/rfc6698 ๐Ÿ”—

Copyright (c) 2012 IETF Trust and the persons identified as the document authors. All rights reserved. โญ

this document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) as in effect on the date of publication. Please review these documents carefully ๐Ÿ‘€, because they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions, and they're provided without warranty as described in the Simplified BSD License ๐Ÿงพ

Table of Contents ๐Ÿ—‚๏ธ

   1. Introduction ....................................................3
      1.1. Background and Motivation ..................................3
      1.2. Securing the Association of a Domain Name with a
           Server's Certificate .......................................4
      1.3. Method for Securing Certificate Associations ...............5
      1.4. Terminology ................................................6
   2. The TLSA Resource Record ........................................7
      2.1. TLSA RDATA Wire Format .....................................7
           2.1.1. The Certificate Usage Field .........................7
           2.1.2. The Selector Field ..................................8
           2.1.3. The Matching Type Field .............................9
           2.1.4. The Certificate Association Data Field ..............9
      2.2. TLSA RR Presentation Format ................................9
      2.3. TLSA RR Examples ..........................................10
   3. Domain Names for TLSA Certificate Associations .................10
   4. Use of TLSA Records in TLS .....................................11
      4.1. Usable Certificate Associations ...........................11
   5. TLSA and DANE Use Cases and Requirements .......................13
   6. Mandatory-to-Implement Features ................................15
   7. IANA Considerations ............................................15
      7.1. TLSA RRtype ...............................................15
      7.2. TLSA Certificate Usages ...................................15
      7.3. TLSA Selectors ............................................16
      7.4. TLSA Matching Types .......................................16
   8. Security Considerations ........................................16
      8.1. Comparing DANE to Public CAs ..............................18
           8.1.1. Risk of Key Compromise .............................19
           8.1.2. Impact of Key Compromise ...........................20
           8.1.3. Detection of Key Compromise ........................20
           8.1.4. Spoofing Hostnames .................................20
      8.2. DNS Caching ...............................................21
      8.3. External DNSSEC Validators ................................21
   9. Acknowledgements ...............................................22
   10. References ....................................................22
      10.1. Normative References .....................................22
      10.2. Informative References ...................................23
   Appendix A. Operational Considerations for Deploying TLSA
               Records ...............................................25
     A.1. Creating TLSA Records ......................................25
       A.1.1. Ambiguities and Corner Cases When TLS Clients
              Build Trust Chains .....................................26
       A.1.2. Choosing a Selector Type ...............................26
     A.2. Provisioning TLSA Records in DNS ...........................28
       A.2.1. Provisioning TLSA Records with Aliases .................28
     A.3. Securing the Last Hop ......................................30
     A.4. Handling Certificate Rollover ..............................31

   Appendix B. Pseudocode for Using TLSA .............................32
     B.1. Helper Functions ...........................................32
     B.2. Main TLSA Pseudocode .......................................33
   Appendix C. Examples ..............................................35

1. Introduction ๐ŸŽ€

1.1. Background and Motivation ๐Ÿฆ‹

okay so applications that talk over the Internet often need to stop eavesdropping, tampering, and forgery of their communications ๐Ÿ™ˆ. The Transport Layer Security (TLS) protocol gives you that kind of communications security over the Internet, using channel encryption ๐Ÿ”

the security of encryption systems depends super strongly on the keys they use ๐Ÿ”‘. If secret keys get revealed, or if public keys can be swapped for fake keys (meaning a key that doesn't correspond to the entity named in the certificate) ๐Ÿ˜ฑ, these systems give you little or no security ๐Ÿ’€

TLS uses certificates to bind keys and names ๐Ÿ“œ. A certificate combines a published key with other info, like the name of the service that uses the key, and then another key digitally signs that whole combo โœ๏ธ. Having a key in a certificate only helps if you trust the other key that signed the certificate ๐Ÿค”. If that other key was itself revealed or substituted, its signature is worthless when it comes to proving anything about the first key ๐Ÿ“‰

on the Internet, this problem has been handled for years by entities called "Certification Authorities" (CAs) ๐Ÿ›๏ธ. CAs guard their secret key super carefully, while handing their public key to the software vendors who build TLS clients ๐Ÿค. Then they sign certificates and give those to TLS servers โœจ. TLS client software uses a set of these CA keys as "trust anchors" to validate the signatures on certificates the client gets from TLS servers ๐Ÿ›ก๏ธ. Client software typically lets any CA usefully sign any other certificate ๐Ÿซ 

the public CA model that TLS has depended on is fundamentally vulnerable, because it lets any of these CAs issue a certificate for any domain name ๐Ÿšจ. One trusted CA that betrays that trust, whether on purpose or by doing a less-than-vigorous job protecting its secrets and capabilities, can undermine the security of any certificates used with TLS ๐Ÿ˜ญ. The problem comes up because a compromised CA can issue a replacement certificate that contains a fake key ๐ŸŽญ. Recent compromises of CAs or their trusted partners have caused really serious security problems, like the governments of multiple countries trying to wiretap and/or subvert major TLS-protected websites that millions of users trust ๐Ÿ˜ณ

the DNS Security Extensions (DNSSEC) offer a similar model, where trusted keys sign info for untrusted keys ๐Ÿ”. But DNSSEC has three big improvements ๐Ÿ†. First, keys are tied to names in the Domain Name System (DNS), not to arbitrary identifying strings, which is more convenient for Internet protocols ๐ŸŒ. Second, signed keys for any domain can be reached online with a straightforward query using the standard DNSSEC protocol, so distributing the signed keys isn't a problem ๐Ÿ“ฌ. Most significantly ๐Ÿ’œ, the keys associated with a domain name can only be signed by a key associated with that domain's parent. For example, keys for "example.com" can only be signed by keys for "com", and keys for "com" can only be signed by the DNS root ๐ŸŒณ. This stops an untrustworthy signer from compromising anyone's keys except the ones in their own subdomains ๐Ÿ™Œ. Like TLS, DNSSEC relies on public keys built into the DNSSEC client software, but those keys come only from a single root domain instead of a bunch of CAs ๐Ÿ‘‘

DNS-Based Authentication of Named Entities (DANE) gives you the option to use the DNSSEC infrastructure to store and sign the keys and certificates TLS uses ๐Ÿงš. DANE is envisioned as a better basis for binding public keys to DNS names, because the entities vouching for that binding are the same entities responsible for managing the DNS names in question ๐Ÿ’…. The resulting system still has residual security vulnerabilities ๐Ÿฅ€, but it limits the scope of assertions any entity can make, matching the naming scope set by the DNS hierarchy ๐ŸŒธ. So DANE embodies the security "principle of least privilege" that the current public CA model is missing โœจ๐Ÿซถ

1.2. Securing the Association of a Domain Name with a Server's Certificate โœจ

okay so picture this ๐Ÿงš a TLS client starts a connection by chatting with a TLS server. for a lot of application protocols, it looks up the server's name using the DNS to grab an Internet Protocol (IP) address tied to that name. then it connects to a particular port at that address and sends its first message there. but ngl, the client has no idea yet whether an adversary is intercepting and/or altering its communication before it reaches the TLS server ๐Ÿ‘€. it doesn't even know whether the real TLS server for that domain name has ever received those initial messages ๐Ÿ’€

the first response from the server in TLS may include a certificate ๐Ÿ“œ. so for the client to confirm it's really talking to the expected TLS server, it has to check that this certificate is associated with the domain name the client used to find the server. right now, the client must pull the domain name out of the certificate and must successfully validate the certificate, including chaining to a trust anchor. very thorough, very long ๐Ÿ™„

here's the lowkey genius part ๐Ÿซถ. there's a different way to prove that the server's certificate belongs to the intended domain name without trusting an external CA. the DNS administrator for a domain name is already the one authorized to share identifying information about the zone, so it makes total sense to let that administrator also make an authoritative binding between the domain name and a certificate that a host at that domain might use. the easiest way to do this is to use the DNS and secure the binding with DNSSEC. main character energy ๐Ÿ‘‘

there are lots of use cases for this kind of functionality ๐ŸŒˆ. [RFC6394] lists the ones that the DNS RRtype in this document applies to. [RFC6394] also lists many requirements, and this document is believed to meet most of them. Section 5 covers how this document applies to those use cases in detail. the protocol in this document can generally be referred to as the "DANE TLSA" protocol. ("TLSA" doesn't stand for anything; it's just the name of the RRtype ๐Ÿคทโ€โ™€๏ธ)

this document applies to both TLS [RFC5246] and Datagram TLS (DTLS) [RFC6347]. to keep things readable, it mostly just says "TLS", but in every case it means "TLS or DTLS" ๐Ÿฆ‹. the references in this paragraph are to TLS and DTLS version 1.2, but the DANE TLSA protocol can also be used with earlier versions of TLS and DTLS.

this document only covers securely associating certificates for TLS and DTLS with host names. getting certificates from DNS for other protocols is handled in other documents. for example, keys for IPsec are covered in [RFC4025], and keys for Secure SHell (SSH) are covered in [RFC4255] ๐Ÿ”.

1.3. Method for Securing Certificate Associations ๐Ÿ’…

a certificate association is made from a piece of information that identifies a certificate and the domain name where the server application runs. the combination of a trust anchor and a domain name can also be a certificate association ๐ŸŽ€.

a DNS query can return multiple certificate associations, like when a server is switching from one certificate to another (described in more detail in Appendix A.4) ๐Ÿ”„.

this document only applies to PKIX [RFC5280] certificates, not certificates in other formats ๐Ÿšซ.

this document defines a secure method for associating the certificate obtained from the TLS server with a domain name using DNS. the DNS information needs to be protected by DNSSEC ๐Ÿ›ก๏ธ. because the certificate association was retrieved based on a DNS query, the domain name in the query is, by definition, associated with the certificate โœจ. note that this document doesn't cover how to associate certificates with domain names for application protocols that depend on SRV, NAPTR, and similar DNS resource records. future documents are expected to cover ways of making those associations, and those documents may or may not need to update this one ๐Ÿง.

DNSSEC, which is defined in [RFC4033], [RFC4034], and [RFC4035], uses cryptographic keys and digital signatures to provide authentication of DNS data ๐Ÿ”‘. information retrieved from the DNS and validated using DNSSEC is thereby proved to be authoritative data. the DNSSEC signature needs to be validated on all responses that use DNSSEC, so the proof of origin of the data holds up ๐Ÿ’ฏ.

this document doesn't specify how DNSSEC validation happens, because there are lots of different proposals for how a client might get validated DNSSEC results ๐Ÿ™ƒ. for example, from a DNSSEC-aware resolver coded into the application, from a trusted DNSSEC resolver on the machine the application runs on, or from a trusted DNSSEC resolver the application talks to over an authenticated and integrity-protected channel or network. this is described in more detail in Section 7 of [RFC4033].

this document only relates to getting the DNS information for the certificate association securely using DNSSEC. other secure DNS mechanisms are out of scope ๐Ÿ™…โ€โ™€๏ธ.

1.4. Terminology ๐Ÿ“š

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 RFC 2119 [RFC2119]. ๐Ÿ’–

this document also uses standard PKIX, DNSSEC, TLS, and DNS terminology ๐Ÿง . for those terms, see [RFC5280], [RFC4033], [RFC5246], and STD 13 [RFC1034] [RFC1035], respectively. terms related to TLS-protected application services and DNS names are taken from [RFC6125] ๐ŸŒธ.

2. The TLSA Resource Record ๐ŸŽ€

the TLSA DNS resource record (RR) is used to associate a TLS server certificate or public key with the domain name where the record is found. that forms a "TLSA certificate association" ๐Ÿ’œ. how the TLSA RR is interpreted is explained later in this document.

the type value for the TLSA RR type is defined in Section 7.1 ๐Ÿท๏ธ.

the TLSA RR is class independent ๐Ÿงš.

the TLSA RR has no special Time to Live (TTL) requirements โฑ๏ธ.

2.1. TLSA RDATA Wire Format ๐Ÿ“

the RDATA for a TLSA RR consists of a one-octet certificate usage field, a one-octet selector field, a one-octet matching type field, and the certificate association data 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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |  Cert. Usage  |   Selector    | Matching Type |               /
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+               /
   /                                                               /
   /                 Certificate Association Data                  /
   /                                                               /
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

2.1.1. The Certificate Usage Field ๐ŸŽฏ

the certificate usage field is a one-octet value, called "certificate usage", that specifies the provided association used to match the certificate presented in the TLS handshake ๐Ÿค. this value is defined in a new IANA registry (see Section 7.2) so it's easier to add more certificate usages in the future. the certificate usages defined in this document are:

  • 0 -- Certificate usage 0 is used to specify a CA certificate, or the public key of such a certificate, that MUST be found in any of the PKIX certification paths for the end entity certificate given by the server in TLS. this certificate usage is sometimes called "CA constraint" because it limits which CA can be used to issue certificates for a given service on a host ๐Ÿ”’. the presented certificate MUST pass PKIX certification path validation, and a CA certificate that matches the TLSA record MUST be included as part of a valid certification path. because this certificate usage allows both trust anchors and CA certificates, the certificate might or might not have the basicConstraints extension present ๐Ÿคทโ€โ™€๏ธ.
  • 1 -- Certificate usage 1 is used to specify an end entity certificate, or the public key of such a certificate, that MUST be matched with the end entity certificate given by the server in TLS. this certificate usage is sometimes called "service certificate constraint" because it limits which end entity certificate can be used by a given service on a host ๐ŸŽ€. the target certificate MUST pass PKIX certification path validation and MUST match the TLSA record.
  • 2 -- Certificate usage 2 is used to specify a certificate, or the public key of such a certificate, that MUST be used as the trust anchor when validating the end entity certificate given by the server in TLS. this certificate usage is sometimes called "trust anchor assertion" and lets a domain name administrator specify a new trust anchor ๐Ÿฐ. for example, that's useful if the domain issues its own certificates under its own CA that isn't expected to be in the end users' collection of trust anchors. the target certificate MUST pass PKIX certification path validation, with any certificate matching the TLSA record considered to be a trust anchor for this certification path validation.
  • 3 -- Certificate usage 3 is used to specify a certificate, or the public key of such a certificate, that MUST match the end entity certificate given by the server in TLS. this certificate usage is sometimes called "domain-issued certificate" because it lets a domain name administrator issue certificates for a domain without involving a third-party CA ๐Ÿฅฐ. the target certificate MUST match the TLSA record. the difference between certificate usage 1 and certificate usage 3 is that certificate usage 1 requires the certificate to pass PKIX validation, but PKIX validation is not tested for certificate usage 3 ๐Ÿ‘€.

the certificate usages defined in this document explicitly only apply to PKIX-formatted certificates in DER encoding [X.690]. if TLS allows other formats later, or if extensions to this RRtype are made that accept other formats for certificates, those certificates will need their own certificate usage values ๐Ÿงพ.

2.1.2. The Selector Field ๐Ÿ”

the selector field is a one-octet value, called "selector", that specifies which part of the TLS certificate presented by the server will be matched against the association data. this value is defined in a new IANA registry (see Section 7.3). the selectors defined in this document are:

  • 0 -- Full certificate: the Certificate binary structure as defined in [RFC5280] ๐Ÿ“ฆ
  • 1 -- SubjectPublicKeyInfo: DER-encoded binary structure as defined in [RFC5280] ๐Ÿ—๏ธ

(Note that the use of "selector" in this document is completely unrelated to the use of "selector" in DomainKeys Identified Mail (DKIM) [RFC6376] ๐Ÿ™ˆ.)

2.1.3. The Matching Type Field ๐Ÿง

the matching type field is a one-octet value, called "matching type", that specifies how the certificate association is presented. this value is defined in a new IANA registry (see Section 7.4). the types defined in this document are:

  • 0 -- Exact match on selected content ๐ŸŽฏ
  • 1 -- SHA-256 hash of selected content [RFC6234] ๐Ÿ”
  • 2 -- SHA-512 hash of selected content [RFC6234] ๐Ÿ”

if the TLSA record's matching type is a hash, having the record use the same hash algorithm that was used in the signature in the certificate (if possible) will help clients that support a small number of hash algorithms ๐Ÿซถ.

2.1.4. The Certificate Association Data Field ๐Ÿฆ‹

okay so this field is where the actual data lives ๐Ÿ’– it holds the "certificate association data" that gets matched. โœจ For matching type 0 it's the raw stuff (the full certificate, or its SubjectPublicKeyInfo, depending on your selector). For matching types 1 and 2 it's a hash of that raw stuff instead. ๐Ÿ”ฅ And the data is about the certificate in the association, NOT the TLS ASN.1 Certificate object, so don't mix those up bestie ๐Ÿ™ˆ

2.2. TLSA RR Presentation Format ๐ŸŽ€

so when you write the RDATA portion out as text (the way [RFC1035] describes), here's the vibe:

  • The certificate usage field MUST be written as an 8-bit unsigned integer. ๐Ÿ’…
  • The selector field MUST be written as an 8-bit unsigned integer. ๐Ÿ’…
  • The matching type field MUST be written as an 8-bit unsigned integer. ๐Ÿ’…
  • The certificate association data field MUST be written as a string of hexadecimal characters. Whitespace is allowed inside that hex string, as described in [RFC1035]. ๐Ÿซถ

2.3. TLSA RR Examples ๐ŸŒธ

in these examples the domain name is built using the rules in Section 3, so peek there if you're confused ๐Ÿ‘€

an example of a hashed (SHA-256) association of a PKIX CA certificate:

_443._tcp.www.example.com. IN TLSA (
   0 0 1 d2abde240d7cd3ee6b4b28c54df034b9
         7983a1d16e8a410e4561cb106618e971 )

an example of a hashed (SHA-512) subject public key association of a PKIX end entity certificate:

_443._tcp.www.example.com. IN TLSA (
   1 1 2 92003ba34942dc74152e2f2c408d29ec
         a5a520e7f2e06bb944f4dca346baf63c
         1b177615d466f6c4b71c216a50292bd5
         8c9ebdd2f74e38fe51ffd48c43326cbc )

an example of a full certificate association of a PKIX end entity certificate:

_443._tcp.www.example.com. IN TLSA (
   3 0 0 30820307308201efa003020102020... )

3. Domain Names for TLSA Certificate Associations ๐Ÿงš

okay the naming rules! ๐Ÿ’… unless a protocol-specific spec says otherwise (and then that one wins, periodt), TLSA records get stored at a prefixed DNS domain name. โœจ here's how you build the prefix:

  1. the decimal port number where a TLS-based service is assumed to live gets an underscore ("_") slapped on the front to become the left-most label. no leading zeros, obviously ๐Ÿ™…โ€โ™€๏ธ
  2. the protocol name of the transport that service is assumed to run on gets an underscore ("_") too, and it becomes the second left-most label. the transport names defined for this are "tcp", "udp", and "sctp". ๐ŸŒŠ
  3. then you tack the base domain name onto the end of what you got in step 2 to finish the prepared domain name. the base domain name is the fully qualified DNS domain name [RFC1035] of the TLS server, and every label MUST meet the rules of [RFC0952]. ๐Ÿ”ฅ That means if you're querying an internationalized domain name, it MUST use the A-label form as defined in [RFC5890]. no cap, that part is non-negotiable ๐Ÿ˜ค

for example, to ask for a TLSA record for an HTTP server running TLS on port 443 at "www.example.com", you use _443._tcp.www.example.com. ๐Ÿ’– and for an SMTP server running the STARTTLS protocol on port 25 at "mail.example.com", you use _25._tcp.mail.example.com. ๐Ÿ“ฌ

4. Use of TLSA Records in TLS ๐Ÿ”

Section 2.1 of this document is where the mandatory matching rules live, for the data from the TLSA certificate associations and the certificates the TLS server hands you. ๐Ÿง 

the TLS session you set up MUST be for the exact port number and transport name that you put in the TLSA query. no switching it up mid-glow ๐Ÿ’…

some specs for apps that run over TLS, like [RFC2818] for HTTP, say the server's certificate has to have a domain name matching the host name the client expected. ๐Ÿ‘€ other specs, like [RFC6125], explain how to match the identity in a PKIX certificate against what the user expects. ๐ŸŒˆ

if a TLSA record has certificate usage 2, the matching TLS server SHOULD send the referenced certificate just like it already sends intermediate certificates. โญ

4.1. Usable Certificate Associations ๐Ÿ’œ

an implementation of this protocol makes a DNS query for TLSA records, validates them using DNSSEC, and then uses the resulting TLSA records and their validation status to modify how it responds to the TLS server. ๐Ÿงšโ€โ™€๏ธ

figuring out whether a TLSA RRSet can be used MUST be based on the DNSSEC validation state (as defined in [RFC4033]). this is the core of the whole thing, bestie ๐Ÿ‘‘

  • a TLSA RRSet whose DNSSEC validation state is secure MUST be used as a certificate association for TLS, UNLESS a local policy would prohibit that specific certificate association in the secure TLSA RRSet. โœจ
  • if the DNSSEC validation state on the response to the TLSA RRSet request is bogus, this MUST cause TLS not to be started. or, if the TLS negotiation is already in progress, it MUST cause the connection to be aborted. ๐Ÿ’€
  • a TLSA RRSet whose DNSSEC validation state is indeterminate or insecure cannot be used for TLS and MUST be considered unusable. ๐Ÿ™…โ€โ™€๏ธ

clients that validate the DNSSEC signatures themselves MUST use standard DNSSEC validation procedures. ๐Ÿง clients that rely on some other entity to do the DNSSEC signature validation MUST use a secure mechanism between themselves and that validator. examples of secure transports to other hosts include TSIG [RFC2845], SIG(0) [RFC2931], and IPsec [RFC6071]. ngl, secure transport to a DNS resolver that doesn't do DNSSEC signature validation is NOT enough, so don't get it twisted ๐Ÿ™ˆ see Section 8.3 for more security considerations about external validators. ๐Ÿ”’

if a certificate association contains a certificate usage, selector, or matching type that the TLS client doesn't understand, that certificate association MUST be considered unusable. and if the comparison data for a certificate is malformed, that association MUST also be considered unusable. ๐Ÿ—‘๏ธ

if a certificate association contains a matching type or certificate association data that uses a cryptographic algorithm considered too weak for the TLS client's policy, the certificate association MUST be considered unusable. ๐Ÿฅ€

now the flow: if an application gets zero usable certificate associations from a DNS request or from its cache, it just processes TLS in the normal fashion, no TLSA input needed ๐Ÿซถ if it gets one or more usable ones, it tries to match each certificate association against the TLS server's end entity certificate until it finds a successful match. and during the TLS handshake, if none of the certificate associations match the certificate the TLS server gave, the TLS client MUST abort the handshake. ๐Ÿšซ

okay this part is lowkey the most important vibe check ๐Ÿ˜ญ an attacker who can divert a user to a server they control is also likely able to block DNS requests from that user, or block DNS responses headed back to them. so, to get ANY security benefit from certificate usage 0 or 1, an application that sends a request for TLSA records needs one of two things: either a valid signed response containing TLSA records, or verification that the domain is insecure or indeterminate. ๐Ÿ›ก๏ธ if a TLSA request meets neither of those criteria but the app keeps going with the TLS handshake anyway, the app got zero benefit from TLSA, and it SHOULD NOT make any internal or external indication that TLSA was applied. ๐Ÿค and if an application has a config setting that turned on TLSA use, or has any sign that TLSA is in use (configurable or not), that application either MUST NOT start a TLS connection, or it MUST abort the TLS handshake if both of the two criteria above aren't met. ๐Ÿ’…๐Ÿ’€

the app can do the TLSA lookup before starting the TLS handshake, or do it during the handshake. the choice is up to the client ๐Ÿฆ‹โœจ

5. TLSA and DANE Use Cases and Requirements โœจ

okay so the different types of certificate associations in TLSA line up with bits of [RFC6394], and it's giving full puzzle-piece energy ๐Ÿงฉ the use cases from Section 3 of [RFC6394] are covered in this document like this:

  • 3.1 CA Constraints -- Implemented using certificate usage 0.
  • 3.2 Certificate Constraints -- Implemented using certificate usage 1.
  • 3.3 Trust Anchor Assertion and Domain-Issued Certificates -- Implemented using certificate usages 2 and 3, respectively.

the requirements from Section 4 of [RFC6394] are covered in this document too, and I'm obsessed with how each one gets handled ๐Ÿซถ

  • Multiple Ports -- The TLSA records for different application services running on a single host can be distinguished through the service name and port number prefixed to the host name (see Section 3). ๐Ÿšช
  • No Downgrade -- Section 4 specifies the conditions under which a client can process and act upon TLSA records. Specifically, if the DNSSEC status for the TLSA resource record set is determined to be bogus, the TLS connection (if started) will fail. ๐Ÿ™…โ€โ™€๏ธ
  • Encapsulation -- Encapsulation is covered in the TLSA response semantics. ๐ŸŽ€
  • Predictability -- The appendices of this specification provide operational considerations and implementation guidance in order to enable application developers to form a consistent interpretation of the recommended client behavior. ๐Ÿ”ฎ
  • Opportunistic Security -- If a client conformant to this specification can reliably determine the presence of a TLSA record, it will attempt to use this information. Conversely, if a client can reliably determine the absence of any TLSA record, it will fall back to processing TLS in the normal fashion. This is discussed in Section 4. ๐Ÿฆ‹
  • Combination -- Multiple TLSA records can be published for a given host name, thus enabling the client to construct multiple TLSA certificate associations that reflect different assertions. No support is provided to combine two TLSA certificate associations in a single operation. ๐Ÿงƒ
  • Roll-over -- TLSA records are processed in the normal manner within the scope of the DNS protocol, including the TTL expiration of the records. This ensures that clients will not latch onto assertions made by expired TLSA records, and will be able to transition from using one public key or certificate usage to another. ๐Ÿ”„
  • Simple Key Management -- The SubjectPublicKeyInfo selector in the TLSA record provides a mode that enables a domain holder to only have to maintain a single long-lived public/private key pair without the need to manage certificates. Appendix A outlines the usefulness and the potential downsides to using this mode. ๐Ÿ”‘
  • Minimal Dependencies -- This specification relies on DNSSEC to protect the origin authenticity and integrity of the TLSA resource record set. Additionally, if DNSSEC validation is not performed on the system that wishes to use TLSA certificate bindings, this specification requires that the "last mile" be over a secure transport. There are no other deployment dependencies for this approach. ๐Ÿงผ
  • Minimal Options -- The operating modes map precisely to the DANE use cases and requirements. DNSSEC use is mandatory in that this specification encourages applications to use only those TLSA records that are shown to be validated. ๐Ÿ”’
  • Wildcards -- Wildcards are covered in a limited manner in the TLSA request syntax; see Appendix A. โญ
  • Redirection -- Redirection is covered in the TLSA request syntax; see Appendix A. ๐Ÿงš

6. Mandatory-to-Implement Features ๐Ÿ‘‘

okay this part is the non-negotiables, bestie ๐Ÿ’… TLS clients conforming to this specification MUST be able to correctly interpret TLSA records with certificate usages 0, 1, 2, and 3. TLS clients conforming to this specification MUST be able to compare a certificate association with a certificate from the TLS handshake using selector types 0 and 1, and matching type 0 (no hash used) and matching type 1 (SHA-256), and SHOULD be able to make such comparisons with matching type 2 (SHA-512). no cap, this is the core checklist ๐Ÿ“โœจ


7. IANA Considerations ๐ŸŒธ

IANA has made the assignments in this section. ๐Ÿ—‚๏ธ

in the following sections, "RFC Required" was chosen for TLSA certificate usages and "Specification Required" for selectors and matching types, and the reason is so iconic: new certificate usages need way more detail for implementers to get them right, compared to new selectors and matching types ๐Ÿง 

7.1. TLSA RRtype

this document uses a new DNS RR type, TLSA, whose value (52) was allocated by IANA from the Resource Record (RR) TYPEs subregistry of the Domain Name System (DNS) Parameters registry. ๐Ÿ†•

7.2. TLSA Certificate Usages

this document creates a new registry, "TLSA Certificate Usages". The registry policy is "RFC Required". The initial entries in the registry are:

Value    Short description                       Reference
----------------------------------------------------------
0        CA constraint                           RFC 6698
1        Service certificate constraint          RFC 6698
2        Trust anchor assertion                  RFC 6698
3        Domain-issued certificate               RFC 6698
4-254    Unassigned
255      Private use

applications to the registry can request specific values that have yet to be assigned. ๐Ÿ™‹โ€โ™€๏ธ

7.3. TLSA Selectors

this document creates a new registry, "TLSA Selectors". The registry policy is "Specification Required". The initial entries in the registry are:

Value    Short description                       Reference
----------------------------------------------------------
0        Full certificate                        RFC 6698
1        SubjectPublicKeyInfo                    RFC 6698
2-254    Unassigned
255      Private use

applications to the registry can request specific values that have yet to be assigned. ๐Ÿงฉ

7.4. TLSA Matching Types

this document creates a new registry, "TLSA Matching Types". The registry policy is "Specification Required". The initial entries in the registry are:

Value    Short description                       Reference
----------------------------------------------------------
0        No hash used                            RFC 6698
1        SHA-256                                 RFC 6234
2        SHA-512                                 RFC 6234
3-254    Unassigned
255      Private use

applications to the registry can request specific values that have yet to be assigned. ๐Ÿ’–


8. Security Considerations ๐Ÿ™ˆ

okay bestie, this is the serious section, so I'm putting on my dramatic face ๐Ÿ˜ญ but it's still a total must-read โš ๏ธ

the security of the DNS RRtype described in this document relies on the security of DNSSEC to verify that the TLSA record has not been altered. ๐Ÿ”

a rogue DNS administrator who changes the A, AAAA, and/or TLSA records for a domain name can cause the client to go to an unauthorized server that will appear authorized, unless the client performs PKIX certification path validation and rejects the certificate. that administrator could probably get a certificate issued by some CA anyway, so this is not an additional threat. ๐Ÿ’€

if the authentication mechanism for adding or changing TLSA data in a zone is weaker than the authentication mechanism for changing the A and/or AAAA records, a man-in-the-middle who can redirect traffic to his site may be able to impersonate the attacked host in TLS if he can use the weaker authentication mechanism. a better design for authenticating DNS would be to have the same level of authentication used for all DNS additions and changes for a particular domain name. ๐Ÿ”

Secure Socket Layer (SSL) proxies can sometimes act as a man-in-the-middle for TLS clients. in these scenarios, the clients add a new trust anchor whose private key is kept on the SSL proxy; the proxy intercepts TLS requests, creates a new TLS session with the intended host, and sets up a TLS session with the client using a certificate that chains to the trust anchor installed in the client by the proxy. in such environments, using TLSA records will prevent the SSL proxy from functioning as expected because the TLS client will get a certificate association from the DNS that will not match the certificate that the SSL proxy uses with the client. the client, seeing the proxy's new certificate for the supposed destination, will not set up a TLS session. ๐Ÿšซ๐Ÿ•ต๏ธโ€โ™€๏ธ

client treatment of any information included in the trust anchor is a matter of local policy. this specification does not mandate that such information be inspected or validated by the server's domain name administrator. ๐Ÿ“‹

if a server's certificate is revoked, or if an intermediate CA in a chain between the server and a trust anchor has its certificate revoked, a TLSA record with a certificate usage of 2 that matches the revoked certificate would in essence override the revocation because the client would treat that revoked certificate as a trust anchor and thus not check its revocation status. because of this, domain administrators need to be responsible for being sure that the keys or certificates used in TLSA records with a certificate usage of 2 are in fact able to be used as reliable trust anchors. ๐Ÿงฏ

certificates that are delivered in TLSA with certificate usage 2 fundamentally change the way the TLS server's end entity certificate is evaluated. for example, the server's certificate might chain to an existing CA through an intermediate CA that has certain policy restrictions, and the certificate would not pass those restrictions and thus normally be rejected. that intermediate CA could issue itself a new certificate without the policy restrictions and tell its customers to use that certificate with certificate usage 2. this in essence allows an intermediate CA to become a trust anchor for certificates that the end user might have expected to chain to an existing trust anchor. ๐Ÿ˜ฑ

if an administrator wishes to stop using a TLSA record, the administrator can simply remove it from the DNS. normal clients will stop using the TLSA record after the TTL has expired. replay attacks against the TLSA record are not possible after the expiration date on the RRsig of the TLSA record that was removed. ๐Ÿ—‘๏ธ

generators of TLSA records should be aware that the client's full trust of a certificate association retrieved from a TLSA record may be a matter of local policy. while such trust is limited to the specific domain name, protocol, and port for which the TLSA query was made, local policy may decline to accept the certificate (for reasons such as weak cryptography), as is also the case with PKIX trust anchors. ๐Ÿ”๐Ÿ’œ

8.1. Comparing DANE to Public CAs ๐Ÿ”

okay so bestie, remember how we said above that this RRtype's security depends on DNSSEC making sure the TLSA record hasn't been altered? ๐Ÿ’… This section compares that to how public CAs work, and shows where they're alike and where they're totally not. It applies just as much to other security-related DNS RRtypes like keys for IPsec and SSH ๐Ÿ”

So DNSSEC makes certificates (basically the link between an identity and a key) by pairing a DNSKEY, DS, or DLV resource record with an RRSIG record โœจ Those records form a signing chain that runs from the client's trust anchors all the way down to the RR you care about. It's giving chain of trust ๐Ÿ”—

Even though the DNSSEC protocol doesn't enforce it, DNSKEYs are often marked with a SEP flag, which tells you whether the key is a Zone Signing Key (ZSK) or a Key Signing Key (KSK) ๐Ÿ—๏ธ ZSKs protect records in the zone (including DS and DLV records), and KSKs protect the ZSK DNSKEY records. That means the KSK can be stored offline, which is so smart ๐Ÿ™Œ

The TLSA RRtype lets keys from the DNSSEC PKI hierarchy authenticate keys wrapped in PKIX certificates for one particular host name, protocol, and port ๐ŸŽ€

With the exception of the DLV RRtype, all of these certificates limit the keys they identify to names inside the zone that signs the certificate ๐Ÿšง For a domain's DLV resource records to be honored, the domain must be configured as a DLV domain, and the domain's DNSKEYs must be configured as trust anchors or be authentic [RFC5074].

8.1.1. Risk of Key Compromise ๐Ÿ•ต๏ธ

The risk that a given certificate with a valid signing chain is fake depends on how many keys can help validate it, how well each private key is protected, how valuable each key is to an attacker, and how much an attacker gains from faking the certificate ๐Ÿ˜ˆ

DNSSEC lets any set of domains be configured as trust anchors and/or DLVs, but most clients will probably use just the root zone as their only trust anchor ๐ŸŒณ Also, because a given DNSKEY can only sign resource records for its own zone, the number of private keys able to compromise a given TLSA resource record is limited to the number of zones between that TLSA record and the nearest trust anchor, plus any configured DLV domains. Typically that's six keys, half of which are KSKs ๐Ÿ”‘

PKIX only explains how to validate a certificate against a client-chosen set of trust anchors. It says nothing about how many trust anchors to use or how they should be constrained ๐Ÿคทโ€โ™€๏ธ As deployed right now, most PKIX clients use a huge pile of trust anchors shipped with the client or OS software. Those anchors are picked carefully, but with broad interoperability in mind. And the trust anchors and CA certificates for public CAs rarely have name constraints applied ๐Ÿ˜ฌ

A mix of technical protections, process controls, and personnel experience contributes to the quality of security that keys receive ๐Ÿ›ก๏ธ

  • The security around DNSSEC DNSKEYs varies a lot ๐Ÿ“‰ The KSK/ZSK split lets the KSK be stored offline and protected more carefully than the ZSK, but not every domain does that. The security applied to a zone's DNSKEYs should be proportional to the value of the domain, but that's hard to estimate. For example, the root DNSKEY has protections and controls comparable to or exceeding those of public CAs. On the other end of the spectrum, small domains might give their keys no more protection than they give their other data ๐Ÿฅฒ
  • The security around public CAs varies too. Still, thanks to financial incentives and the standards clients impose for acceptance into their trust anchor stores, CAs generally employ security experts and protect their keys carefully, though highly public compromises have happened ๐Ÿ’€

8.1.2. Impact of Key Compromise ๐Ÿ’ฅ

The impact of a key compromise differs significantly between the two models โœจ

  • DNSKEYs are inherently limited in what they can sign, so a compromise of the DNSKEY for "example.com" provides no avenue of attack against "example.org" ๐Ÿ™… Even the impact of a compromise of .com's DNSKEY, while considerable, would be limited to .com domains. Only the compromise of the root DNSKEY would have the equivalent impact of an unconstrained public CA ๐ŸŒ
  • Public CAs are not typically constrained in what names they can sign, so a compromise of even one CA allows the attacker to generate a certificate for any name in the DNS ๐Ÿ˜ฑ A domain holder can get a certificate from any willing CA, or even multiple CAs simultaneously, which makes it impossible for a client to determine whether the certificate it's validating is legitimate or fraudulent ๐Ÿซ 

Because a TLSA certificate association is constrained to its associated name, protocol, and port, the PKIX certificate is similarly constrained, even if its public CAs signing the certificate (if any) are not ๐ŸŽ€

8.1.3. Detection of Key Compromise ๐Ÿ‘€

If a key is compromised, rapid and reliable detection is important in order to limit the impact ๐Ÿšจ Sadly, neither model prevents an attacker from near-invisibly attacking their victim, provided the necessary keys are compromised ๐Ÿซฃ

If a public CA is compromised, only the victim will see the fraudulent certificate, since there's typically no publicly accessible directory of all the certificates a CA has issued that can be inspected ๐Ÿ™ˆ DNS resource records are typically published publicly. BUT the attacker could also let the uncompromised records be published to the Internet as usual, while handing the victim a compromised DNS view to get the same effect ๐Ÿ˜ˆ

8.1.4. Spoofing Hostnames ๐ŸŽญ

Some CAs implement technical controls to make sure certificates aren't issued to domains with names similar to popular, attack-prone domains ๐Ÿšซ Of course, an attacker can try to circumvent that by finding a CA willing to issue the certificate anyway. However, by using DNSSEC and TLSA, the attacker can circumvent this check completely ๐Ÿ˜ค

8.2. DNS Caching ๐Ÿ—„๏ธ

Implementations of this protocol rely heavily on the DNS, and are thus prone to security attacks based on the deliberate mis-association of TLSA records and DNS names ๐Ÿ™€ Implementations need to be cautious about assuming the continuing validity of an association between a TLSA record and a DNS name.

In particular, implementations SHOULD rely on their DNS resolver for confirmation of an association between a TLSA record and a DNS name, rather than caching the result of previous domain name lookups ๐Ÿ’… Many platforms can already cache domain name lookups locally when appropriate, and they SHOULD be configured to do so. It's only proper for these lookups to be cached, though, when the TTL (Time To Live) information reported by the DNS makes it likely that the cached information will remain useful โฐ

If implementations cache the results of domain name lookups to get a performance improvement, they MUST observe the TTL information reported by DNS. Implementations that fail to follow this rule could be spoofed or have access denied when a previously accessed server's TLSA record changes, such as during a certificate rollover ๐Ÿซฃ

8.3. External DNSSEC Validators ๐Ÿง

Due to a lack of DNSSEC support in the most commonly deployed stub resolvers today, some ISPs have begun checking DNSSEC in the recursive resolvers they provide to their customers, setting the Authentic Data (AD) flag as appropriate ๐Ÿ›ฐ๏ธ DNSSEC-aware clients could use that data, ignoring the fact that the DNSSEC data has been validated externally. Because there is typically no authentication of the recursive resolver or integrity protection of the data and AD flag between the client and the recursive resolver, this can be trivially spoofed by an attacker ๐Ÿ˜ฑ

However, even with secure communications between a host and the external validating resolver, there's a risk that the external validator could become compromised ๐ŸงŸ Nothing prevents a compromised external DNSSEC validator from claiming that all the records it provides are secure, even if the data is falsified, unless the client checks the DNSSEC data itself (which makes the external validator unnecessary) ๐Ÿ™ƒ

For this reason, DNSSEC validation is best performed on-host, even when a secure path to an external validator is available ๐Ÿ โœจ

9. Acknowledgements ๐Ÿ™

Many of the ideas in this document have been discussed over many years. More recently, the ideas have been discussed by the authors and others in a more focused fashion ๐Ÿ—ฃ๏ธ In particular, some of the ideas and words here originated with Paul Vixie, Dan Kaminsky, Jeff Hodges, Phillip Hallam-Baker, Simon Josefsson, Warren Kumari, Adam Langley, Ben Laurie, Ilari Liusvaara, Ondrej Mikle, Scott Schmit, Ondrej Sury, Richard Barnes, Jim Schaad, Stephen Farrell, Suresh Krishnaswamy, Peter Palfrader, Pieter Lexis, Wouter Wijngaards, John Gilmore, and Murray Kucherawy ๐ŸŒธ

This document has also been greatly helped by many active participants of the DANE Working Group ๐Ÿซถ

10. References ๐Ÿ“š

10.1. Normative References ๐Ÿ“–

  • [RFC1034] Mockapetris, P., "Domain names - concepts and facilities", STD 13, RFC 1034, November 1987.
  • [RFC1035] Mockapetris, P., "Domain names - implementation and specification", STD 13, RFC 1035, November 1987.
  • [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.
  • [RFC4033] Arends, R., Austein, R., Larson, M., Massey, D., and S. Rose, "DNS Security Introduction and Requirements", RFC 4033, March 2005.
  • [RFC4034] Arends, R., Austein, R., Larson, M., Massey, D., and S. Rose, "Resource Records for the DNS Security Extensions", RFC 4034, March 2005.
  • [RFC4035] Arends, R., Austein, R., Larson, M., Massey, D., and S. Rose, "Protocol Modifications for the DNS Security Extensions", RFC 4035, March 2005.
  • [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security (TLS) Protocol Version 1.2", RFC 5246, August 2008.
  • [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., Housley, R., and W. Polk, "Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile", RFC 5280, May 2008.
  • [RFC6125] Saint-Andre, P. and J. Hodges, "Representation and Verification of Domain-Based Application Service Identity within Internet Public Key Infrastructure Using X.509 (PKIX) Certificates in the Context of Transport Layer Security (TLS)", RFC 6125, March 2011.
  • [RFC6347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer Security Version 1.2", RFC 6347, January 2012.

10.2. Informative References ๐Ÿ“šโœจ

Okay bestie, here's the extra reading that backs everything up ๐Ÿค“

  • [RFC0952] Harrenstien, K., Stahl, M., and E. Feinler, "DoD Internet host table specification", RFC 952, October 1985.
  • [RFC2782] Gulbrandsen, A., Vixie, P., and L. Esibov, "A DNS RR for specifying the location of services (DNS SRV)", RFC 2782, February 2000.
  • [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000.
  • [RFC2845] Vixie, P., Gudmundsson, O., Eastlake 3rd, D., and B. Wellington, "Secret Key Transaction Authentication for DNS (TSIG)", RFC 2845, May 2000.
  • [RFC2931] Eastlake 3rd, D., "DNS Request and Transaction Signatures ( SIG(0)s)", RFC 2931, September 2000.
  • [RFC4025] Richardson, M., "A Method for Storing IPsec Keying Material in DNS", RFC 4025, March 2005.
  • [RFC4255] Schlyter, J. and W. Griffin, "Using DNS to Securely Publish Secure Shell (SSH) Key Fingerprints", RFC 4255, January 2006.
  • [RFC4641] Kolkman, O. and R. Gieben, "DNSSEC Operational Practices", RFC 4641, September 2006.
  • [RFC5074] Weiler, S., "DNSSEC Lookaside Validation (DLV)", RFC 5074, November 2007.
  • [RFC5890] Klensin, J., "Internationalized Domain Names for Applications (IDNA): Definitions and Document Framework", RFC 5890, August 2010.
  • [RFC6066] Eastlake 3rd, D., "Transport Layer Security (TLS) Extensions: Extension Definitions", RFC 6066, January 2011.
  • [RFC6071] Frankel, S. and S. Krishnan, "IP Security (IPsec) and Internet Key Exchange (IKE) Document Roadmap", RFC 6071, February 2011.
  • [RFC6234] Eastlake 3rd, D. and T. Hansen, "US Secure Hash Algorithms (SHA and SHA-based HMAC and HKDF)", RFC 6234, May 2011.
  • [RFC6376] Crocker, D., Ed., Hansen, T., Ed., and M. Kucherawy, Ed., "DomainKeys Identified Mail (DKIM) Signatures", RFC 6376, September 2011.
  • [RFC6394] Barnes, R., "Use Cases and Requirements for DNS-Based Authentication of Named Entities (DANE)", RFC 6394, October 2011.
  • [X.690] "Recommendation ITU-T X.690 (2002) | ISO/IEC 8825-1:2002, Information technology - ASN.1 encoding rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER)", July 2002.

Appendix A. Operational Considerations for Deploying TLSA Records ๐Ÿ› ๏ธ๐Ÿ’…

A.1. Creating TLSA Records

Making TLSA records is kinda high stakes, so you have to be careful not to misconfigure them ๐Ÿ˜ฌ. Section 4 of this document says a TLSA RRSet whose validation state is secure MUST be used. That means the existence of one of these RRSets effectively turns off other forms of name and path validation ๐Ÿ™ˆ. If the TLSA RRSet is misconfigured, conforming clients basically can't reach the TLS server at all, and this document doesn't give you any way to roll out TLSA gradually. Yikes ๐Ÿ’€

When you're making TLSA records with certificate usage 0 (CA certificate) or usage 2 (trust anchor), you need to think about what happens when you pick selector type 0 (Full certificate) versus 1 (SubjectPublicKeyInfo). It's a real choice because different TLS clients build trust chains in different ways ๐Ÿงฉ. The stuff below covers the cases you should know about and what your selector choice means for each one.

Certificate usage 2 isn't affected by the different chain-building methods when the end entity certificate is the same as the trust anchor certificate. Nice and simple ๐ŸŒธ

A.1.1. Ambiguities and Corner Cases When TLS Clients Build Trust Chains ๐ŸŒ€

TLS clients can build their own chains instead of just trusting whatever chain the TLS server sends them. So, apart from the end entity certificate, any certificate in the suggested chain might or might not show up in the final chain the client builds ๐Ÿ‘€

Certificates a client can swap in for ones from the original chain include:

  • Client's trust anchors
  • Certificates cached locally
  • Certificates retrieved from a URI listed in an Authority Information Access X.509v3 extension

CAs reissue certificates pretty often ๐Ÿ”. The new versions can have different validity periods, different signature algorithms (like a different hash algorithm in the signature algorithm), different CA key pairs (like for a cross-certificate), or different PKIX extensions, while the public key and subject stay the same. These reissued certificates are the ones a TLS client can use in place of an original certificate โœจ

Clients are known to swap or drop certificates in ways that can make TLSA certificate associations that depend on the full certificate fail ๐Ÿ˜ญ. For example:

  • The client considers the signature algorithm of a certificate to no longer be sufficiently secure.
  • The client might not have an associated root certificate in its trust store and instead uses a cross-certificate with an identical subject and public key.

A.1.2. Choosing a Selector Type ๐ŸŽ€

In this section, "false-negative failure" means that a client will not accept the TLSA certificate association for a certificate designated by the DNS administrator. And "false-positive acceptance" means that the client accepts a TLSA association for a certificate that is not designated by the DNS administrator. Keep these two terms in your back pocket ๐Ÿซถ

A.1.2.1. Selector Type 0 (Full Certificate)

The "Full certificate" selector gives the most precise description of a TLSA certificate association, since it captures all fields of the PKIX certificate ๐Ÿ’œ. To avoid false-negative failures in the client with this selector, a DNS administrator should do the following:

  1. If a CA issued a replacement certificate, don't associate to CA certificates that have a signature algorithm with a hash that is considered weak by local policy.
  2. Figure out how common client applications process the TLSA certificate association using a fresh client installation. In other words, start with the local certificate cache empty ๐Ÿงน

A.1.2.2. Selector Type 1 (SubjectPublicKeyInfo)

A SubjectPublicKeyInfo selector gives you more flexibility for dodging some false-negative failures caused by the trust-chain-building algorithms in clients ๐Ÿฆ‹

One specific use case is worth noting: making a TLSA certificate association to CA certificate I1 that directly signed end entity certificate S1 of the server. Here's how it looks:

        +----+                      +----+
        | I1 |                      | I2 |
        +----+                      +----+
           |                           |
           v                           v
        +----+                      +----+
        | S1 |                      | S1 |
        +----+                      +----+
Certificate chain sent by    A different validation path
server in TLS handshake      built by the TLS client

I2 is a reissued version of CA certificate I1 (that is, it has a different hash in its signature algorithm).

In the scenario above, both certificates I1 and I2 that sign S1 need to have identical SubjectPublicKeyInfo fields, because the key used to sign S1 is fixed ๐Ÿ”‘. An association to SubjectPublicKeyInfo (selector type 1) will always succeed in this case, but an association with a full certificate (selector type 0) might not work because of a false-negative failure ๐Ÿ’”

The attack surface is a bit broader than with the "Full certificate" selector, though. The DNS administrator might accidentally specify an association that leads to false-positive acceptance ๐Ÿ˜ฌ

  • The administrator must know or trust that the CA doesn't engage in bad practices, such as not sharing the key of I1 for unrelated CA certificates (which would lead to trust-chain redirection). If possible, the administrator ought to review all CA certificates that have the same SubjectPublicKeyInfo field.
  • The administrator ought to understand whether some PKIX extension may adversely affect the security of the association. If possible, administrators ought to review all CA certificates that share the SubjectPublicKeyInfo.
  • The administrator ought to understand that any CA could, in the future, issue a certificate that contains the same SubjectPublicKeyInfo. So new chains can pop up in the future without any warning ๐Ÿšจ

Using the SubjectPublicKeyInfo selector for an association with a certificate in a chain above I1 needs to be decided case by case, because there are way too many possibilities based on the issuing CA's practices ๐ŸŒˆ. Unless the administrator fully understands the implications of that association, selector type 0 is the better option from a security perspective ๐Ÿ›ก๏ธ

A.2. Provisioning TLSA Records in DNS ๐ŸŒ

A.2.1. Provisioning TLSA Records with Aliases ๐Ÿช„

The TLSA resource record isn't special in the DNS. It acts exactly like any other RRtype where the queried name has one or more labels prefixed to the base name, such as the SRV RRtype [RFC2782]. That affects how the TLSA resource record gets used when aliasing in the DNS ๐ŸŽ€

Heads up: the IETF sometimes adds new types of aliasing in the DNS. If that happens in the future, those aliases might affect TLSA records, hopefully in a good way ๐Ÿคž

A.2.1.1. Provisioning TLSA Records with CNAME Records

okay so CNAME only aliases the exact name you give it, NOT anything below it ๐Ÿ™…โ€โ™€๏ธ like, if the zone only has this:

sub1.example.com.          IN CNAME sub2.example.com.

then asking for the A record at "bottom.sub1.example.com" gives you absolutely nothing ๐Ÿ’€ because that CNAME only covers sub1 itself. but if the zone has this instead:

sub3.example.com.          IN CNAME sub4.example.com.
bottom.sub3.example.com.   IN CNAME bottom.sub4.example.com.

then asking for the A record at bottom.sub3.example.com actually returns whatever A record lives at bottom.sub4.example.com ๐Ÿฆ‹ the chain just works!!

apps and full-service resolvers ask for DNS records through libraries that automatically follow CNAME (and DNAME) aliasing โœจ which means hosts can keep TLSA records in their own zones, or use CNAME to redirect. it's giving flexibility ๐Ÿ’…

if the owner of the original domain wants a TLSA record for that name, they just put it under the defined prefix ๐ŸŽ€

; No TLSA record in target domain
;
sub5.example.com.            IN CNAME sub6.example.com.
_443._tcp.sub5.example.com.  IN TLSA 1 1 1 308202c5308201ab...
sub6.example.com.            IN A 192.0.2.1
sub6.example.com.            IN AAAA 2001:db8::1

and if the owner wants the TARGET domain to host the TLSA record instead, the original domain uses a CNAME record ๐Ÿงš

; TLSA record for original domain has CNAME to target domain
;
sub5.example.com.            IN CNAME sub6.example.com.
_443._tcp.sub5.example.com.  IN CNAME _443._tcp.sub6.example.com.
sub6.example.com.            IN A 192.0.2.1
sub6.example.com.            IN AAAA 2001:db8::1
_443._tcp.sub6.example.com.  IN TLSA 1 1 1 536a570ac49d9ba4...

now here's the tea โ˜•: it's totally fine for BOTH the original and the target domain to have TLSA records, but those two records are unrelated ๐Ÿ™ˆ like, check this:

; TLSA record in both the original and target domain
;
sub5.example.com.            IN CNAME sub6.example.com.
_443._tcp.sub5.example.com.  IN TLSA 1 1 1 308202c5308201ab...
sub6.example.com.            IN A 192.0.2.1
sub6.example.com.            IN AAAA 2001:db8::1
_443._tcp.sub6.example.com.  IN TLSA 1 1 1 ac49d9ba4570ac49...

so in this setup, anyone looking up the TLSA record for sub5.example.com will ALWAYS get the one starting with "308202c5308201ab" ๐Ÿ’– the one starting with "ac49d9ba4570ac49" is only found by someone looking up sub6.example.com, and never by someone looking up sub5.example.com. separate lanes, bestie ๐Ÿ›ฃ๏ธ also, if multiple services share one TLS listener and each needs its own certificate, you usually need TLS SNI (Server Name Indication) [RFC6066] to make that work ๐ŸŒˆ

last thing: these methods use the normal DNS aliasing via CNAME, which means the DNS client asks for the record type it actually wants ๐Ÿซถ

A.2.1.2. Provisioning TLSA Records with DNAME Records

DNAME is the big-brain move ๐Ÿง โœจ it lets a zone owner alias an ENTIRE subtree of names below the name that has the DNAME. so you can wholesale-alias prefixed records like TLSA, SRV, and friends WITHOUT aliasing the name itself ๐Ÿ‘‘ the catch? DNAME only works on subtrees of a base name, so it's rarely used to alias individual hosts that might also be running TLS ๐Ÿ˜ญ

; TLSA record in target domain, visible in original domain via DNAME
;
sub5.example.com.            IN CNAME sub6.example.com.
_tcp.sub5.example.com.       IN DNAME _tcp.sub6.example.com.
sub6.example.com.            IN A 192.0.2.1
sub6.example.com.            IN AAAA 2001:db8::1
_443._tcp.sub6.example.com.  IN TLSA 1 1 1 536a570ac49d9ba4...

A.2.1.3. Provisioning TLSA Records with Wildcards

wildcards are generally not terribly useful for RRtypes that need a prefix ๐Ÿฅฒ because you can only wildcard at a layer BELOW the host name. say you want the SAME TLSA record for every TCP port on www.example.com, it might look like this:

*._tcp.www.example.com.    IN TLSA 1 1 1 5c1502a6549c423b...

this is possibly handy when the same service runs on lots of ports, or when the same certificate and/or key covers every service on a host ๐ŸŽ€ just note that the domain being searched for is not necessarily related to the domain name in the certificate, so a certificate with a wildcard in it is NOT searched for using a wildcard in the request ๐Ÿ™…โ€โ™€๏ธ (wildcards in certs and wildcards in queries are different vibes, periodt ๐Ÿ’…)

A.3. Securing the Last Hop

as we covered in Section 4, an app processing TLSA records has to know the DNSSEC validity of those records ๐Ÿ” there are lots of ways to figure that out securely, and this spec doesn't mandate any single method. choose your fighter ๐ŸฅŠ

some common methods for an app to learn the DNSSEC validity of TLSA records:

  • The application can have its own DNS resolver and DNSSEC validation stack.
  • The application can communicate through a trusted channel (such as requests to the operating system under which the application is running) to a local DNS resolver that does DNSSEC validation.
  • The application can communicate through a secured channel (such as requests running over TLS, IPsec, TSIG, or SIG(0)) to a non-local DNS resolver that does DNSSEC validation.
  • The application can communicate through a secured channel (such as requests running over TLS, IPsec, TSIG, or SIG(0)) to a non-local DNS resolver that does not do DNSSEC validation, but gets responses through a secured channel from a different DNS resolver that does DNSSEC validation.

A.4. Handling Certificate Rollover

certificate rollover is handled in pretty much the same way as rolling DNSSEC zone signing keys using the pre-publish key rollover method [RFC4641] ๐Ÿ”„ say example.com has a single TLSA record for a TLS service on TCP port 990:

_990._tcp.example.com IN TLSA 1 1 1 1CFC98A706BCF3683015...

to kick off the rollover, get or generate the new certificate (or SubjectPublicKeyInfo) you'll use after the switch, and make the new TLSA record. then add it ALONGSIDE the old one ๐Ÿซถ

_990._tcp.example.com IN TLSA 1 1 1 1CFC98A706BCF3683015...
_990._tcp.example.com IN TLSA 1 1 1 62D5414CD1CC657E3D30...

once the new records have propagated to the authoritative nameservers AND the TTL of the old record has expired, switch to the new certificate on the TLS server ๐ŸŒธ only AFTER that happens can the old TLSA record be removed:

_990._tcp.example.com IN TLSA 1 1 1 62D5414CD1CC657E3D30...

and that's it, the certificate rollover is complete ๐ŸŽ‰๐Ÿ‘‘

Appendix B. Pseudocode for Using TLSA โœจ

okay this appendix is the pseudocode version of the interactions we went over earlier in the spec ๐Ÿงš if the steps below disagree with the text earlier in the doc, the earlier text ought to be considered correct and this one incorrect ๐Ÿ™…โ€โ™€๏ธ

also, heads up: this pseudocode is stricter than the normative text. for instance, it forces an order on evaluating the criteria, which isn't mandatory from the normative text ๐Ÿค“

B.1. Helper Functions

helper functions time ๐Ÿ› ๏ธ

// implement the function for exiting
function Finish (F) = {
  if (F == ABORT_TLS) {
    abort the TLS handshake or prevent TLS from starting
    exit
  }

  if (F == NO_TLSA) {
    fall back to non-TLSA certificate validation
    exit
  }

  if (F == ACCEPT) {
    accept the TLS connection
    exit
  }

  // unreachable
}

// implement the selector function
function Select (S, X) = {
  // Full certificate
  if (S == 0) {
    return X in DER encoding
  }

  // SubjectPublicKeyInfo
  if (S == 1) {
    return X.SubjectPublicKeyInfo in DER encoding
  }

  // unreachable
}
// implement the matching function
function Match (M, X, Y) {
  // Exact match on selected content
  if (M == 0) {
    return (X == Y)
  }

  // SHA-256 hash of selected content
  if (M == 1) {
    return (SHA-256(X) == Y)
  }

  // SHA-512 hash of selected content
  if (M == 2) {
    return (SHA-512(X) == Y)
  }

  // unreachable
}

B.2. Main TLSA Pseudocode

this is the main event ๐Ÿ’… it's the whole flow for connecting with TLS and checking the TLSA records:

TLS connect using [transport] to [name] on [port] and receiving end
entity cert C for the TLS server:

(TLSArecords, ValState) = DNSSECValidatedLookup(
  domainname=_[port]._[transport].[name], RRtype=TLSA)

// check for states that would change processing
if (ValState == BOGUS) {
  Finish(ABORT_TLS)
}
if ((ValState == INDETERMINATE) or (ValState == INSECURE)) {
  Finish(NO_TLSA)
}
// if here, ValState must be SECURE

for each R in TLSArecords {
  // unusable records include unknown certUsage, unknown
  // selectorType, unknown matchingType, erroneous RDATA, and
  // prohibited by local policy
  if (R is unusable) {
    remove R from TLSArecords
  }
}
if (length(TLSArecords) == 0) {
  Finish(NO_TLSA)
}
// A TLS client might have multiple trust anchors that it might use
//    when validating the TLS server's end entity (EE) certificate.
//    Also, there can be multiple PKIX certification paths for the
//    certificates given by the server in TLS.  Thus, there are
//    possibly many chains that might need to be tested during
//    PKIX path validation.

for each R in TLSArecords {

  // pass PKIX certificate validation and chain through a CA cert
  //    that comes from TLSA
  if (R.certUsage == 0) {
    for each PKIX certification path H {
      if (C passes PKIX certification path validation in H) {
        for each D in H {
          if ((D is a CA certificate) and
              Match(R.matchingType, Select(R.selectorType, D),
                    R.cert)) {
            Finish(ACCEPT)
          }
        }
      }
    }
  }

  // pass PKIX certificate validation and match EE cert from TLSA
  if (R.certUsage == 1) {
    for each PKIX certification path H {
      if ((C passes PKIX certificate validation in H) and
              Match(R.matchingType, Select(R.selectorType, C),
              R.cert)) {
          Finish(ACCEPT)
      }
    }
  }

  // pass PKIX certification validation using TLSA record as the
  //    trust anchor
  if (R.certUsage == 2) {
    // the following assert() is merely a formalization of the
    // "trust anchor" condition for a certificate D matching R
    assert(Match(R.matchingType, Select(R.selectorType, D), R.cert))
    for each PKIX certification path H that has certificate D
        matching R as the trust anchor {
      if (C passes PKIX validation in H) {
        Finish(ACCEPT);
      }
    }
  }

  // match the TLSA record and the TLS certificate
  if (R.certUsage == 3) {
    if Match(R.matchingType, Select(R.selectorType, C), R.cert)
      Finish(ACCEPT)
    }
  }

}

// if here, then none of the TLSA records ended in "Finish(ACCEPT)"
//   so abort TLS
Finish(ABORT_TLS)

Appendix C. Examples โœจ

okay so this is the fun part ๐ŸŽ€ we get to see real examples of self-signed certificates that were generated with different selectors and matching types ๐Ÿฆ‹ one piece of software made them all, and then a different person checked them with other tools ๐Ÿ’…

quick decoder ring ๐Ÿ’œ S means Selector and M means Matching Type. Each row is one example, and the big hex blob after it is the association data ๐Ÿงš

S M Association Data
0 0 30820454308202BC020900AB58D24E77AD2AF6300D06092A86
    4886F70D0101050500306C310B3009060355040613024E4C31163014
    0603550408130D4E6F6F72642D486F6C6C616E643112301006035504
    071309416D7374657264616D310C300A060355040A13034F53333123
    30210603550403131A64616E652E6B6965762E70726163746963756D
    2E6F73332E6E6C301E170D3132303131363136353730335A170D3232
    303131333136353730335A306C310B3009060355040613024E4C3116
    30140603550408130D4E6F6F72642D486F6C6C616E64311230100603
    5504071309416D7374657264616D310C300A060355040A13034F5333
    312330210603550403131A64616E652E6B6965762E70726163746963
    756D2E6F73332E6E6C308201A2300D06092A864886F70D0101010500
    0382018F003082018A0282018100E62C84A5AFE59F0A2A6B250DEE68
    7AC8C5C604F57D26CEB2119140FFAC38C4B9CBBE8923082E7F81626B
    6AD5DEA0C8771C74E3CAA7F613054AEFA3673E48FFE47B3F7AF987DE
    281A68230B24B9DA1A98DCBE51195B60E42FD7517C328D983E26A827
    C877AB914EE4C1BFDEAD48BD25BE5F2C473BA9C1CBBDDDA0C374D0D5
    8C389CC3D6D8C20662E19CF768F32441B7F7D14AEA8966CE7C32A172
    2AB38623D008029A9E4702883F8B977A1A1E5292BF8AD72239D40393
    37B86A3AC60FA001290452177BF1798609A05A130F033457A5212629
    FBDDB8E70E2A9E6556873C4F7CA46AE4A8B178F05FB319005E1C1C7D
    4BD77DFA34035563C126AA2C3328B900E7990AC9787F01DA82F74C3D
    4B6674CCECE1FD4C6EF9E6644F4635EDEDA39D8B0E2F7C8E06DAE775
    6213BD3D60831175BE290442B4AFC5AE6F46B769855A067C1097E617
    962529E166F22AEE10DDB981B8CD6FF17D3D70723169038DBFBC1A44
    9C8D0D31BC683C5F3CE26148E42EC9BBD4D9F261569B25B53C1D7FC2
    DDFF6B4CAC050203010001300D06092A864886F70D01010505000382
    0181002B2ABE063E9C86AC4A1F7835372091079C8276A9C2C5D1EC57
    64DE523FDDABDEAB3FD34E6FE6CBA054580A6785A663595D90132B93
    D473929E81FA0887D2FFF78A81C7D014B97778AB6AC9E5E690F6F5A9
    E92BB5FBAB71B857AE69B6E18BDCCB0BA6FCD9D4B084A34F3635148C
    495D48FE635903B888EC1DEB2610548EDD48D63F86513A4562469831
    48C0D5DB82D73A4C350A42BB661D763430FC6C8E5F9D13EA1B76AA52
    A4C358E5EA04000F794618303AB6CEEA4E9A8E9C74D73C1B0B7BAF16
    DEDE7696B5E2F206F777100F5727E1684D4132F5E692F47AF6756EA8
    B421000BE031B5D8F0220E436B51FB154FE9595333C13A2403F9DE08
    E5DDC5A22FD6182E339593E26374450220BC14F3E40FF33F084526B0
    9C34250702E8A352B332CCCB0F9DE2CF2B338823B92AFC61C0B6B8AB
    DB5AF718ED8DDA97C298E46B82A01B14814868CFA4F2C36268BFFF4A
    591F42658BF75918902D3E426DFE1D5FF0FC6A212071F6DA8BD833FE
    2E560D87775E8EE9333C05B6FB8EB56589D910DB5EA903

0 1 EFDDF0D915C7BDC5782C0881E1B2A95AD099FBDD06D7B1F779
    82D9364338D955

0 2 81EE7F6C0ECC6B09B7785A9418F54432DE630DD54DC6EE9E3C
    49DE547708D236D4C413C3E97E44F969E635958AA410495844127C04
    883503E5B024CF7A8F6A94

1 0 308201A2300D06092A864886F70D01010105000382018F0030
    82018A0282018100E62C84A5AFE59F0A2A6B250DEE687AC8C5C604F5
    7D26CEB2119140FFAC38C4B9CBBE8923082E7F81626B6AD5DEA0C877
    1C74E3CAA7F613054AEFA3673E48FFE47B3F7AF987DE281A68230B24
    B9DA1A98DCBE51195B60E42FD7517C328D983E26A827C877AB914EE4
    C1BFDEAD48BD25BE5F2C473BA9C1CBBDDDA0C374D0D58C389CC3D6D8
    C20662E19CF768F32441B7F7D14AEA8966CE7C32A1722AB38623D008
    029A9E4702883F8B977A1A1E5292BF8AD72239D4039337B86A3AC60F
    A001290452177BF1798609A05A130F033457A5212629FBDDB8E70E2A
    9E6556873C4F7CA46AE4A8B178F05FB319005E1C1C7D4BD77DFA3403
    5563C126AA2C3328B900E7990AC9787F01DA82F74C3D4B6674CCECE1
    FD4C6EF9E6644F4635EDEDA39D8B0E2F7C8E06DAE7756213BD3D6083
    1175BE290442B4AFC5AE6F46B769855A067C1097E617962529E166F2
    2AEE10DDB981B8CD6FF17D3D70723169038DBFBC1A449C8D0D31BC68
    3C5F3CE26148E42EC9BBD4D9F261569B25B53C1D7FC2DDFF6B4CAC05
    0203010001

1 1 8755CDAA8FE24EF16CC0F2C918063185E433FAAF1415664911
    D9E30A924138C4

1 2 D43165B4CDF8F8660AECCCC5344D9D9AE45FFD7E6AAB7AB9EE
    C169B58E11F227ED90C17330CC17B5CCEF0390066008C720CEC6AAE5
    33A934B3A2D7E232C94AB4

Authors' Addresses ๐Ÿซถ

Paul Hoffman ๐Ÿ’– VPN Consortium EMail: paul.hoffman@vpnc.org

Jakob Schlyter ๐Ÿ’œ Kirei AB EMail: jakob@kirei.se

๐Ÿ“ฆ where this page comes from