Network Working Group P. Hoffman
Internet-Draft VPN Consortium
Intended status: Standards Track J. Schlyter
Expires: August 02, 2012 Kirei AB
February 2012

Using Secure DNS to Associate Certificates with Domain Names For TLS
draft-ietf-dane-protocol-15

Abstract

TLS and DTLS use PKIX certificates for authenticating the server. Users want their applications to verify that the certificate provided by the TLS server is in fact associated with the domain name they expect. TLSA provides bindings of keys to domains that are asserted not by external entities, but by the entities that operate the DNS. This document describes how to use secure DNS to associate the TLS server's certificate with the intended domain name.

Status of This Memo

This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.

Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet- Drafts is at http:/⁠/⁠datatracker.ietf.org/⁠drafts/⁠current/⁠.

Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."

This Internet-Draft will expire on August 02, 2012.

Copyright Notice

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) in effect on the date of publication of this document. Please review these documents carefully, as 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 are provided without warranty as described in the Simplified BSD License.


Table of Contents

1. Introduction

The first response from the server in TLS may contain a certificate. In order for the TLS client to authenticate that it is talking to the expected TLS server, the client must validate that this certificate is associated with the domain name used by the client to get to the server. Currently, the client must extract the domain name from the certificate, must trust a trust anchor upon which the server's certificate is rooted, and must successfully validate the certificate.

Some people want a different way to authenticate the association of the server's certificate with the intended domain name without trusting an external certificate authority (CA). Given that the DNS administrator for a domain name is authorized to give identifying information about the zone, it makes sense to allow that administrator to also make an authoritative binding between the domain name and a certificate that might be used by a host at that domain name. The easiest way to do this is to use the DNS.

There are many use cases for such functionality. [DANEUSECASES] lists the ones that the protocol in this document is meant to apply to. [DANEUSECASES] also lists many requirements, most of which the protocol in this document is believed to meet. Section 6 covers the applicability of this document to the use cases in detail.

This document applies to both TLS [RFC5246] and DTLS [RFC4347bis]. In order to make the document more readable, it mostly only talks about "TLS", but in all cases, it means "TLS or DTLS". This document only relates to securely associating certificates for TLS and DTLS with host names; other security protocols and other forms of identification of TLS servers (such as IP addresses) are handled in other documents. For example, keys for IPsec are covered in [RFC4025] and keys for SSH are covered in [RFC4255].

1.1. Certificate Associations

A certificate association is formed from a piece of information identifying a certificate with the domain name where the data is found. The data used to identify the certificate consists of either a PKIX certificate or a hash of a PKIX certificate. When using the certificate itself in the certificate association, the entire certificate in the normal format is used. This document only applies to PKIX [RFC5280] certificates, not certificates of other formats.

A DNS query can return multiple certificate associations, such as in the case of different server software on a single host using different certificates, or in the case that a server is changing from one certificate to another.

1.2. Securing Certificate Associations

This document defines a secure method to associate the certificate that is obtained from the TLS server with a domain name using DNS; the DNS information needs to be 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.

DNSSEC, which is defined in RFCs 4033, 4034, and 4035 ([RFC4033], [RFC4034], and [RFC4035]), uses cryptographic keys and digital signatures to provide authentication of DNS data. Information that is retrieved from the DNS and that is validated using DNSSEC is thereby proved to be the authoritative data. The DNSSEC signature MUST be validated on all responses that use DNSSEC in order to assure the proof of origin of the data. This document does not specify how DNSSEC validation occurs because there are many different proposals for how a client might get validated DNSSEC results.

This document only relates to securely getting the DNS information for the certificate association using DNSSEC; other secure DNS mechanisms are out of scope.

1.3. 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 makes use of standard PKIX, DNSSEC, and TLS terminology. See [RFC5280], [RFC4033], and [RFC5246] respectively, for these terms. In addition, 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 certificate with the domain name where the record is found. The semantics of how the TLSA RR is interpreted are given later in this document.

