idnits 2.17.1 draft-ietf-uta-mta-sts-16.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 : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year ** The document contains RFC2119-like boilerplate, but doesn't seem to mention RFC 2119. The boilerplate contains a reference [BCP 14], but that reference does not seem to mention RFC 2119 either. -- The document date (May 2, 2018) is 2186 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: 'BCP 14' is mentioned on line 125, but not defined == Missing Reference: 'CRLF' is mentioned on line 293, but not defined -- Looks like a reference, but probably isn't: '0' on line 1050 -- Looks like a reference, but probably isn't: '1' on line 1052 == Outdated reference: A later version (-23) exists of draft-ietf-uta-smtp-tlsrpt-18 ** 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 7525 (Obsoleted by RFC 9325) -- Obsolete informational reference (is this intentional?): RFC 7234 (Obsoleted by RFC 9111) Summary: 5 errors (**), 0 flaws (~~), 4 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: November 3, 2018 B. Ramakrishnan 6 Yahoo!, Inc 7 A. Brotman 8 Comcast, Inc 9 J. Jones 10 Microsoft, Inc 11 May 2, 2018 13 SMTP MTA Strict Transport Security (MTA-STS) 14 draft-ietf-uta-mta-sts-16 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 November 3, 2018. 41 Copyright Notice 43 Copyright (c) 2018 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 4. Policy Validation . . . . . . . . . . . . . . . . . . . . . . 9 67 4.1. MX Certificate Validation . . . . . . . . . . . . . . . . 10 68 5. Policy Application . . . . . . . . . . . . . . . . . . . . . 11 69 5.1. Policy Application Control Flow . . . . . . . . . . . . . 11 70 6. Reporting Failures . . . . . . . . . . . . . . . . . . . . . 12 71 7. Interoperability Considerations . . . . . . . . . . . . . . . 12 72 7.1. SNI Support . . . . . . . . . . . . . . . . . . . . . . . 12 73 7.2. Minimum TLS Version Support . . . . . . . . . . . . . . . 13 74 8. Operational Considerations . . . . . . . . . . . . . . . . . 13 75 8.1. Policy Updates . . . . . . . . . . . . . . . . . . . . . 13 76 8.2. Policy Delegation . . . . . . . . . . . . . . . . . . . . 13 77 8.3. Removing MTA-STS . . . . . . . . . . . . . . . . . . . . 14 78 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 15 79 9.1. Well-Known URIs Registry . . . . . . . . . . . . . . . . 15 80 9.2. MTA-STS TXT Record Fields . . . . . . . . . . . . . . . . 15 81 9.3. MTA-STS Policy Fields . . . . . . . . . . . . . . . . . . 15 82 10. Security Considerations . . . . . . . . . . . . . . . . . . . 16 83 10.1. Obtaining a Signed Certificate . . . . . . . . . . . . . 16 84 10.2. Preventing Policy Discovery . . . . . . . . . . . . . . 16 85 10.3. Denial of Service . . . . . . . . . . . . . . . . . . . 17 86 10.4. Weak Policy Constraints . . . . . . . . . . . . . . . . 18 87 10.5. Compromise of the Web PKI System . . . . . . . . . . . . 18 88 11. Contributors . . . . . . . . . . . . . . . . . . . . . . . . 19 89 12. References . . . . . . . . . . . . . . . . . . . . . . . . . 19 90 12.1. Normative References . . . . . . . . . . . . . . . . . . 19 91 12.2. Informative References . . . . . . . . . . . . . . . . . 20 92 Appendix A. MTA-STS example record & policy . . . . . . . . . . 21 93 Appendix B. Message delivery pseudocode . . . . . . . . . . . . 22 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", "NOT RECOMMENDED", "MAY", and 122 "OPTIONAL" in this document are to be interpreted as described in 123 [BCP 14] [RFC2119] [RFC8174] when, and only when, they appear in all 124 capitals, as shown here. 126 We also define the following terms for further use in this document: 128 o MTA-STS Policy: A commitment by the Policy Domain to support PKIX 129 [RFC5280] authenticated TLS for the specified MX hosts. 131 o Policy Domain: The domain for which an MTA-STS Policy is defined. 132 This is the next-hop domain; when sending mail to 133 "alice@example.com" this would ordinarily be "example.com", but 134 this may be overridden by explicit routing rules (as described in 135 Section 3.4, "Policy Selection for Smart Hosts and Subdomains"). 137 2. Related Technologies 139 The DANE TLSA record [RFC7672] is similar, in that DANE is also 140 designed to upgrade unauthenticated encryption or plaintext 141 transmission into authenticated, downgrade-resistant encrypted 142 transmission. DANE requires DNSSEC [RFC4033] for authentication; the 143 mechanism described here instead relies on certificate authorities 144 (CAs) and does not require DNSSEC, at a cost of risking malicious 145 downgrades. For a thorough discussion of this trade-off, see 146 Section 10, "Security Considerations". 148 In addition, MTA-STS provides an optional testing-only mode, enabling 149 soft deployments to detect policy failures; partial deployments can 150 be achieved in DANE by deploying TLSA records only for some of a 151 domain's MXs, but such a mechanism is not possible for the per-domain 152 policies used by MTA-STS. 154 The primary motivation of MTA-STS is to provide a mechanism for 155 domains to ensure transport security even when deploying DNSSEC is 156 undesirable or impractical. However, MTA-STS is designed not to 157 interfere with DANE deployments when the two overlap; in particular, 158 senders who implement MTA-STS validation MUST NOT allow a "valid" or 159 "testing"-only MTA-STS validation to override a failing DANE 160 validation. 162 3. Policy Discovery 164 MTA-STS policies are distributed via HTTPS from a "well-known" 165 [RFC5785] path served within the Policy Domain, and their presence 166 and current version are indicated by a TXT record at the Policy 167 Domain. These TXT records additionally contain a policy "id" field, 168 allowing sending MTAs to check the currency of a cached policy 169 without performing an HTTPS request. 171 To discover if a recipient domain implements MTA-STS, a sender need 172 only resolve a single TXT record. To see if an updated policy is 173 available for a domain for which the sender has a previously cached 174 policy, the sender need only check the TXT record's version "id" 175 against the cached value. 177 3.1. MTA-STS TXT Records 179 The MTA-STS TXT record is a TXT record with the name "_mta-sts" at 180 the Policy Domain. For the domain "example.com", this record would 181 be "_mta-sts.example.com". MTA-STS TXT records MUST be US-ASCII, 182 semicolon-separated key/value pairs containing the following fields: 184 o "v": (plain-text, required). Currently only "STSv1" is supported. 186 o "id": (plain-text, required). A short string used to track policy 187 updates. This string MUST uniquely identify a given instance of a 188 policy, such that senders can determine when the policy has been 189 updated by comparing to the "id" of a previously seen policy. 190 There is no implied ordering of "id" fields between revisions. 192 An example TXT record is as below: 194 "_mta-sts.example.com. IN TXT "v=STSv1; id=20160831085700Z;"" 196 The formal definition of the "_mta-sts" TXT record, defined using 197 [RFC7405], is as follows: 199 sts-text-record = sts-version 1*(field-delim sts-field) [field-delim] 201 sts-field = sts-id / ; Note that sts-id record 202 sts-extension ; is required. 204 field-delim = *WSP ";" *WSP 206 sts-version = %s"v=STSv1" 208 sts-id = %s"id=" 1*32(ALPHA / DIGIT) ; id=... 210 sts-extension = sts-ext-name "=" sts-ext-value ; name=value 212 sts-ext-name = (ALPHA / DIGIT) 213 *31(ALPHA / DIGIT / "_" / "-" / ".") 215 sts-ext-value = 1*(%x21-3A / %x3C / %x3E-7E) 216 ; chars excluding "=", ";", and control chars 218 The TXT record MUST begin with sts-version field, and the order of 219 other fields is not significant. If multiple TXT records for "_mta- 220 sts" are returned by the resolver, records which do not begin with 221 "v=STSv1;" are discarded. If the number of resulting records is not 222 one, senders MUST assume the recipient domain does not implement MTA- 223 STS and skip the remaining steps of policy discovery. If the 224 resulting TXT record contains multiple strings, then the record MUST 225 be treated as if those strings are concatenated together without 226 adding spaces. 228 3.2. MTA-STS Policies 230 The policy itself is a set of key/value pairs (similar to [RFC5322] 231 header fields) served via the HTTPS GET method from the fixed 232 [RFC5785] "well-known" path of ".well-known/mta-sts.txt" served by 233 the "mta-sts" host at the Policy Domain. Thus for "example.com" the 234 path is "https://mta-sts.example.com/.well-known/mta-sts.txt". 236 When fetching a policy, senders SHOULD validate that the media type 237 is "text/plain" to guard against cases where webservers allow 238 untrusted users to host non-text content (typically, HTML or images) 239 at a user-defined path. All parameters other charset=utf-8 or 240 charset=us-ascii are ignored. Additional "Content-Type" parameters 241 are also ignored. 243 This resource contains the following CRLF-separated key/value pairs: 245 o "version": (plain-text). Currently only "STSv1" is supported. 247 o "mode": (plain-text). One of "enforce", "testing", or "none", 248 indicating the expected behavior of a sending MTA in the case of a 249 policy validation failure. See Section 5, "Policy Application." 250 for more details about the three modes. 252 o "max_age": Max lifetime of the policy (plain-text non-negative 253 integer seconds, maximum value of 31557600). Well-behaved clients 254 SHOULD cache a policy for up to this value from last policy fetch 255 time. To mitigate the risks of attacks at policy refresh time, it 256 is expected that this value typically be in the range of weeks or 257 greater. 259 o "mx": MX identity patterns (list of plain-text strings). One or 260 more patterns matching a Common Name or Subject Alternative Name 261 ([RFC5280]) DNS-ID ([RFC6125]) present in the X.509 certificate 262 presented by any MX receiving mail for this domain. For example: 264 mx: mail.example.com 265 mx: .example.net 267 indicates that mail for this domain might be handled by any MX with a 268 certificate valid for a host at "mail.example.com" or "example.net". 269 Valid patterns can be either fully specified names ("example.com") or 270 suffixes (".example.net") matching the right-hand parts of a server's 271 identity; the latter case are distinguished by a leading period. If 272 there are more than one MX specified by the policy, they MUST be on 273 separate lines within the policy file. In the case of 274 Internationalized Domain Names ([RFC5891]), the MX MUST specify the 275 Punycode-encoded A-label [RFC3492] and not the Unicode-encoded 276 U-label. The full semantics of certificate validation are described 277 in Section 4.1, "MX Certificate Validation." 279 An example policy is as below: 281 version: STSv1 282 mode: enforce 283 mx: mail.example.com 284 mx: .example.net 285 mx: backupmx.example.com 286 max_age: 123456 288 The formal definition of the policy resource, defined using 289 [RFC7405], is as follows: 291 sts-policy-record = sts-policy-field *WSP 292 *(CRLF sts-policy-field *WSP) 293 [CRLF] 295 sts-policy-field = sts-policy-version / ; required once 296 sts-policy-mode / ; required once 297 sts-policy-max-age / ; required once 299 0*(sts-policy-mx *WSP CRLF) / 300 ; required at least once, except when 301 ; mode is "none" 303 sts-policy-extension ; other fields 305 field-delim = ":" *WSP 307 sts-policy-version = sts-policy-version-field field-delim 308 sts-policy-version-value 310 sts-policy-version-field = %s"version" 312 sts-policy-version-value = %s"STSv1" 314 sts-policy-mode = sts-policy-mode-field field-delim 315 sts-policy-mode-value 317 sts-policy-mode-field = %s"mode" 319 sts-policy-mode-value = %s"testing" / %s"enforce" / %s"none" 321 sts-policy-mx = sts-policy-mx-field field-delim 322 sts-policy-mx-value 324 sts-policy-mx-field = %s"mx" 326 sts-policy-mx-value = 1*(ALPHA / DIGIT / "_" / "-" / ".") 328 sts-policy-max-age = sts-policy-max-age-field field-delim 329 sts-policy-max-age-value 331 sts-policy-max-age-field = %s"max_age" 333 sts-policy-max-age-value = 1*10(DIGIT) 335 sts-policy-extension = sts-policy-ext-name ; additional 336 field-delim ; extension 337 sts-policy-ext-value ; fields 339 sts-policy-ext-name = (ALPHA / DIGIT) 340 *31(ALPHA / DIGIT / "_" / "-" / ".") 342 sts-policy-ext-value = 1*(%x21-3A / %x3C / %x3E-7E) 343 ; chars, excluding control chars 345 Parsers MUST accept TXT records and policy files which are 346 syntactically valid (i.e. valid key/value pairs separated by semi- 347 colons for TXT records) and but containing additional key/value pairs 348 not specified in this document, in which case unknown fields SHALL be 349 ignored. If any non-repeated field--i.e. all fields excepting "mx"-- 350 is duplicated, all entries except for the first SHALL be ignored. If 351 any field is not specified, the policy SHALL be treated as invalid. 353 3.3. HTTPS Policy Fetching 355 When fetching a new policy or updating a policy, the HTTPS endpoint 356 MUST present a X.509 certificate which is valid for the "mta-sts" 357 host (e.g. "mta-sts.example.com") as described below, chain to a 358 root CA that is trusted by the sending MTA, and be non-expired. It 359 is expected that sending MTAs use a set of trusted CAs similar to 360 those in widely deployed Web browsers and operating systems. See 361 [RFC5280] for more details about certificate verification. 363 The certificate is valid for the "mta-sts" host with respect to the 364 rules described in [RFC6125], with the following application-specific 365 considerations: 367 o Matching is performed only against the DNS-ID identifiers. 369 o DNS domain names in server certificates MAY contain the wildcard 370 character '*' as the complete left-most label within the 371 identifier. 373 The certificate MAY be checked for revocation via the Online 374 Certificate Status Protocol (OCSP) [RFC6960], certificate revocation 375 lists (CRLs), or some other mechanism. 377 Policies fetched via HTTPS are only valid if the HTTP response code 378 is 200 (OK). HTTP 3xx redirects MUST NOT be followed, and HTTP 379 caching (as specified in [RFC7234]) MUST NOT be used. 381 Senders may wish to rate-limit the frequency of attempts to fetch the 382 HTTPS endpoint even if a valid TXT record for the recipient domain 383 exists. In the case that the HTTPS GET fails, we suggest 384 implementions may limit further attempts to a period of five minutes 385 or longer per version ID, to avoid overwhelming resource-constrained 386 recipients with cascading failures. 388 Senders MAY impose a timeout on the HTTPS GET and/or a limit on the 389 maximum size of the response body to avoid long delays or resource 390 exhaustion during attempted policy updates. A suggested timeout is 391 one minute, and a suggested maximum policy size 64 kilobytes; policy 392 hosts SHOULD respond to requests with a complete policy body within 393 that timeout and size limit. 395 If a valid TXT record is found but no policy can be fetched via HTTPS 396 (for any reason), and there is no valid (non-expired) previously- 397 cached policy, senders MUST continue with delivery as though the 398 domain has not implemented MTA-STS. 400 Conversely, if no "live" policy can be discovered via DNS or fetched 401 via HTTPS, but a valid (non-expired) policy exists in the sender's 402 cache, the sender MUST apply that cached policy. 404 Finally, to mitigate the risk of persistent interference with policy 405 refresh, as discussed in-depth in Section 10, MTAs SHOULD proactively 406 refresh cached policies before they expire; a suggested refresh 407 frequency is once per day. To enable administrators to discover 408 problems with policy refresh, MTAs SHOULD alert administrators 409 (through the use of logs or similar) when such attempts fail, unless 410 the cached policy mode is "none". 412 3.4. Policy Selection for Smart Hosts and Subdomains 414 When sending mail via a "smart host"--an administratively configured 415 intermediate SMTP relay, which is different from the message 416 recipient's server as determined from DNS --compliant senders MUST 417 treat the smart host domain as the policy domain for the purposes of 418 policy discovery and application. 420 When sending mail to a mailbox at a subdomain, compliant senders MUST 421 NOT attempt to fetch a policy from the parent zone. Thus for mail 422 sent to "user@mail.example.com", the policy can be fetched only from 423 "mail.example.com", not "example.com". 425 4. Policy Validation 427 When sending to an MX at a domain for which the sender has a valid 428 and non-expired MTA-STS policy, a sending MTA honoring MTA-STS MUST 429 validate: 431 1. That the recipient MX supports STARTTLS and offers a valid PKIX- 432 based TLS certificate. 434 2. That at least one of the policy's "mx" patterns matches at least 435 one of the identities presented in the MX's X.509 certificate, as 436 described in "MX Certificate Validation". 438 This section does not dictate the behavior of sending MTAs when 439 policies fail to validate; see Section 5, "Policy Application" for a 440 description of sending MTA behavior when policy validation fails. 442 4.1. MX Certificate Validation 444 The certificate presented by the receiving MX MUST chain to a root CA 445 that is trusted by the sending MTA and be non-expired. The 446 certificate MUST have a subject alternative name (SAN, [RFC5280]) 447 with a DNS-ID ([RFC6125]) matching the "mx" pattern. The MX's 448 certificate MAY also be checked for revocation via OCSP [RFC6960], 449 CRLs [RFC6818], or some other mechanism. 451 Because the "mx" patterns are not hostnames, however, matching is not 452 identical to other common cases of X.509 certificate authentication 453 (as described, for example, in [RFC6125]). Consider the example 454 policy given above, with an "mx" pattern containing ".example.com". 455 In this case, if the MX server's X.509 certificate contains a SAN 456 matching "*.example.com", we are required to implement "wildcard-to- 457 wildcard" matching. 459 To simplify this case, we impose the following constraints on 460 wildcard certificates, identical to those in [RFC7672] section 3.2.3 461 and [RFC6125] section 6.4.3: wildcards are valid in DNS-IDs, but must 462 be the entire first label of the identifier (that is, 463 "*.example.com", not "mail*.example.com"). Senders who are comparing 464 a "suffix" MX pattern with a wildcard identifier should thus strip 465 the wildcard and ensure that the two sides match label-by-label, 466 until all labels of the shorter side (if unequal length) are 467 consumed. 469 Note that a wildcard must match a label; an "mx" pattern of 470 ".example.com" thus does not match a SAN of "example.com", nor does a 471 SAN of "*.example.com" match an "mx" of "example.com". 473 A simple pseudocode implementation of this algorithm is presented in 474 Appendix B. 476 5. Policy Application 478 When sending to an MX at a domain for which the sender has a valid, 479 non-expired MTA-STS policy, a sending MTA honoring MTA-STS applies 480 the result of a policy validation failure one of two ways, depending 481 on the value of the policy "mode" field: 483 1. "enforce": In this mode, sending MTAs MUST NOT deliver the 484 message to hosts which fail MX matching or certificate 485 validation. 487 2. "testing": In this mode, sending MTAs which also implement the 488 TLSRPT specification [I-D.ietf-uta-smtp-tlsrpt] merely send a 489 report indicating policy application failures (so long as TLSRPT 490 is also implemented by the recipient domain). 492 3. "none": In this mode, sending MTAs should treat the policy domain 493 as though it does not have any active policy; see Section 8.3, 494 "Removing MTA-STS", for use of this mode value. 496 When a message fails to deliver due to an "enforce" policy, a 497 compliant MTA MUST NOT permanently fail to deliver messages before 498 checking for the presence of an updated policy at the Policy Domain. 499 (In all cases, MTAs SHOULD treat such failures as transient errors 500 and retry delivery later.) This allows implementing domains to 501 update long-lived policies on the fly. 503 5.1. Policy Application Control Flow 505 An example control flow for a compliant sender consists of the 506 following steps: 508 1. Check for a cached policy whose time-since-fetch has not exceeded 509 its "max_age". If none exists, attempt to fetch a new policy 510 (perhaps asynchronously, so as not to block message delivery). 511 Optionally, sending MTAs may unconditionally check for a new 512 policy at this step. 514 2. For each candidate MX, in order of MX priority, attempt to 515 deliver the message, enforcing STARTTLS and, assuming a policy is 516 present, PKIX certificate validation as described in Section 4.1, 517 "MX Certificate Validation." 519 3. A message delivery MUST NOT be permanently failed until the 520 sender has first checked for the presence of a new policy (as 521 indicated by the "id" field in the "_mta-sts" TXT record). If a 522 new policy is not found, existing rules for the case of temporary 523 message delivery failures apply (as discussed in [RFC5321] 524 section 4.5.4.1). 526 6. Reporting Failures 528 MTA-STS is intended to be used along with TLSRPT 529 [I-D.ietf-uta-smtp-tlsrpt] in order to ensure implementing domains 530 can detect cases of both benign and malicious failures, and to ensure 531 that failures that indicate an active attack are discoverable. As 532 such, senders who also implement TLSRPT SHOULD treat the following 533 events as reportable failures: 535 o HTTPS policy fetch failures when a valid TXT record is present. 537 o Policy fetch failures of any kind when a valid policy exists in 538 the policy cache, except if that policy's mode is "none". 540 o Delivery attempts in which a contacted MX does not support 541 STARTTLS or does not present a certificate which validates 542 according to the applied policy, except if that policy's mode is 543 "none". 545 7. Interoperability Considerations 547 7.1. SNI Support 549 To ensure that the server sends the right certificate chain, the SMTP 550 client MUST have support for the TLS SNI extension [RFC6066]. When 551 connecting to a HTTP server to retrieve the MTA-STS policy, the SNI 552 extension MUST contain the name of the policy host (e.g. "mta- 553 sts.example.com"). When connecting to an SMTP server, the SNI 554 extension MUST contain the MX hostname. 556 HTTP servers used to deliver MTA-STS policies MAY rely on SNI to 557 determine which certificate chain to present to the client. HTTP 558 servers MUST respond with a certificate chain that matches the policy 559 hostname or abort the TLS handshake if unable to do so. Clients that 560 do not send SNI information may not see the expected certificate 561 chain. 563 SMTP servers MAY rely on SNI to determine which certificate chain to 564 present to the client. However servers that have one identity and a 565 single matching certificate do not require SNI support. Servers MUST 566 NOT enforce the use of SNI by clients, as the client may be using 567 unauthenticated opportunistic TLS and may not expect any particular 568 certificate from the server. If the client sends no SNI extension or 569 sends an SNI extension for an unsupported server name, the server 570 MUST simply send a fallback certificate chain of its choice. The 571 reason for not enforcing strict matching of the requested SNI 572 hostname is that MTA-STS TLS clients may be typically willing to 573 accept multiple server names but can only send one name in the SNI 574 extension. The server's fallback certificate may match a different 575 name that is acceptable to the client, e.g., the original next-hop 576 domain. 578 7.2. Minimum TLS Version Support 580 MTAs supporting MTA-STS MUST have support for TLS version 1.2 581 [RFC5246] or higher. The general TLS usage guidance in [RFC7525] 582 SHOULD be followed. 584 8. Operational Considerations 586 8.1. Policy Updates 588 Updating the policy requires that the owner make changes in two 589 places: the "_mta-sts" TXT record in the Policy Domain's DNS zone and 590 at the corresponding HTTPS endpoint. As a result, recipients should 591 expect a policy will continue to be used by senders until both the 592 HTTPS and TXT endpoints are updated and the TXT record's TTL has 593 passed. 595 In other words, a sender who is unable to successfully deliver a 596 message while applying a cache of the recipient's now-outdated policy 597 may be unable to discover that a new policy exists until the DNS TTL 598 has passed. Recipients should therefore ensure that old policies 599 continue to work for message delivery during this period of time, or 600 risk message delays. 602 Recipients should also prefer to update the HTTPS policy body before 603 updating the TXT record; this ordering avoids the risk that senders, 604 seeing a new TXT record, mistakenly cache the old policy from HTTPS. 606 8.2. Policy Delegation 608 Domain owners commonly delegate SMTP hosting to a different 609 organization, such as an ISP or a Web host. In such a case, they may 610 wish to also delegate the MTA-STS policy to the same organization 611 which can be accomplished with two changes. 613 First, the Policy Domain must point the "_mta-sts" record, via CNAME, 614 to the "_mta-sts" record maintained by the hosting organization. 615 This allows the hosting organization to control update signaling. 617 Second, the Policy Domain must point the "well-known" policy location 618 to the hosting organization. This can be done either by setting the 619 "mta-sts" record to an IP address or CNAME specified by the hosting 620 organization and by giving the hosting organization a TLS certificate 621 which is valid for that host, or by setting up a "reverse proxy" 622 (also known as a "gateway") server that serves as the Policy Domain's 623 policy the policy currently served by the hosting organization. 625 For example, given a user domain "user.example" hosted by a mail 626 provider "provider.example", the following configuration would allow 627 policy delegation: 629 DNS: 631 _mta-sts.user.example. IN CNAME _mta-sts.provider.example. 633 Policy: 635 > GET /.well-known/mta-sts.txt 636 > Host: mta-sts.user.example 637 < HTTP/1.1 200 OK # Response proxies content from 638 # https://mta-sts.provider.example 640 Note that while sending MTAs MUST NOT use HTTP caching when fetching 641 policies via HTTPS, such caching may nonetheless be useful to a 642 reverse proxy configured as described in this section. An HTTPS 643 policy endpoint expecting to be proxied for multiple hosted domains-- 644 as with a large mail hosting provider or similar--may wish to 645 indicate an HTTP Cache-Control "max-age" response directive (as 646 specified in [RFC7234]) of 60 seconds as a reasonable value to save 647 reverse proxies an unnecessarily high-rate of proxied policy 648 fetching. 650 8.3. Removing MTA-STS 652 In order to facilitate clean opt-out of MTA-STS by implementing 653 policy domains, and to distinguish clearly between failures which 654 indicate attacks and those which indicate such opt-outs, MTA-STS 655 implements the "none" mode, which allows validated policies to 656 indicate authoritatively that the policy domain wishes to no longer 657 implement MTA-STS and may, in the future, remove the MTA-STS TXT and 658 policy endpoints entirely. 660 A suggested workflow to implement such an opt out is as follows: 662 1. Publish a new policy with "mode" equal to "none" and a small 663 "max_age" (e.g. one day). 665 2. Publish a new TXT record to trigger fetching of the new policy. 667 3. When all previously served policies have expired--normally this 668 is the time the previously published policy was last served plus 669 that policy's "max_age", but note that older policies may have 670 been served with a greater "max_age", allowing overlapping policy 671 caches--safely remove the TXT record and HTTPS endpoint. 673 9. IANA Considerations 675 9.1. Well-Known URIs Registry 677 A new "well-known" URI as described in Section 3 will be registered 678 in the Well-Known URIs registry as described below: 680 URI Suffix: mta-sts.txt Change Controller: IETF 682 9.2. MTA-STS TXT Record Fields 684 IANA is requested to create a new registry titled "MTA-STS TXT Record 685 Fields". The initial entries in the registry are: 687 +------------+--------------------+------------------------+ 688 | Field Name | Description | Reference | 689 +------------+--------------------+------------------------+ 690 | v | Record version | Section 3.1 of RFC XXX | 691 | id | Policy instance ID | Section 3.1 of RFC XXX | 692 +------------+--------------------+------------------------+ 694 New fields are added to this registry using IANA's "Expert Review" 695 policy. 697 9.3. MTA-STS Policy Fields 699 IANA is requested to create a new registry titled "MTA-STS Policy 700 Fields". The initial entries in the registry are: 702 +------------+----------------------+------------------------+ 703 | Field Name | Description | Reference | 704 +------------+----------------------+------------------------+ 705 | version | Policy version | Section 3.2 of RFC XXX | 706 | mode | Enforcement behavior | Section 3.2 of RFC XXX | 707 | max_age | Policy lifetime | Section 3.2 of RFC XXX | 708 | mx | MX identities | Section 3.2 of RFC XXX | 709 +------------+----------------------+------------------------+ 711 New fields are added to this registry using IANA's "Expert Review" 712 policy. 714 10. Security Considerations 716 SMTP MTA Strict Transport Security attempts to protect against an 717 active attacker who wishes to intercept or tamper with mail between 718 hosts who support STARTTLS. There are two classes of attacks 719 considered: 721 o Foiling TLS negotiation, for example by deleting the "250 722 STARTTLS" response from a server or altering TLS session 723 negotiation. This would result in the SMTP session occurring over 724 plaintext, despite both parties supporting TLS. 726 o Impersonating the destination mail server, whereby the sender 727 might deliver the message to an impostor, who could then monitor 728 and/or modify messages despite opportunistic TLS. This 729 impersonation could be accomplished by spoofing the DNS MX record 730 for the recipient domain, or by redirecting client connections 731 intended for the legitimate recipient server (for example, by 732 altering BGP routing tables). 734 MTA-STS can thwart such attacks only if the sender is able to 735 previously obtain and cache a policy for the recipient domain, and 736 only if the attacker is unable to obtain a valid certificate that 737 complies with that policy. Below, we consider specific attacks on 738 this model. 740 10.1. Obtaining a Signed Certificate 742 SMTP MTA-STS relies on certificate validation via PKIX based TLS 743 identity checking [RFC6125]. Attackers who are able to obtain a 744 valid certificate for the targeted recipient mail service (e.g. by 745 compromising a certificate authority) are thus able to circumvent STS 746 authentication. 748 10.2. Preventing Policy Discovery 750 Since MTA-STS uses DNS TXT records for policy discovery, an attacker 751 who is able to block DNS responses can suppress the discovery of an 752 MTA-STS Policy, making the Policy Domain appear not to have an MTA- 753 STS Policy. The sender policy cache is designed to resist this 754 attack by decreasing the frequency of policy discovery and thus 755 reducing the window of vulnerability; it is nonetheless a risk that 756 attackers who can predict or induce policy discovery--for example, by 757 inducing a sending domain to send mail to a never-before-contacted 758 recipient while carrying out a man-in-the-middle attack--may be able 759 to foil policy discovery and effectively downgrade the security of 760 the message delivery. 762 Since this attack depends upon intercepting initial policy discovery, 763 we strongly recommend implementers to prefer policy "max_age" values 764 to be as long as is practical. 766 Because this attack is also possible upon refresh of a cached policy, 767 we suggest implementers do not wait until a cached policy has expired 768 before checking for an update; if senders attempt to refresh the 769 cache regularly (for instance, by checking their cached version 770 string against the TXT record on each successful send, or in a 771 background task that runs daily or weekly), an attacker would have to 772 foil policy discovery consistently over the lifetime of a cached 773 policy to prevent a successful refresh. 775 Additionally, MTAs should alert administrators to repeated policy 776 refresh failures long before cached policies expire (through warning 777 logs or similar applicable mechanisms), allowing administrators to 778 detect such a persistent attack on policy refresh. (However, they 779 should not implement such alerts if the cached policy has a "none" 780 mode, to allow clean MTA-STS removal, as described in Section 8.3.) 782 Resistance to downgrade attacks of this nature--due to the ability to 783 authoritatively determine "lack of a record" even for non- 784 participating recipients--is a feature of DANE, due to its use of 785 DNSSEC for policy discovery. 787 10.3. Denial of Service 789 We additionally consider the Denial of Service risk posed by an 790 attacker who can modify the DNS records for a recipient domain. 791 Absent MTA-STS, such an attacker can cause a sending MTA to cache 792 invalid MX records, but only for however long the sending resolver 793 caches those records. With MTA-STS, the attacker can additionally 794 advertise a new, long-"max_age" MTA-STS policy with "mx" constraints 795 that validate the malicious MX record, causing senders to cache the 796 policy and refuse to deliver messages once the victim has resecured 797 the MX records. 799 This attack is mitigated in part by the ability of a victim domain to 800 (at any time) publish a new policy updating the cached, malicious 801 policy, though this does require the victim domain to both obtain a 802 valid CA-signed certificate and to understand and properly configure 803 MTA-STS. 805 Similarly, we consider the possibility of domains that deliberately 806 allow untrusted users to serve untrusted content on user-specified 807 subdomains. In some cases (e.g. the service Tumblr.com) this takes 808 the form of providing HTTPS hosting of user-registered subdomains; in 809 other cases (e.g. dynamic DNS providers) this takes the form of 810 allowing untrusted users to register custom DNS records at the 811 provider's domain. 813 In these cases, there is a risk that untrusted users would be able to 814 serve custom content at the "mta-sts" host, including serving an 815 illegitimate MTA-STS policy. We believe this attack is rendered more 816 difficult by the need for the attacker to also serve the "_mta-sts" 817 TXT record on the same domain--something not, to our knowledge, 818 widely provided to untrusted users. This attack is additionally 819 mitigated by the aforementioned ability for a victim domain to update 820 an invalid policy at any future date. 822 10.4. Weak Policy Constraints 824 Even if an attacker cannot modify a served policy, the potential 825 exists for configurations that allow attackers on the same domain to 826 receive mail for that domain. For example, an easy configuration 827 option when authoring an MTA-STS Policy for "example.com" is to set 828 the "mx" equal to ".example.com"; recipient domains must consider in 829 this case the risk that any user possessing a valid hostname and CA- 830 signed certificate (for example, "dhcp-123.example.com") will, from 831 the perspective of MTA-STS Policy validation, be a valid MX host for 832 that domain. 834 10.5. Compromise of the Web PKI System 836 A host of risks apply to the PKI system used for certificate 837 authentication, both of the "mta-sts" HTTPS host's certificate and 838 the SMTP servers' certificates. These risks are broadly applicable 839 within the Web PKI ecosystem and are not specific to MTA-STS; 840 nonetheless, they deserve some consideration in this context. 842 Broadly speaking, attackers may compromise the system by obtaining 843 certificates under fraudulent circumstances (i.e. by impersonating 844 the legitimate owner of the victim domain), by compromising a 845 Certificate Authority or Delegate Authority's private keys, by 846 obtaining a legitimate certificate issued to the victim domain, and 847 similar. 849 One approach commonly employed by Web browsers to help mitigate 850 against some of these attacks is to allow for revocation of 851 compromised or fraudulent certificates via OCSP [RFC6960] or CRLs 852 [RFC6818]. Such mechanisms themselves represent tradeoffs and are 853 not universally implemented; we nonetheless recommend implementors of 854 MTA-STS to implement revocation mechanisms which are most applicable 855 to their implementations. 857 11. Contributors 859 Wei Chuang Google, Inc weihaw (at) google (dot com) 861 Viktor Dukhovni ietf-dane (at) dukhovni (dot org) 863 Markus Laber 1&1 Mail & Media Development & Technology GmbH 864 markus.laber (at) 1und1 (dot de) 866 Nicolas Lidzborski Google, Inc nlidz (at) google (dot com) 868 Brandon Long Google, Inc blong (at) google (dot com) 870 Franck Martin LinkedIn, Inc fmartin (at) linkedin (dot com) 872 Klaus Umbach 1&1 Mail & Media Development & Technology GmbH 873 klaus.umbach (at) 1und1 (dot de) 875 12. References 877 12.1. Normative References 879 [I-D.ietf-uta-smtp-tlsrpt] 880 Margolis, D., Brotman, A., Ramakrishnan, B., Jones, J., 881 and M. Risher, "SMTP TLS Reporting", draft-ietf-uta-smtp- 882 tlsrpt-18 (work in progress), April 2018. 884 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 885 Requirement Levels", BCP 14, RFC 2119, 886 DOI 10.17487/RFC2119, March 1997, . 889 [RFC3207] Hoffman, P., "SMTP Service Extension for Secure SMTP over 890 Transport Layer Security", RFC 3207, DOI 10.17487/RFC3207, 891 February 2002, . 893 [RFC3492] Costello, A., "Punycode: A Bootstring encoding of Unicode 894 for Internationalized Domain Names in Applications 895 (IDNA)", RFC 3492, DOI 10.17487/RFC3492, March 2003, 896 . 898 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 899 (TLS) Protocol Version 1.2", RFC 5246, 900 DOI 10.17487/RFC5246, August 2008, . 903 [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., 904 Housley, R., and W. Polk, "Internet X.509 Public Key 905 Infrastructure Certificate and Certificate Revocation List 906 (CRL) Profile", RFC 5280, DOI 10.17487/RFC5280, May 2008, 907 . 909 [RFC5321] Klensin, J., "Simple Mail Transfer Protocol", RFC 5321, 910 DOI 10.17487/RFC5321, October 2008, . 913 [RFC5785] Nottingham, M. and E. Hammer-Lahav, "Defining Well-Known 914 Uniform Resource Identifiers (URIs)", RFC 5785, 915 DOI 10.17487/RFC5785, April 2010, . 918 [RFC6066] Eastlake 3rd, D., "Transport Layer Security (TLS) 919 Extensions: Extension Definitions", RFC 6066, 920 DOI 10.17487/RFC6066, January 2011, . 923 [RFC6125] Saint-Andre, P. and J. Hodges, "Representation and 924 Verification of Domain-Based Application Service Identity 925 within Internet Public Key Infrastructure Using X.509 926 (PKIX) Certificates in the Context of Transport Layer 927 Security (TLS)", RFC 6125, DOI 10.17487/RFC6125, March 928 2011, . 930 [RFC7405] Kyzivat, P., "Case-Sensitive String Support in ABNF", 931 RFC 7405, DOI 10.17487/RFC7405, December 2014, 932 . 934 [RFC7525] Sheffer, Y., Holz, R., and P. Saint-Andre, 935 "Recommendations for Secure Use of Transport Layer 936 Security (TLS) and Datagram Transport Layer Security 937 (DTLS)", BCP 195, RFC 7525, DOI 10.17487/RFC7525, May 938 2015, . 940 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 941 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 942 May 2017, . 944 12.2. Informative References 946 [RFC4033] Arends, R., Austein, R., Larson, M., Massey, D., and S. 947 Rose, "DNS Security Introduction and Requirements", 948 RFC 4033, DOI 10.17487/RFC4033, March 2005, 949 . 951 [RFC5322] Resnick, P., Ed., "Internet Message Format", RFC 5322, 952 DOI 10.17487/RFC5322, October 2008, . 955 [RFC5891] Klensin, J., "Internationalized Domain Names in 956 Applications (IDNA): Protocol", RFC 5891, 957 DOI 10.17487/RFC5891, August 2010, . 960 [RFC6818] Yee, P., "Updates to the Internet X.509 Public Key 961 Infrastructure Certificate and Certificate Revocation List 962 (CRL) Profile", RFC 6818, DOI 10.17487/RFC6818, January 963 2013, . 965 [RFC6960] Santesson, S., Myers, M., Ankney, R., Malpani, A., 966 Galperin, S., and C. Adams, "X.509 Internet Public Key 967 Infrastructure Online Certificate Status Protocol - OCSP", 968 RFC 6960, DOI 10.17487/RFC6960, June 2013, 969 . 971 [RFC7234] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, 972 Ed., "Hypertext Transfer Protocol (HTTP/1.1): Caching", 973 RFC 7234, DOI 10.17487/RFC7234, June 2014, 974 . 976 [RFC7672] Dukhovni, V. and W. Hardaker, "SMTP Security via 977 Opportunistic DNS-Based Authentication of Named Entities 978 (DANE) Transport Layer Security (TLS)", RFC 7672, 979 DOI 10.17487/RFC7672, October 2015, . 982 Appendix A. MTA-STS example record & policy 984 The owner of "example.com" wishes to begin using MTA-STS with a 985 policy that will solicit reports from senders without affecting how 986 the messages are processed, in order to verify the identity of MXs 987 that handle mail for "example.com", confirm that TLS is correctly 988 used, and ensure that certificates presented by the recipient MX 989 validate. 991 MTA-STS policy indicator TXT RR: 993 _mta-sts.example.com. IN TXT "v=STSv1; id=20160831085700Z;" 995 MTA-STS Policy file served as the response body at "https://mta- 996 sts.example.com/.well-known/mta-sts.txt": 998 version: STSv1 999 mode: testing 1000 mx: mx1.example.com 1001 mx: mx2.example.com 1002 mx: mx.backup-example.com 1003 max_age: 12345678 1005 Appendix B. Message delivery pseudocode 1007 Below is pseudocode demonstrating the logic of a compliant sending 1008 MTA. 1010 While this pseudocode implementation suggests synchronous policy 1011 retrieval in the delivery path, in a working implementation that may 1012 be undesirable, and we expect some implementers to instead prefer a 1013 background fetch that does not block delivery if no cached policy is 1014 present. 1016 func isEnforce(policy) { 1017 // Return true if the policy mode is "enforce". 1018 } 1020 func isNonExpired(policy) { 1021 // Return true if the policy is not expired. 1022 } 1024 func tryStartTls(connection) { 1025 // Attempt to open an SMTP connection with STARTTLS with the MX. 1026 } 1028 func isWildcardMatch(pat, host) { 1029 // Literal matches are true. 1030 if pat == host { 1031 return true 1032 } 1033 // Leading '.' matches a wildcard against the first part, i.e. 1034 // .example.com matches x.example.com but not x.y.example.com. 1035 if pat[0] == '.' { 1036 parts = SplitN(host, '.', 2) // Split on the first '.'. 1037 if len(parts) > 1 && parts[1] == pat[1:] { 1038 return true 1039 } 1040 } 1041 return false 1042 } 1044 func certMatches(connection, policy) { 1045 // Assume a handy function to return DNS-ID SANs. 1046 for san in getDnsIdSansFromCert(connection) { 1047 for mx in policy.mx { 1048 // Return if the server certificate from "connection" matches the 1049 // "mx" host. 1050 if san[0] == '*' { 1051 // Invalid wildcard! 1052 if san[1] != '.' continue 1053 san = san[1:] 1054 } 1055 if isWildcardMatch(san, mx) || isWildcardMatch(mx, san) { 1056 return true 1057 } 1058 } 1059 } 1060 return false 1061 } 1063 func tryDeliverMail(connection, message) { 1064 // Attempt to deliver "message" via "connection". 1065 } 1067 func tryGetNewPolicy(domain) { 1068 // Check for an MTA-STS TXT record for "domain" in DNS, and return the 1069 // indicated policy. 1070 } 1072 func cachePolicy(domain, policy) { 1073 // Store "policy" as the cached policy for "domain". 1074 } 1076 func tryGetCachedPolicy(domain) { 1077 // Return a cached policy for "domain". 1078 } 1080 func reportError(error) { 1081 // Report an error via TLSRPT. 1082 } 1084 func tryMxAccordingTo(message, mx, policy) { 1085 connection := connect(mx) 1086 if !connection { 1087 return false // Can't connect to the MX so it's not an MTA-STS 1088 // error. 1089 } 1090 secure := true 1091 if !tryStartTls(connection) { 1092 secure = false 1093 reportError(E_NO_VALID_TLS) 1094 } else if !certMatches(connection, policy) { 1095 secure = false 1096 reportError(E_CERT_MISMATCH) 1097 } 1098 if secure || !isEnforce(policy) { 1099 return tryDeliverMail(connection, message) 1100 } 1101 return false 1102 } 1104 func tryWithPolicy(message, domain, policy) { 1105 mxes := getMxForDomain(domain) 1106 for mx in mxes { 1107 if tryMxAccordingTo(message, mx, policy) { 1108 return true 1109 } 1110 } 1111 return false 1112 } 1114 func handleMessage(message) { 1115 domain := ... // domain part after '@' from recipient 1116 policy := tryGetNewPolicy(domain) 1117 if policy { 1118 cachePolicy(domain, policy) 1119 } else { 1120 policy = tryGetCachedPolicy(domain) 1121 } 1122 if policy { 1123 return tryWithPolicy(message, domain, policy) 1124 } 1125 // Try to deliver the message normally (i.e. without MTA-STS). 1126 } 1128 Authors' Addresses 1130 Daniel Margolis 1131 Google, Inc 1133 Email: dmargolis (at) google (dot com) 1135 Mark Risher 1136 Google, Inc 1138 Email: risher (at) google (dot com) 1139 Binu Ramakrishnan 1140 Yahoo!, Inc 1142 Email: rbinu (at) yahoo-inc (dot com) 1144 Alexander Brotman 1145 Comcast, Inc 1147 Email: alex_brotman (at) comcast (dot com) 1149 Janet Jones 1150 Microsoft, Inc 1152 Email: janet.jones (at) microsoft (dot com)