idnits 2.17.1 draft-ietf-uta-mta-sts-11.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** There are 10 instances of too long lines in the document, the longest one being 7 characters in excess of 72. == There are 3 instances of lines with non-RFC2606-compliant FQDNs in the document. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (November 8, 2017) is 2360 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Missing Reference: 'CRLF' is mentioned on line 286, but not defined -- Looks like a reference, but probably isn't: '1' on line 1098 -- Looks like a reference, but probably isn't: '0' on line 917 ** Obsolete normative reference: RFC 5246 (Obsoleted by RFC 8446) ** Obsolete normative reference: RFC 5785 (Obsoleted by RFC 8615) ** Obsolete normative reference: RFC 6125 (Obsoleted by RFC 9525) ** Obsolete normative reference: RFC 7231 (Obsoleted by RFC 9110) ** Obsolete normative reference: RFC 7525 (Obsoleted by RFC 9325) -- Obsolete informational reference (is this intentional?): RFC 7234 (Obsoleted by RFC 9111) Summary: 6 errors (**), 0 flaws (~~), 3 warnings (==), 5 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Using TLS in Applications D. Margolis 3 Internet-Draft M. Risher 4 Intended status: Standards Track Google, Inc 5 Expires: May 12, 2018 B. Ramakrishnan 6 Yahoo!, Inc 7 A. Brotman 8 Comcast, Inc 9 J. Jones 10 Microsoft, Inc 11 November 8, 2017 13 SMTP MTA Strict Transport Security (MTA-STS) 14 draft-ietf-uta-mta-sts-11 16 Abstract 18 SMTP Mail Transfer Agent Strict Transport Security (MTA-STS) is a 19 mechanism enabling mail service providers to declare their ability to 20 receive Transport Layer Security (TLS) secure SMTP connections, and 21 to specify whether sending SMTP servers should refuse to deliver to 22 MX hosts that do not offer TLS with a trusted server certificate. 24 Status of This Memo 26 This Internet-Draft is submitted in full conformance with the 27 provisions of BCP 78 and BCP 79. 29 Internet-Drafts are working documents of the Internet Engineering 30 Task Force (IETF). Note that other groups may also distribute 31 working documents as Internet-Drafts. The list of current Internet- 32 Drafts is at http://datatracker.ietf.org/drafts/current/. 34 Internet-Drafts are draft documents valid for a maximum of six months 35 and may be updated, replaced, or obsoleted by other documents at any 36 time. It is inappropriate to use Internet-Drafts as reference 37 material or to cite them other than as "work in progress." 39 This Internet-Draft will expire on May 12, 2018. 41 Copyright Notice 43 Copyright (c) 2017 IETF Trust and the persons identified as the 44 document authors. All rights reserved. 46 This document is subject to BCP 78 and the IETF Trust's Legal 47 Provisions Relating to IETF Documents 48 (http://trustee.ietf.org/license-info) in effect on the date of 49 publication of this document. Please review these documents 50 carefully, as they describe your rights and restrictions with respect 51 to this document. Code Components extracted from this document must 52 include Simplified BSD License text as described in Section 4.e of 53 the Trust Legal Provisions and are provided without warranty as 54 described in the Simplified BSD License. 56 Table of Contents 58 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 59 1.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . 3 60 2. Related Technologies . . . . . . . . . . . . . . . . . . . . 3 61 3. Policy Discovery . . . . . . . . . . . . . . . . . . . . . . 4 62 3.1. MTA-STS TXT Records . . . . . . . . . . . . . . . . . . . 4 63 3.2. MTA-STS Policies . . . . . . . . . . . . . . . . . . . . 5 64 3.3. HTTPS Policy Fetching . . . . . . . . . . . . . . . . . . 8 65 3.4. Policy Selection for Smart Hosts and Subdomains . . . . . 9 66 3.5. MX Certificate Validation . . . . . . . . . . . . . . . . 10 67 4. Policy Application . . . . . . . . . . . . . . . . . . . . . 10 68 4.1. Policy Application Control Flow . . . . . . . . . . . . . 11 69 5. Reporting Failures . . . . . . . . . . . . . . . . . . . . . 11 70 6. Interoperability Considerations . . . . . . . . . . . . . . . 12 71 6.1. SNI Support . . . . . . . . . . . . . . . . . . . . . . . 12 72 6.2. Minimum TLS Version Support . . . . . . . . . . . . . . . 12 73 7. Operational Considerations . . . . . . . . . . . . . . . . . 12 74 7.1. Policy Updates . . . . . . . . . . . . . . . . . . . . . 13 75 7.2. Policy Delegation . . . . . . . . . . . . . . . . . . . . 13 76 7.3. Removing MTA-STS . . . . . . . . . . . . . . . . . . . . 14 77 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 14 78 8.1. Well-Known URIs Registry . . . . . . . . . . . . . . . . 14 79 8.2. MTA-STS TXT Record Fields . . . . . . . . . . . . . . . . 15 80 8.3. MTA-STS Policy Fields . . . . . . . . . . . . . . . . . . 15 81 9. Security Considerations . . . . . . . . . . . . . . . . . . . 15 82 9.1. Obtaining a Signed Certificate . . . . . . . . . . . . . 16 83 9.2. Preventing Policy Discovery . . . . . . . . . . . . . . . 16 84 9.3. Denial of Service . . . . . . . . . . . . . . . . . . . . 17 85 9.4. Weak Policy Constraints . . . . . . . . . . . . . . . . . 18 86 9.5. Compromise of the Web PKI System . . . . . . . . . . . . 18 87 10. Contributors . . . . . . . . . . . . . . . . . . . . . . . . 18 88 11. Appendix 1: MTA-STS example record & policy . . . . . . . . . 19 89 12. Appendix 2: Message delivery pseudocode . . . . . . . . . . . 19 90 13. References . . . . . . . . . . . . . . . . . . . . . . . . . 22 91 13.1. Normative References . . . . . . . . . . . . . . . . . . 22 92 13.2. Informative References . . . . . . . . . . . . . . . . . 23 93 13.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 24 94 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 24 96 1. Introduction 98 The STARTTLS extension to SMTP [RFC3207] allows SMTP clients and 99 hosts to negotiate the use of a TLS channel for encrypted mail 100 transmission. 102 While this opportunistic encryption protocol by itself provides a 103 high barrier against passive man-in-the-middle traffic interception, 104 any attacker who can delete parts of the SMTP session (such as the 105 "250 STARTTLS" response) or who can redirect the entire SMTP session 106 (perhaps by overwriting the resolved MX record of the delivery 107 domain) can perform downgrade or interception attacks. 109 This document defines a mechanism for recipient domains to publish 110 policies specifying: 112 o whether MTAs sending mail to this domain can expect PKIX- 113 authenticated TLS support 115 o what a conforming client should do with messages when TLS cannot 116 be successfully negotiated 118 1.1. Terminology 120 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 121 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 122 document are to be interpreted as described in [RFC2119]. 124 We also define the following terms for further use in this document: 126 o MTA-STS Policy: A commitment by the Policy Domain to support PKIX 127 authenticated TLS for the specified MX hosts. 129 o Policy Domain: The domain for which an MTA-STS Policy is defined. 130 This is the next-hop domain; when sending mail to 131 "alice@example.com" this would ordinarily be "example.com", but 132 this may be overridden by explicit routing rules (as described in 133 Section 3.4, "Policy Selection for Smart Hosts and Subdomains"). 135 2. Related Technologies 137 The DANE TLSA record [RFC7672] is similar, in that DANE is also 138 designed to upgrade unauthenticated encryption or plaintext 139 transmission into authenticated, downgrade-resistant encrypted 140 transmission. DANE requires DNSSEC [RFC4033] for authentication; the 141 mechanism described here instead relies on certificate authorities 142 (CAs) and does not require DNSSEC, at a cost of risking malicious 143 downgrades. For a thorough discussion of this trade-off, see 144 Section 9, "Security Considerations". 146 In addition, MTA-STS provides an optional report-only mode, enabling 147 soft deployments to detect policy failures; partial deployments can 148 be achieved in DANE by deploying TLSA records only for some of a 149 domain's MXs, but such a mechanism is not possible for the per-domain 150 policies used by MTA-STS. 152 The primary motivation of MTA-STS is to provide a mechanism for 153 domains to upgrade their transport security even when deploying 154 DNSSEC is undesirable or impractical. However, MTA-STS is designed 155 not to interfere with DANE deployments when the two overlap; in 156 particular, senders who implement MTA-STS validation MUST NOT allow a 157 "valid" or "report-only" MTA-STS validation to override a failing 158 DANE validation. 160 3. Policy Discovery 162 MTA-STS policies are distributed via HTTPS from a "well-known" 163 [RFC5785] path served within the Policy Domain, and their presence 164 and current version are indicated by a TXT record at the Policy 165 Domain. These TXT records additionally contain a policy "id" field, 166 allowing sending MTAs to check the currency of a cached policy 167 without performing an HTTPS request. 169 To discover if a recipient domain implements MTA-STS, a sender need 170 only resolve a single TXT record. To see if an updated policy is 171 available for a domain for which the sender has a previously cached 172 policy, the sender need only check the TXT record's version "id" 173 against the cached value. 175 3.1. MTA-STS TXT Records 177 The MTA-STS TXT record is a TXT record with the name "_mta-sts" at 178 the Policy Domain. For the domain "example.com", this record would 179 be "_mta-sts.example.com". MTA-STS TXT records MUST be US-ASCII, 180 semicolon-separated key/value pairs containing the following fields: 182 o "v": (plain-text, required). Currently only "STSv1" is supported. 184 o "id": (plain-text, required). A short string used to track policy 185 updates. This string MUST uniquely identify a given instance of a 186 policy, such that senders can determine when the policy has been 187 updated by comparing to the "id" of a previously seen policy. 188 There is no implied ordering of "id" fields between revisions. 190 An example TXT record is as below: 192 "_mta-sts.example.com. IN TXT "v=STSv1; id=20160831085700Z;"" 194 The formal definition of the "_mta-sts" TXT record, defined using 195 [RFC7405], is as follows: 197 sts-text-record = sts-version 1*(field-delim sts-field) [field-delim] 199 sts-field = sts-id / ; Note that sts-id record 200 sts-extension ; is required. 202 field-delim = *WSP ";" *WSP 204 sts-version = %s"v=STSv1" 206 sts-id = %s"id=" 1*32(ALPHA / DIGIT) ; id=... 208 sts-extension = sts-ext-name "=" sts-ext-value ; name=value 210 sts-ext-name = (ALPHA / DIGIT) *31(ALPHA / DIGIT / "_" / "-" / ".") 212 sts-ext-value = 1*(%x21-3A / %x3C / %x3E-7E) ; chars excluding "=", 213 ; ";", SP, and control 214 ; chars 216 If multiple TXT records for "_mta-sts" are returned by the resolver, 217 records which do not begin with "v=STSv1;" are discarded. If the 218 number of resulting records is not one, senders MUST assume the 219 recipient domain does not implement MTA-STS and skip the remaining 220 steps of policy discovery. If the resulting TXT record contains 221 multiple strings, then the record MUST be treated as if those strings 222 are concatenated together without adding spaces. 224 3.2. MTA-STS Policies 226 The policy itself is a set of key/value pairs (similar to [RFC5322] 227 header fields) served via the HTTPS GET method from the fixed 228 [RFC5785] "well-known" path of ".well-known/mta-sts.txt" served by 229 the "mta-sts" host at the Policy Domain. Thus for "example.com" the 230 path is "https://mta-sts.example.com/.well-known/mta-sts.txt". 232 The [RFC7231] "Content-Type" media type for this resource MUST be 233 "text/plain". When fetching a policy, senders SHOULD validate that 234 the media type is "text/plain" to guard against cases where 235 webservers allow untrusted users to host non-text content (typically, 236 HTML or images) at a user-defined path. Additional "Content-Type" 237 parameters are ignored. 239 This resource contains the following line-separated key/value pairs: 241 o "version": (plain-text). Currently only "STSv1" is supported. 243 o "mode": (plain-text). One of "enforce", "report", or "none", 244 indicating the expected behavior of a sending MTA in the case of a 245 policy validation failure. 247 o "max_age": Max lifetime of the policy (plain-text non-negative 248 integer seconds, maximum value of 31557600). Well-behaved clients 249 SHOULD cache a policy for up to this value from last policy fetch 250 time. To mitigate the risks of attacks at policy refresh time, it 251 is expected that this value typically be in the range of weeks or 252 greater. 254 o "mx": MX identity patterns (list of plain-text strings). One or 255 more patterns matching a Common Name ([RFC6125]) or Subject 256 Alternative Name ([RFC5280]) DNS-ID present in the X.509 257 certificate presented by any MX receiving mail for this domain. 258 For example: "mx: mail.example.com mx: .example.net" indicates 259 that mail for this domain might be handled by any MX with a 260 certificate valid for a host at "mail.example.com" or 261 "example.net". Valid patterns can be either fully specified names 262 ("example.com") or suffixes (".example.net") matching the right- 263 hand parts of a server's identity; the latter case are 264 distinguished by a leading period. If there are more than one MX 265 specified by the policy, they MUST be on separate lines within the 266 policy file. In the case of Internationalized Domain Names 267 ([RFC5891]), the MX MUST specify the Punycode-encoded A-label 268 [RFC3492] and not the Unicode-encoded U-label. The full semantics 269 of certificate validation are described in Section 3.5, "MX 270 Certificate Validation." 272 An example policy is as below: 274 version: STSv1 275 mode: enforce 276 mx: mail.example.com 277 mx: .example.net 278 mx: backupmx.example.com 279 max_age: 123456 281 The formal definition of the policy resource, defined using 282 [RFC7405], is as follows: 284 sts-policy-record = *WSP sts-policy-field *WSP 285 *(CRLF *WSP sts-policy-field *WSP) 286 [CRLF] 288 sts-policy-field = sts-policy-version / ; required once 289 sts-policy-mode / ; required once 290 sts-policy-max-age / ; required once 291 0*(sts-policy-mx *WSP CRLF) / ; required at 292 ; least once 293 ; except when mode 294 ; is "none" 295 sts-policy-extension ; other fields 297 field-delim = ":" *WSP 299 sts-policy-version = sts-policy-version-field field-delim 300 sts-policy-version-value 302 sts-policy-version-field = %s"version" 304 sts-policy-version-value = %s"STSv1" 306 sts-policy-mode = sts-policy-mode-field field-delim 307 sts-policy-mode-value 309 sts-policy-mode-field = %s"mode" 311 sts-policy-model-value = %s"report" / %s"enforce" / %s"none" 313 sts-policy-mx = sts-policy-mx-field field-delim 314 sts-policy-mx-value 316 sts-policy-mx-field = %s"mx" 318 sts-policy-mx-value = 1*(ALPHA / DIGIT / "_" / "-" / ".") 320 sts-policy-max-age = sts-policy-max-age-field field-delim 321 sts-policy-max-age-value 323 sts-policy-max-age-field = %s"max_age" 325 sts-policy-max-age-value = 1*10(DIGIT) 327 sts-policy-extension = sts-policy-ext-name field-delim ; additional 328 sts-policy-ext-value ; extension 329 ; fields 331 sts-policy-ext-name = (ALPHA / DIGIT) 332 *31(ALPHA / DIGIT / "_" / "-" / ".") 334 sts-policy-ext-value = 1*(%x21-3A / %x3C / %x3E-7E) ; chars excluding 335 ; "=", ";", SP, 336 ; and control 337 ; chars 339 Parsers MUST accept TXT records and policy files which are 340 syntactically valid (i.e. valid key/value pairs separated by semi- 341 colons for TXT records) and but containing additional key/value pairs 342 not specified in this document, in which case unknown fields SHALL be 343 ignored. If any non-repeated field--i.e. all fields excepting "mx"-- 344 is duplicated, all entries except for the first SHALL be ignored. If 345 any field is not specified, the policy SHALL be treated as invalid. 347 3.3. HTTPS Policy Fetching 349 When fetching a new policy or updating a policy, the HTTPS endpoint 350 MUST present a X.509 certificate which is valid for the "mta-sts" 351 host (e.g. "mta-sts.example.com") as described below, chain to a 352 root CA that is trusted by the sending MTA, and be non-expired. It 353 is expected that sending MTAs use a set of trusted CAs similar to 354 those in widely deployed Web browsers and operating systems. 356 The certificate is valid for the "mta-sts" host with respect to the 357 rules described in [RFC6125], with the following application-specific 358 considerations: 360 o Matching is performed only against the DNS-ID and CN-ID 361 identifiers. 363 o DNS domain names in server certificates MAY contain the wildcard 364 character '*' as the complete left-most label within the 365 identifier. 367 The certificate MAY be checked for revocation via the Online 368 Certificate Status Protocol (OCSP) [RFC6960], certificate revocation 369 lists (CRLs), or some other mechanism. 371 Policies fetched via HTTPS are only valid if the HTTP response code 372 is 200 (OK). HTTP 3xx redirects MUST NOT be followed, and HTTP 373 caching (as specified in [RFC7234]) MUST NOT be used. 375 Senders may wish to rate-limit the frequency of attempts to fetch the 376 HTTPS endpoint even if a valid TXT record for the recipient domain 377 exists. In the case that the HTTPS GET fails, we suggest 378 implementions may limit further attempts to a period of five minutes 379 or longer per version ID, to avoid overwhelming resource-constrained 380 recipients with cascading failures. 382 Senders MAY impose a timeout on the HTTPS GET and/or a limit on the 383 maximum size of the response body to avoid long delays or resource 384 exhaustion during attempted policy updates. A suggested timeout is 385 one minute, and a suggested maximum policy size 64 kilobytes; policy 386 hosts SHOULD respond to requests with a complete policy body within 387 that timeout and size limit. 389 If a valid TXT record is found but no policy can be fetched via HTTPS 390 (for any reason), and there is no valid (non-expired) previously- 391 cached policy, senders MUST continue with delivery as though the 392 domain has not implemented MTA-STS. 394 Conversely, if no "live" policy can be discovered via DNS or fetched 395 via HTTPS, but a valid (non-expired) policy exists in the sender's 396 cache, the sender MUST apply that cached policy. 398 3.4. Policy Selection for Smart Hosts and Subdomains 400 When sending mail via a "smart host"--an intermediate SMTP relay 401 rather than the message recipient's server--compliant senders MUST 402 treat the smart host domain as the policy domain for the purposes of 403 policy discovery and application. 405 When sending mail to a mailbox at a subdomain, compliant senders MUST 406 NOT attempt to fetch a policy from the parent zone. Thus for mail 407 sent to "user@mail.example.com", the policy can be fetched only from 408 "mail.example.com", not "example.com". 410 #Policy Validation 412 When sending to an MX at a domain for which the sender has a valid 413 and non-expired MTA-STS policy, a sending MTA honoring MTA-STS MUST 414 validate: 416 1. That the recipient MX supports STARTTLS and offers a valid PKIX- 417 based TLS certificate. 419 2. That at least one of the policy's "mx" patterns matches at least 420 one of the identities presented in the MX's X.509 certificate, as 421 described in "MX Certificate Validation". 423 This section does not dictate the behavior of sending MTAs when 424 policies fail to validate; in particular, validation failures of 425 policies which specify mode values of "report" or "none" MUST NOT be 426 interpreted as delivery failures, as described in Section 4, "Policy 427 Application". 429 3.5. MX Certificate Validation 431 The certificate presented by the receiving MX MUST chain to a root CA 432 that is trusted by the sending MTA and be non-expired. The 433 certificate MUST have a CN-ID ([RFC6125]) or subject alternative name 434 (SAN, [RFC5280]) with a DNS-ID matching the "mx" pattern. The MX's 435 certificate MAY also be checked for revocation via OCSP [RFC6960], 436 CRLs [RFC6818], or some other mechanism. 438 Because the "mx" patterns are not hostnames, however, matching is not 439 identical to other common cases of X.509 certificate authentication 440 (as described, for example, in [RFC6125]). Consider the example 441 policy given above, with an "mx" pattern containing ".example.com". 442 In this case, if the MX server's X.509 certificate contains a SAN 443 matching "*.example.com", we are required to implement "wildcard-to- 444 wildcard" matching. 446 To simplify this case, we impose the following constraints on 447 wildcard certificates, identical to those in [RFC7672] section 3.2.3 448 and [@?RFC6125 section 6.4.3: wildcards are valid in DNS-IDs or CN- 449 IDs, but must be the entire first label of the identifier (that is, 450 "*.example.com", not "mail*.example.com"). Senders who are comparing 451 a "suffix" MX pattern with a wildcard identifier should thus strip 452 the wildcard and ensure that the two sides match label-by-label, 453 until all labels of the shorter side (if unequal length) are 454 consumed. 456 Note that a wildcard _must_ match a label; an "mx" pattern of 457 ".example.com" thus does not match a SAN of "example.com", nor does a 458 SAN of "*.example.com" match an "mx" of "example.com". 460 A simple pseudocode implementation of this algorithm is presented in 461 the Appendix. 463 4. Policy Application 465 When sending to an MX at a domain for which the sender has a valid, 466 non-expired MTA-STS policy, a sending MTA honoring MTA-STS applies 467 the result of a policy validation failure one of two ways, depending 468 on the value of the policy "mode" field: 470 1. "enforce": In this mode, sending MTAs MUST NOT deliver the 471 message to hosts which fail MX matching or certificate 472 validation. 474 2. "report": In this mode, sending MTAs which also implement the 475 TLSRPT specification (TODO: add ref) merely send a report 476 indicating policy application failures (so long as TLSRPT is also 477 implemented by the recipient domain). 479 3. "none": In this mode, sending MTAs should treat the policy domain 480 as though it does not have any active policy; see Section 7.3, 481 "Removing MTA-STS", for use of this mode value. 483 When a message fails to deliver due to an "enforce" policy, a 484 compliant MTA MUST NOT permanently fail to deliver messages before 485 checking for the presence of an updated policy at the Policy Domain. 486 (In all cases, MTAs SHOULD treat such failures as transient errors 487 and retry delivery later.) This allows implementing domains to 488 update long-lived policies on the fly. 490 4.1. Policy Application Control Flow 492 An example control flow for a compliant sender consists of the 493 following steps: 495 1. Check for a cached policy whose time-since-fetch has not exceeded 496 its "max_age". If none exists, attempt to fetch a new policy 497 (perhaps asynchronously, so as not to block message delivery). 498 Optionally, sending MTAs may unconditionally check for a new 499 policy at this step. 501 2. For each candidate MX, in order of MX priority, attempt to 502 deliver the message, enforcing STARTTLS and, assuming a policy is 503 present, PKIX certificate validation as described in Section 3.5, 504 "MX Certificate Validation." 506 3. A message delivery MUST NOT be permanently failed until the 507 sender has first checked for the presence of a new policy (as 508 indicated by the "id" field in the "_mta-sts" TXT record). If a 509 new policy is not found, existing rules for the case of temporary 510 message delivery failures apply (as discussed in [RFC5321] 511 section 4.5.4.1). 513 5. Reporting Failures 515 MTA-STS is intended to be used along with TLSRPT (TODO: add ref) in 516 order to ensure implementing domains can detect cases of both benign 517 and malicious failures, and to ensure that failures that indicate an 518 active attack are discoverable. As such, senders who also implement 519 TLSRPT SHOULD treat the following events as reportable failures: 521 o HTTPS policy fetch failures when a valid TXT record is present. 523 o Policy fetch failures of any kind when a valid policy exists in 524 the policy cache, except if that policy's mode is "none". 526 o Delivery attempts in which a contacted MX does not support 527 STARTTLS or does not present a certificate which validates 528 according to the applied policy, except if that policy's mode is 529 "none". 531 6. Interoperability Considerations 533 6.1. SNI Support 535 To ensure that the server sends the right certificate chain, the SMTP 536 client MUST have support for the TLS SNI extension [RFC6066]. When 537 connecting to a HTTP server to retrieve the MTA-STS policy, the SNI 538 extension MUST contain the name of the policy host (e.g. "mta- 539 sts.example.com"). When connecting to an SMTP server, the SNI 540 extension MUST contain the MX hostname. 542 HTTP servers used to deliver MTA-STS policies MUST have support for 543 the TLS SNI extension and MAY rely on SNI to determine which 544 certificate chain to present to the client. In either case, HTTP 545 servers MUST respond with a certificate chain that matches the policy 546 hostname or abort the TLS handshake if unable to do so. 548 SMTP servers MUST have support for the TLS SNI extension and MAY rely 549 on SNI to determine which certificate chain to present to the client. 550 If the client sends no SNI extension or sends an SNI extension for an 551 unsupported server name, the server MUST simply send a fallback 552 certificate chain of its choice. The reason for not enforcing strict 553 matching of the requested SNI hostname is that MTA-STS TLS clients 554 may be typically willing to accept multiple server names but can only 555 send one name in the SNI extension. The server's fallback 556 certificate may match a different name that is acceptable to the 557 client, e.g., the original next-hop domain. 559 6.2. Minimum TLS Version Support 561 MTAs supporting MTA-STS MUST have support for TLS version 1.2 562 [RFC5246] or higher. The general TLS usage guidance in [RFC7525] 563 SHOULD be followed. 565 7. Operational Considerations 566 7.1. Policy Updates 568 Updating the policy requires that the owner make changes in two 569 places: the "_mta-sts" TXT record in the Policy Domain's DNS zone and 570 at the corresponding HTTPS endpoint. As a result, recipients should 571 expect a policy will continue to be used by senders until both the 572 HTTPS and TXT endpoints are updated and the TXT record's TTL has 573 passed. 575 In other words, a sender who is unable to successfully deliver a 576 message while applying a cache of the recipient's now-outdated policy 577 may be unable to discover that a new policy exists until the DNS TTL 578 has passed. Recipients should therefore ensure that old policies 579 continue to work for message delivery during this period of time, or 580 risk message delays. 582 Recipients should also prefer to update the HTTPS policy body before 583 updating the TXT record; this ordering avoids the risk that senders, 584 seeing a new TXT record, mistakenly cache the old policy from HTTPS. 586 7.2. Policy Delegation 588 Domain owners commonly delegate SMTP hosting to a different 589 organization, such as an ISP or a Web host. In such a case, they may 590 wish to also delegate the MTA-STS policy to the same organization 591 which can be accomplished with two changes. 593 First, the Policy Domain must point the "_mta-sts" record, via CNAME, 594 to the "_mta-sts" record maintained by the hosting organization. 595 This allows the hosting organization to control update signaling. 597 Second, the Policy Domain must point the "well-known" policy location 598 to the hosting organization. This can be done either by setting the 599 "mta-sts" record to a host or CNAME specified by the hosting 600 organization and by giving the hosting organization a TLS certificate 601 which is valid for that host, or by setting up a "reverse proxy" 602 (also known as a "gateway") server that serves as the Policy Domain's 603 policy the policy currently served by the hosting organization. 605 For example, given a user domain "user.com" hosted by a mail provider 606 "provider.com", the following configuration would allow policy 607 delegation: 609 DNS: 611 _mta-sts.user.com. IN CNAME _mta-sts.provider.com. 613 Policy: 615 > GET /.well-known/mta-sts.txt 616 > Host: mta-sts.user.com 617 < HTTP/1.1 200 OK # Response proxies content from https://mta-sts.provider.com 619 Note that while sending MTAs MUST NOT use HTTP caching when fetching 620 policies via HTTPS, such caching may nonetheless be useful to a 621 reverse proxy configured as described in this section. An HTTPS 622 policy endpoint expecting to be proxied for multiple hosted domains-- 623 as with a large mail hosting provider or similar--may wish to 624 indicate an HTTP Cache-Control "max-age" response directive (as 625 specified in [RFC7234]) of 60 seconds as a reasonable value to save 626 reverse proxies an unnecessarily high-rate of proxied policy 627 fetching. 629 7.3. Removing MTA-STS 631 In order to facilitate clean opt-out of MTA-STS by implementing 632 policy domains, and to distinguish clearly between failures which 633 indicate attacks and those which indicate such opt-outs, MTA-STS 634 implements the "none" mode, which allows validated policies to 635 indicate authoritatively that the policy domain wishes to no longer 636 implement MTA-STS and may, in the future, remove the MTA-STS TXT and 637 policy endpoints entirely. 639 A suggested workflow to implement such an opt out is as follows: 641 1. Publish a new policy with "mode" equal to "none" and a small 642 "max_age" (e.g. one day). 644 2. Publish a new TXT record to trigger fetching of the new policy. 646 3. When all previously served policies have expired--normally this 647 is the time the previously published policy was last served plus 648 that policy's "max_age", but note that older policies may have 649 been served with a greater "max_age", allowing overlapping policy 650 caches--safely remove the TXT record and HTTPS endpoint. 652 8. IANA Considerations 654 8.1. Well-Known URIs Registry 656 A new .well-known URI will be registered in the Well-Known URIs 657 registry as described below: 659 URI Suffix: mta-sts.txt Change Controller: IETF 661 8.2. MTA-STS TXT Record Fields 663 IANA is requested to create a new registry titled "MTA-STS TXT Record 664 Fields". The initial entries in the registry are: 666 +------------+--------------------+------------------------+ 667 | Field Name | Description | Reference | 668 +------------+--------------------+------------------------+ 669 | v | Record version | Section 3.1 of RFC XXX | 670 | id | Policy instance ID | Section 3.1 of RFC XXX | 671 +------------+--------------------+------------------------+ 673 New fields are added to this registry using IANA's "Expert Review" 674 policy. 676 8.3. MTA-STS Policy Fields 678 IANA is requested to create a new registry titled "MTA-STS Policy 679 Fields". The initial entries in the registry are: 681 +------------+----------------------+------------------------+ 682 | Field Name | Description | Reference | 683 +------------+----------------------+------------------------+ 684 | version | Policy version | Section 3.2 of RFC XXX | 685 | mode | Enforcement behavior | Section 3.2 of RFC XXX | 686 | max_age | Policy lifetime | Section 3.2 of RFC XXX | 687 | mx | MX identities | Section 3.2 of RFC XXX | 688 +------------+----------------------+------------------------+ 690 New fields are added to this registry using IANA's "Expert Review" 691 policy. 693 9. Security Considerations 695 SMTP MTA Strict Transport Security attempts to protect against an 696 active attacker who wishes to intercept or tamper with mail between 697 hosts who support STARTTLS. There are two classes of attacks 698 considered: 700 o Foiling TLS negotiation, for example by deleting the "250 701 STARTTLS" response from a server or altering TLS session 702 negotiation. This would result in the SMTP session occurring over 703 plaintext, despite both parties supporting TLS. 705 o Impersonating the destination mail server, whereby the sender 706 might deliver the message to an impostor, who could then monitor 707 and/or modify messages despite opportunistic TLS. This 708 impersonation could be accomplished by spoofing the DNS MX record 709 for the recipient domain, or by redirecting client connections 710 intended for the legitimate recipient server (for example, by 711 altering BGP routing tables). 713 MTA-STS can thwart such attacks only if the sender is able to 714 previously obtain and cache a policy for the recipient domain, and 715 only if the attacker is unable to obtain a valid certificate that 716 complies with that policy. Below, we consider specific attacks on 717 this model. 719 9.1. Obtaining a Signed Certificate 721 SMTP MTA-STS relies on certificate validation via PKIX based TLS 722 identity checking [RFC6125]. Attackers who are able to obtain a 723 valid certificate for the targeted recipient mail service (e.g. by 724 compromising a certificate authority) are thus able to circumvent STS 725 authentication. 727 9.2. Preventing Policy Discovery 729 Since MTA-STS uses DNS TXT records for policy discovery, an attacker 730 who is able to block DNS responses can suppress the discovery of an 731 MTA-STS Policy, making the Policy Domain appear not to have an MTA- 732 STS Policy. The sender policy cache is designed to resist this 733 attack by decreasing the frequency of policy discovery and thus 734 reducing the window of vulnerability; it is nonetheless a risk that 735 attackers who can predict or induce policy discovery--for example, by 736 inducing a victim sending domain to send mail to a never-before- 737 contacted recipient while carrying out a man-in-the-middle attack-- 738 may be able to foil policy discovery and effectively downgrade the 739 security of the message delivery. 741 Since this attack depends upon intercepting initial policy discovery, 742 we strongly recommend implementers to prefer policy "max_age" values 743 to be as long as is practical. 745 Because this attack is also possible upon refresh of a cached policy, 746 we suggest implementers do not wait until a cached policy has expired 747 before checking for an update; if senders attempt to refresh the 748 cache regularly (for instance, by checking their cached version 749 string against the TXT record on each successful send, or in a 750 background task that runs daily or weekly), an attacker would have to 751 foil policy discovery consistently over the lifetime of a cached 752 policy to prevent a successful refresh. 754 Additionally, MTAs should alert administrators to repeated policy 755 refresh failures long before cached policies expire (through warning 756 logs or similar applicable mechanisms), allowing administrators to 757 detect such a persistent attack on policy refresh. (However, they 758 should not implement such alerts if the cached policy has a "none" 759 mode, to allow clean MTA-STS removal, as described in Section 7.3.) 761 Resistance to downgrade attacks of this nature--due to the ability to 762 authoritatively determine "lack of a record" even for non- 763 participating recipients--is a feature of DANE, due to its use of 764 DNSSEC for policy discovery. 766 9.3. Denial of Service 768 We additionally consider the Denial of Service risk posed by an 769 attacker who can modify the DNS records for a victim domain. Absent 770 MTA-STS, such an attacker can cause a sending MTA to cache invalid MX 771 records, but only for however long the sending resolver caches those 772 records. With MTA-STS, the attacker can additionally advertise a 773 new, long-"max_age" MTA-STS policy with "mx" constraints that 774 validate the malicious MX record, causing senders to cache the policy 775 and refuse to deliver messages once the victim has resecured the MX 776 records. 778 This attack is mitigated in part by the ability of a victim domain to 779 (at any time) publish a new policy updating the cached, malicious 780 policy, though this does require the victim domain to both obtain a 781 valid CA-signed certificate and to understand and properly configure 782 MTA-STS. 784 Similarly, we consider the possibility of domains that deliberately 785 allow untrusted users to serve untrusted content on user-specified 786 subdomains. In some cases (e.g. the service Tumblr.com) this takes 787 the form of providing HTTPS hosting of user-registered subdomains; in 788 other cases (e.g. dynamic DNS providers) this takes the form of 789 allowing untrusted users to register custom DNS records at the 790 provider's domain. 792 In these cases, there is a risk that untrusted users would be able to 793 serve custom content at the "mta-sts" host, including serving an 794 illegitimate MTA-STS policy. We believe this attack is rendered more 795 difficult by the need for the attacker to also serve the "_mta-sts" 796 TXT record on the same domain--something not, to our knowledge, 797 widely provided to untrusted users. This attack is additionally 798 mitigated by the aforementioned ability for a victim domain to update 799 an invalid policy at any future date. 801 9.4. Weak Policy Constraints 803 Even if an attacker cannot modify a served policy, the potential 804 exists for configurations that allow attackers on the same domain to 805 receive mail for that domain. For example, an easy configuration 806 option when authoring an MTA-STS Policy for "example.com" is to set 807 the "mx" equal to ".example.com"; recipient domains must consider in 808 this case the risk that any user possessing a valid hostname and CA- 809 signed certificate (for example, "dhcp-123.example.com") will, from 810 the perspective of MTA-STS Policy validation, be a valid MX host for 811 that domain. 813 9.5. Compromise of the Web PKI System 815 A host of risks apply to the PKI system used for certificate 816 authentication, both of the "mta-sts" HTTPS host's certificate and 817 the SMTP servers' certificates. These risks are broadly applicable 818 within the Web PKI ecosystem and are not specific to MTA-STS; 819 nonetheless, they deserve some consideration in this context. 821 Broadly speaking, attackers may compromise the system by obtaining 822 certificates under fraudulent circumstances (i.e. by impersonating 823 the legitimate owner of the victim domain), by compromising a 824 Certificate Authority or Delegate Authority's private keys, by 825 obtaining a legitimate certificate issued to the victim domain, and 826 similar. 828 One approach commonly employed by Web browsers to help mitigate 829 against some of these attacks is to allow for revocation of 830 compromised or fraudulent certificates via OCSP [RFC6960] or CRLs 831 [RFC6818]. Such mechanisms themselves represent tradeoffs and are 832 not universally implemented; we nonetheless recommend implementors of 833 MTA-STS to implement revocation mechanisms which are most applicable 834 to their implementations. 836 10. Contributors 838 Nicolas Lidzborski Google, Inc nlidz (at) google (dot com) 840 Wei Chuang Google, Inc weihaw (at) google (dot com) 842 Brandon Long Google, Inc blong (at) google (dot com) 844 Franck Martin LinkedIn, Inc fmartin (at) linkedin (dot com) 846 Klaus Umbach 1&1 Mail & Media Development & Technology GmbH 847 klaus.umbach (at) 1und1 (dot de) 848 Markus Laber 1&1 Mail & Media Development & Technology GmbH 849 markus.laber (at) 1und1 (dot de) 851 11. Appendix 1: MTA-STS example record & policy 853 The owner of "example.com" wishes to begin using MTA-STS with a 854 policy that will solicit reports from senders without affecting how 855 the messages are processed, in order to verify the identity of MXs 856 that handle mail for "example.com", confirm that TLS is correctly 857 used, and ensure that certificates presented by the recipient MX 858 validate. 860 MTA-STS policy indicator TXT RR: 862 _mta-sts.example.com. IN TXT "v=STSv1; id=20160831085700Z;" 864 MTA-STS Policy file served as the response body at [1] 866 version: STSv1 867 mode: report 868 mx: mx1.example.com 869 mx: mx2.example.com 870 mx: mx.backup-example.com 871 max_age: 12345678 873 12. Appendix 2: Message delivery pseudocode 875 Below is pseudocode demonstrating the logic of a compliant sending 876 MTA. 878 While this pseudocode implementation suggests synchronous policy 879 retrieval in the delivery path, in a working implementation that may 880 be undesirable, and we expect some implementers to instead prefer a 881 background fetch that does not block delivery if no cached policy is 882 present. 884 func isEnforce(policy) { 885 // Return true if the policy mode is "enforce". 886 } 888 func isNonExpired(policy) { 889 // Return true if the policy is not expired. 890 } 892 func tryStartTls(connection) { 893 // Attempt to open an SMTP connection with STARTTLS with the MX. 894 } 895 func isWildcardMatch(pat, host) { 896 // Literal matches are true. 897 if pat == host { 898 return true 899 } 900 // Leading '.' matches a wildcard against the first part, i.e. 901 // .example.com matches x.example.com but not x.y.example.com. 902 if pat[0] == '.' { 903 parts = SplitN(host, '.', 2) // Split on the first '.'. 904 if len(parts) > 1 && parts[1] == pat[1:] { 905 return true 906 } 907 } 908 return false 909 } 911 func certMatches(connection, policy) { 912 // Assume a handy function to return CN and DNS-ID SANs. 913 for san in getDnsIdSansAndCnFromCert(connection) { 914 for mx in policy.mx { 915 // Return if the server certificate from "connection" matches the "mx" 916 // host. 917 if san[0] == '*' { 918 // Invalid wildcard! 919 if san[1] != '.' continue 920 san = san[1:] 921 } 922 if isWildcardMatch(san, mx) || isWildcardMatch(mx, san) { 923 return true 924 } 925 } 926 } 927 return false 928 } 930 func tryDeliverMail(connection, message) { 931 // Attempt to deliver "message" via "connection". 932 } 934 func tryGetNewPolicy(domain) { 935 // Check for an MTA-STS TXT record for "domain" in DNS, and return the 936 // indicated policy. 937 } 939 func cachePolicy(domain, policy) { 940 // Store "policy" as the cached policy for "domain". 941 } 942 func tryGetCachedPolicy(domain) { 943 // Return a cached policy for "domain". 944 } 946 func reportError(error) { 947 // Report an error via TLSRPT. 948 } 950 func tryMxAccordingTo(message, mx, policy) { 951 connection := connect(mx) 952 if !connection { 953 return false // Can't connect to the MX so it's not an MTA-STS error. 954 } 955 secure := true 956 if !tryStartTls(connection) { 957 secure = false 958 reportError(E_NO_VALID_TLS) 959 } else if !certMatches(connection, policy) { 960 secure = false 961 reportError(E_CERT_MISMATCH) 962 } 963 if secure || !isEnforce(policy) { 964 return tryDeliverMail(connection, message) 965 } 966 return false 967 } 969 func tryWithPolicy(message, domain, policy) { 970 mxes := getMxForDomain(domain) 971 for mx in mxes { 972 if tryMxAccordingTo(message, mx, policy) { 973 return true 974 } 975 } 976 return false 977 } 979 func handleMessage(message) { 980 domain := ... // domain part after '@' from recipient 981 policy := tryGetNewPolicy(domain) 982 if policy { 983 cachePolicy(domain, policy) 984 } else { 985 policy = tryGetCachedPolicy(domain) 986 } 987 if policy { 988 return tryWithPolicy(message, domain, policy) 989 } 990 // Try to deliver the message normally (i.e. without MTA-STS). 991 } 993 13. References 995 13.1. Normative References 997 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 998 Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/ 999 RFC2119, March 1997, 1000 . 1002 [RFC3492] Costello, A., "Punycode: A Bootstring encoding of Unicode 1003 for Internationalized Domain Names in Applications 1004 (IDNA)", RFC 3492, DOI 10.17487/RFC3492, March 2003, 1005 . 1007 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 1008 (TLS) Protocol Version 1.2", RFC 5246, DOI 10.17487/ 1009 RFC5246, August 2008, . 1012 [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., 1013 Housley, R., and W. Polk, "Internet X.509 Public Key 1014 Infrastructure Certificate and Certificate Revocation List 1015 (CRL) Profile", RFC 5280, DOI 10.17487/RFC5280, May 2008, 1016 . 1018 [RFC5321] Klensin, J., "Simple Mail Transfer Protocol", RFC 5321, 1019 DOI 10.17487/RFC5321, October 2008, 1020 . 1022 [RFC5785] Nottingham, M. and E. Hammer-Lahav, "Defining Well-Known 1023 Uniform Resource Identifiers (URIs)", RFC 5785, DOI 10 1024 .17487/RFC5785, April 2010, 1025 . 1027 [RFC6066] Eastlake 3rd, D., "Transport Layer Security (TLS) 1028 Extensions: Extension Definitions", RFC 6066, DOI 10 1029 .17487/RFC6066, January 2011, . 1032 [RFC6125] Saint-Andre, P. and J. Hodges, "Representation and 1033 Verification of Domain-Based Application Service Identity 1034 within Internet Public Key Infrastructure Using X.509 1035 (PKIX) Certificates in the Context of Transport Layer 1036 Security (TLS)", RFC 6125, DOI 10.17487/RFC6125, March 1037 2011, . 1039 [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 1040 Protocol (HTTP/1.1): Semantics and Content", RFC 7231, DOI 1041 10.17487/RFC7231, June 2014, . 1044 [RFC7405] Kyzivat, P., "Case-Sensitive String Support in ABNF", RFC 1045 7405, DOI 10.17487/RFC7405, December 2014, 1046 . 1048 [RFC7525] Sheffer, Y., Holz, R., and P. Saint-Andre, 1049 "Recommendations for Secure Use of Transport Layer 1050 Security (TLS) and Datagram Transport Layer Security 1051 (DTLS)", BCP 195, RFC 7525, DOI 10.17487/RFC7525, May 1052 2015, . 1054 13.2. Informative References 1056 [RFC3207] Hoffman, P., "SMTP Service Extension for Secure SMTP over 1057 Transport Layer Security", RFC 3207, DOI 10.17487/RFC3207, 1058 February 2002, . 1060 [RFC4033] Arends, R., Austein, R., Larson, M., Massey, D., and S. 1061 Rose, "DNS Security Introduction and Requirements", RFC 1062 4033, DOI 10.17487/RFC4033, March 2005, 1063 . 1065 [RFC5322] Resnick, P., Ed., "Internet Message Format", RFC 5322, DOI 1066 10.17487/RFC5322, October 2008, 1067 . 1069 [RFC5891] Klensin, J., "Internationalized Domain Names in 1070 Applications (IDNA): Protocol", RFC 5891, DOI 10.17487/ 1071 RFC5891, August 2010, 1072 . 1074 [RFC6818] Yee, P., "Updates to the Internet X.509 Public Key 1075 Infrastructure Certificate and Certificate Revocation List 1076 (CRL) Profile", RFC 6818, DOI 10.17487/RFC6818, January 1077 2013, . 1079 [RFC6960] Santesson, S., Myers, M., Ankney, R., Malpani, A., 1080 Galperin, S., and C. Adams, "X.509 Internet Public Key 1081 Infrastructure Online Certificate Status Protocol - OCSP", 1082 RFC 6960, DOI 10.17487/RFC6960, June 2013, . 1085 [RFC7234] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, 1086 Ed., "Hypertext Transfer Protocol (HTTP/1.1): Caching", 1087 RFC 7234, DOI 10.17487/RFC7234, June 2014, . 1090 [RFC7672] Dukhovni, V. and W. Hardaker, "SMTP Security via 1091 Opportunistic DNS-Based Authentication of Named Entities 1092 (DANE) Transport Layer Security (TLS)", RFC 7672, DOI 10 1093 .17487/RFC7672, October 2015, 1094 . 1096 13.3. URIs 1098 [1] https://mta-sts.example.com/.well-known/mta-sts.txt: 1100 Authors' Addresses 1102 Daniel Margolis 1103 Google, Inc 1105 Email: dmargolis (at) google.com 1107 Mark Risher 1108 Google, Inc 1110 Email: risher (at) google (dot com) 1112 Binu Ramakrishnan 1113 Yahoo!, Inc 1115 Email: rbinu (at) yahoo-inc (dot com) 1117 Alexander Brotman 1118 Comcast, Inc 1120 Email: alex_brotman (at) comcast.com 1121 Janet Jones 1122 Microsoft, Inc 1124 Email: janet.jones (at) microsoft (dot com)