The type value for the TLSA RR type is TBD.

The TLSA RR is class independent.

The TLSA RR has no special TTL requirements.

2.1. TLSA RDATA Wire Format

                     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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Usage     |   Selector    | Matching Type |               /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+               /
/                                                               /
/                 Certificate Association Data                  /
/                                                               /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

The RDATA for a TLSA RR consists of a one octet usage type field, a one octet selector field, a one octet matching type field and the certificate association data field.

2.1.1. The Certificate Usage Field

A one-octet value, called "certificate usage" or just "usage", specifying the provided association that will be used to match the target certificate from the TLS handshake. This value is defined in a new IANA registry (see Section 8.2) in order to make it easier to add additional certificate usages in the future. The usages defined in this document are:

The certificate usages defined in this document explicitly only apply to PKIX-formatted certificates in DER encoding. If TLS allows other formats later, or if extensions to this protocol are made that accept other formats for certificates, those certificates will need their own certificate usage values.

The use of this field is described in greater detail in Section 4.

2.1.2. The Selector Field

A one-octet value, called "selector", specifying what the association data will be matched against from the TLS certificate presented by the server. This value is defined in a new IANA registry (see Section 8.3. The selectors defined in this document are:

2.1.3. The Matching Type Field

A one-octet value, called "matching type", specifying how the certificate association is presented. This value is defined in a new IANA registry (see Section 8.4). The types defined in this document are:

Because a client support for multiple hash algorithms might be limited, it is advisable to use the same hash algorithm for the matching type as is used for the signature in the certificate. Doing so will increase the likelihood of interoperability.

2.1.4. The Certificate Association Data Field

The "certificate association data" to be matched. The field contains the bytes to be matched or the hash of the bytes to be matched. The field contains the bytes to be matched: the raw data, for matching type 0, or the hash of the raw data, for matching types 1 and 2. The data refers to the certificate in the association, not to the TLS ASN.1 Certificate object.

2.2. TLSA RR Presentation Format

The presentation format of the RDATA portion is as follows:

2.3. TLSA RR Examples

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

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

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

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

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

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

3. Domain Names for TLS Certificate Associations

Unless there is an protocol-specific specification that is different than this one, TLSA resource records are stored at a prefixed DNS domain name. The prefix is prepared in the following manner:

  1. The decimal representation of the port number on which a TLS-based service is assumed to exist is prepended with an underscore character ("_") to become the left-most label in the prepared domain name. This number has no leading zeros.
  2. The protocol name of the transport on which a TLS-based service is assumed to exist is prepended with an underscore character ("_") to become the second left-most label in the prepared domain name. The transport names defined for this protocol are "tcp", "udp" and "sctp".
  3. The domain name is appended to the result of step 2 to complete the prepared domain name.

For example, to request a TLSA resource record for an HTTP server running TLS on port 443 at "www.example.com", you would use "_443._tcp.www.example.com" in the request. To request a TLSA resource record for an SMTP server running the STARTTLS protocol on port 25 at "mail.example.com", you would use "_25._tcp.mail.example.com".

4. Semantics and Features of TLSA Certificate Usages

The certificate usages have very different semantics, but also have features common to all the types.

4.1. Pass PKIX Validation and Chain Through CA

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 validation chains for the end entity certificate given by the server in TLS. This usage is sometimes referred to as "CA constraint" because it limits which CA can be used to issue certificates for a given host name.

4.2. Pass PKIX Validation and Match End Entity Certificate

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 usage is sometimes referred to as "service certificate constraints" because it limits which end entity certificate may be used by a given host name.

4.3. Pass PKIX Validation and Use Trust Anchor

Certificate usage 2 is used to specify a certificate, or the public key of such a certificate, that must be used as a trust anchor when validating the end entity certificate given by the server in TLS. This usage allows a domain name administrator to specify a new trust anchor, such as if the domain issues its own certificates under its own CA that is not expected to be in the end users collection of trust anchors.

4.4. Match Certificate

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 usage is sometimes referred to as "domain-issued certificate" because it allows for a domain name administrator to issue certificates for a domain without involving a third-party CA.

5. Use of TLS Certificate Associations in TLS

Section 2.1 of this document defines the mandatory matching rules for the data from the TLS certificate associations and the certificates received from the TLS server.

The TLS session that is to be set up MUST be for the specific port number and transport name that was given in the TLSA query. The matching or chaining MUST be done within the life of the TTL on the TLSA record; using a TLSA record past the lifetime specified in the TTL can expose the the TLS client to many types of attacks.

Some specifications for applications that run under TLS, such as [RFC2818] for HTTP, require the server's certificate to have a domain name that matches the host name expected by the client. Some specifications such as [RFC6125] detail how to match the identity given in a PKIX certificate with those expected by the user.

An application that complies with this document first requests TLSA records in order to make certificate associations.

Determining whether a TLSA RRset can be used depends on the DNSSEC validation state (as defined in [RFC4033]).

If an application receives zero usable certificate associations, it processes TLS in the normal fashion without any input from the TLSA records; otherwise, that application attempts to match each certificate association with the TLS server's end entity certificate.

Clients that validate the DNSSEC signatures themselves MUST use standard DNSSEC validation procedures. Clients that rely on another entity to perform the DNSSEC signature validation MUST use a secure transport between themselves and the validator. Examples of secure transports include TSIG [RFC2845], SIG(0) [RFC2931], and IPsec [RFC6071]. Note that it is not sufficient to use secure transport to a DNS resolver that does not do DNSSEC signature validation.

If a certificate association contains a certificate usage, selector, or matching type that is not understood by the TLS client, that certificate association MUST be marked as unusable. If the comparison data for a certificate is malformed, the certificate association MUST be marked as unusable. If a certificate association contains a matching type or certificate association data that uses a cryptographic algorithm that is considered too weak for the TLS client's policy, the certificate association MUST be marked as unusable.

6. TLSA and DANE Use Cases and Requirements

The different types of certificates associations defined in TLSA are matched with various sections of [DANEUSECASES]. Three use cases from Section 3 of [DANEUSECASES] are covered in this protocol as follows:

3.1 CA Constraints
-- Implemented using certificate usage 0.
3.2 Certificate Constraints
-- Implemented using certificate usage 1.
3.3 Domain-Issued Certificates
-- Implemented using certificate usage 3.

The requirements from Section 4 of [DANEUSECASES] are covered in this protocol as follows:

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 5 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, TLS is not attempted at all.
Encapsulation
-- Covered in the TLSA response semantics.
Predictability
-- The appendixes of this specification provide operational considerations and implementation guidance in order to enable application developers to form a consistent interpretation of the recommended DANE 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 5.
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 DANE assertions. No support is provided to combine two TLSA certificate associations in a single operation.
Roll-over
-- Section 5 states that applications must not cache TLSA records beyond their TTL expiration. This ensures that clients will not latch onto assertions made by expired TLSA records, and will be able to transition between using one DANE mechanism 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 TLSA records that are only shown to be validated.
Wild Cards
-- Covered in a limited manner in the TLSA request syntax; see Appendix A.
Redirection
-- Covered in the TLSA request syntax; see Appendix A.

7. Mandatory-to-Implement Algorithms

A system creating TLSA records that conforms to this specification MUST be able to create TLSA records containing certificate usages 0, 1, 2, and 3. A system creating TLSA records that conforms to this specification MUST be able to create TLSA records with selectors 0 (full certificate) and 1 (SubjectPublicKeyInfo). A system creating TLSA records that conforms to this specification MUST be able to create TLSA records using matching type 0 (no hash used) and matching type 1 (SHA-256), and SHOULD be able to create TLSA records using matching type 2 (SHA-512).

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 selectors type 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).

At the time this is written, it is expected that there will be a new family of hash algorithms called SHA-3 within the next few years. It is expected that some of the SHA-3 algorithms will be mandatory and/or recommended for TLSA records after the algorithms are fully defined. At that time, this specification will be updated.

8. IANA Considerations

8.1. TLSA RRtype

This document uses a new DNS RR type, TLSA, whose value is TBD. A separate request for the RR type will be submitted to the expert reviewer, and future versions of this document will have that value instead of TBD.

In the following sections, "RFC Required" was chosen TLSA usages, and "Specification Required" for selectors and hashes, because of the amount of detail that is likely to be needed for implementers to correctly implement new usages as compared to new matching types and hash types.

8.2. TLSA Usages

Value    Short description                       Reference
----------------------------------------------------------
0        Pass PKIX and chain through CA          [This]
1        Pass PKIX and match EE                  [This]
2        Pass PKIX and trusted via certificate   [This]
3        Match certificate                       [This]
4-254    Unassigned
255      Private use

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

Applications to the registry can request specific values that have yet to be assigned.

8.3. TLSA Selectors

Value    Short description                       Reference
----------------------------------------------------------
0        Full Certificate                        [This]
1        SubjectPublicKeyInfo                    [This]
2-254    Unassigned
255      Private use

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

Applications to the registry can request specific values that have yet to be assigned.

8.4. TLSA Matching Types

Value    Short description    Reference      
---------------------------------------------
0        No hash used         [This]
1        SHA-256              NIST FIPS 180-3
2        SHA-512              NIST FIPS 180-3
3-254    Unassigned
255      Private use

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

Applications to the registry can request specific values that have yet to be assigned.

9. Security Considerations

The security of the protocols described in this document relies on the security of DNSSEC as used by the client requesting A/AAAA and TLSA records.

A DNS administrator who goes rogue and changes both the A/AAAA and TLSA records for a domain name can cause the user to go to an unauthorized server that will appear authorized, unless the client performs certificate validation and rejects the certificate. That administrator could probably get a certificate issued 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/AAAA records, a man-in-the-middle who can redirect traffic to their site may be able to impersonate the attacked host in TLS if they 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 host.

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, the TLSA protocol 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. Thus, such proxies might choose to aggressively block TLSA requests and/or responses, even though this is not a recommended practice.

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 domain name administrator.

If a server's certificate is revoked, or if an intermediate CA in a chain between the end entity and a trust anchor has its certificate revoked, a TLSA record with a certificate type 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 key or certificate used in TLSA records with a certificate type of 2 are in fact able to be used as reliable trust anchors.

Certificates that are delivered in TLSA with usage type 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 usage type 2. This in essence allows an intermediate CA to be come a trust anchor for certificates that the end user might have expected to chain to an existing trust anchor.

10. 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 here originated with Paul Vixie, Dan Kaminsky, Jeff Hodges, Phill Hallam-Baker, Simon Josefsson, Warren Kumari, Adam Langley, Ben Laurie, Ilari Liusvaara, Ondrej Mikle, Scott Schmit, Ondrej Sury, Richard Barnes, Jim Schaad, Stephen Farrell and Suresh Krishnaswamy.

This document has also been greatly helped by many active participants of the DANE Working Group.

11. References

11.1. Normative References

[RFC4347bis] Rescorla, E. and N. Modadugu, "Datagram Transport Layer Security version 1.2", Internet-Draft draft-ietf-tls-rfc4347-bis, July 2010.
[DANEUSECASES] Barnes, R., "Use Cases and Requirements for DNS-based Authentication of Named Entities (DANE)", Internet-Draft draft-ietf-dane-use-cases, 2011.
[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.

11.2. Informative References

[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, D. and B. Wellington, "Secret Key Transaction Authentication for DNS (TSIG)", RFC 2845, May 2000.
[RFC2931] Eastlake, 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.
[RFC6066] Eastlake, D., "Transport Layer Security (TLS) Extensions: Extension Definitions", RFC 6066, January 2011.
[RFC4641] Kolkman, O. and R. Gieben, "DNSSEC Operational Practices", RFC 4641, September 2006.
[RFC6071] Frankel, S. and S. Krishnan, "IP Security (IPsec) and Internet Key Exchange (IKE) Document Roadmap", RFC 6071, February 2011.

Appendix A. Operational Considerations for Deploying TLSA Records

Appendix A.1. Creating TLSA Records

When creating TLSA record with certificate usage type 0 (CA Certificate) or type 2 (Trust Anchor), one needs to understand the implications when choosing between selector type 0 (full certificate) and 1 (SubjectPublicKeyInfo). A careful choice is required because the different methods for building trust chains are used by different TLS clients. The following outlines the cases that one should be aware of and discusses the implications of the choice of selector type.

Certificate usage 2 is not affected by the different types of chain building when the end entity certificate is the same as the trust anchor certificate.

Appendix A.1.1. Ambiguities and Corner Cases When TLS Clients Build Trust Chains

TLS clients may implement their own chain-building code rather than rely on the chain presented by the TLS server. This means that, except for the end entity certificate, any certificate presented in the suggested chain may or may not be present in the final chain built by the client.

Certificates that the client can use to replace certificates from original chain include:

CAs frequently reissue certificates with different validity period, signature algorithm (such as an different hash algorithm in the signature algorithm), CA key pair (such as for a cross-certificate), or PKIX extensions where the public key and subject remain the same. These reissued certificates are the certificates TLS client can use in place of an original certificate.

Clients are known to exchange or remove certificates that could cause TLSA association that rely on the full certificate to fail. For example:

Appendix A.1.2. Choosing a Selector Type

In this section, "false-negative failure" means that a client will not accept the TLSA association for certificate designated by DNS administrator. Also, "false-positive acceptance" means that the client accepts a TLSA association for a certificate that is not designated by the DNS administrator.

Appendix A.1.2.1. Selector Type 0 (Full Certificate)

The "Full certificate" selector provides the most precise specification of a TLS certificate association, capturing all fields of the PKIX certificate. For a DNS administrator, the best course to avoid false-negative failures in the client when using this selector are:

Appendix A.1.2.2. Selector Type 1 (SubjectPublicKeyInfo)

A SubjectPublicKeyInfo selector gives greater flexibility in avoiding some false-negative failures caused by trust-chain-building algorithms used in clients.

One specific use-case should be noted: creating a TLSA association to certificate I1 that directly signed end entity certificate S1 of server. Since the key used to sign S1 is fixed, association to I1 must succeed: if a client swaps I1 for I2 (a different certificate), its SPKI must match SPKI of I1. Such association would not suffer from a false-negative failure on client's side if the client uses a reissued CA certificate I2 in place of I1.

The attack surface is a bit broader compared to "full certificate" selector: the DNS administrator might unintentionally specify an association that would lead to false-positive acceptance.

Using the SubjectPublicKeyInfo selector for association with a certificate in a chain above I1 needs to be decided on a case-by-case basis: there are too many possibilities based on the issuing CA's practices. Unless the full implications of such an association are understood by the administrator, using selector type 0 is a better option from a security perspective.

Appendix A.2. Provisioning TLSA Records in DNS

Appendix A.2.1. Provisioning TLSA Records with Aliases

The TLSA resource record is not 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]. This affects the way that the TLSA resource record is used when aliasing in the DNS.

Note that 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.

Appendix A.2.1.1. Provisioning TLSA Records with CNAME Records

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

Using CNAME to alias in DNS only aliases from the exact name given, not any zones below the given name. For example, assume that a zone file has only the following:

Application implementations and full-service resolvers request DNS records using libraries that automatically follow CNAME (and DNAME) aliasing. This allows hosts to put TLSA records in their own zones or to use CNAME to do redirection.

; 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/32

If the owner of the original domain wants a TLSA record for the same, they simply enter it under the defined prefix:

; 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/32
_443._tcp.sub6.example.com.  IN TLSA 1 1 1 536a570ac49d9ba4...

If the owner of the original domain wants to have the target domain host the TLSA record, the original domain uses a CNAME record:

; 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/32
_443._tcp.sub6.example.com.  IN TLSA 1 1 1 ac49d9ba4570ac49...

Note that it is acceptable for both the original domain and the target domain to have TLSA records, but the two records are unrelated. Consider the following: [RFC6066].

Note that these methods use the normal method for DNS aliasing using CNAME: the DNS client requests the record type that they actually want.

Appendix A.2.1.2. Provisioning TLSA Records with DNAME Records

Using DNAME records allows a zone owner to alias an entire subtree of names below the name that has the DNAME. This allows the wholesale aliasing of prefixed records such as those used by TLSA, SRV, and so on without aliasing the name itself. However, because DNAME can only be used for subtrees of a base name, it is 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/32
_443._tcp.sub6.example.com.  IN TLSA 1 1 1 536a570ac49d9ba4...

Appendix A.2.1.3. Provisioning TLSA Records with Wildcards

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

Wildcards are generally not terribly useful for RRtypes that require prefixing because you can only wildcard at a layer below the host name. For example, if you want to have the same TLSA record for every TCP port for www.example.com, you might have

Appendix A.2.2. Provisioning with NS Records

[[ THIS SECTION NEEDS TO BE WRITTEN OR REMOVED. This was proposed, and questioned, and not yet followed through on. This section will be removed in the next draft if no one volunteers to write it. ]]

Appendix A.3. Securing the Last Hop

As described in Section 5, an application processing TLSA records must know the DNSSEC validity of those records. There are many ways for the application to securely find this out, and this specification does not mandate any single method.

Some common methods for an application to know the DNSSEC validity of TLSA records include:

Appendix A.4. Handling Certificate Rollover

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

Certificate rollover is handled in much the same was as for rolling DNSSEC zone signing keys using the pre-publish key rollover method [RFC4641]. Suppose 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...
_990._tcp.example.com IN TLSA 1 1 1 62D5414CD1CC657E3D30...

To start the rollover process, obtain or generate the new certificate or SubjectPublicKeyInfo to be used after the rollover and generate the new TLSA record. Add that record alongside the old one:

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

After 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. Once this has occurred, the old TLSA record can be removed:

Appendix B. Pseudocode for Using TLSA

This appendix describes the interactions given earlier in this specification in pseudocode format. This appendix is non-normative. If the steps below disagree with the text earlier in the document, the steps earlier in the document should be considered correct and this text incorrect.

Note that this pseudocode is more strict than the normative text. For instance, it forces an order on the evaluation of criteria which is not mandatory from the normative text.

Appendix B.1. Helper Functions

// 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
  }

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

  // 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
}

Appendix B.2. Main TLSA Pseudo Code

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, class=IN)

// 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 certificate. Also,
//    there can be multiple PKIX validation chains for the
//    certificates given by the server in TLS. Thus, there are
//    possibly many chains that might need to be tested during
//    PKIX validation.

for each R in TLSArecords {

  // pass PKIX validation and chain through CA cert from TLSA
  if (R.certUsage == 0) {
    for each PKIX validation chain H {
      if (C passes PKIX 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 validation and match EE cert from TLSA
  if (R.certUsage == 1) {
    for each PKIX validation chain H {
      if ((C passes PKIX validation in H) and
              Match(R.matchingType, Select(R.selectorType, C),
              R.cert)) {
          Finish(ACCEPT)
      }
    }
  }

  // pass PKIX validation using TLSA record as trust anchor
  if (R.certUsage == 2) {
    for each PKIX validation chain H that has R as the trust anchor {
      if (C passes PKIX validation in H) and
             Match(R.matchingType, Select(R.selectorType, C),
             R.cert)) {
        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)

Authors' Addresses

Paul Hoffman VPN Consortium EMail: paul.hoffman@vpnc.org
Jakob Schlyter Kirei AB EMail: jakob@kirei.se