idnits 2.17.1 draft-ietf-uta-mta-sts-14.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 date (January 16, 2018) is 2263 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 288, but not defined -- Looks like a reference, but probably isn't: '0' on line 1037 -- Looks like a reference, but probably isn't: '1' on line 1039 == Outdated reference: A later version (-23) exists of draft-ietf-uta-smtp-tlsrpt-13 ** 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: 5 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: July 20, 2018 B. Ramakrishnan 6 Yahoo!, Inc 7 A. Brotman 8 Comcast, Inc 9 J. Jones 10 Microsoft, Inc 11 January 16, 2018 13 SMTP MTA Strict Transport Security (MTA-STS) 14 draft-ietf-uta-mta-sts-14 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 https://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 July 20, 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 (https://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 . . . . . . . . . . . . . . . . . . . . . 10 69 5.1. Policy Application Control Flow . . . . . . . . . . . . . 11 70 6. Reporting Failures . . . . . . . . . . . . . . . . . . . . . 11 71 7. Interoperability Considerations . . . . . . . . . . . . . . . 12 72 7.1. SNI Support . . . . . . . . . . . . . . . . . . . . . . . 12 73 7.2. Minimum TLS Version Support . . . . . . . . . . . . . . . 12 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 . . . . . . . . . . . . . . . . . . . . . 14 79 9.1. Well-Known URIs Registry . . . . . . . . . . . . . . . . 14 80 9.2. MTA-STS TXT Record Fields . . . . . . . . . . . . . . . . 15 81 9.3. MTA-STS Policy Fields . . . . . . . . . . . . . . . . . . 15 82 10. Security Considerations . . . . . . . . . . . . . . . . . . . 15 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 . . . . . . . . . . . . . . . . . . . . . . . . 18 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 . . . . . . . . . . . . 21 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 10, "Security Considerations". 146 In addition, MTA-STS provides an optional testing-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 ensure transport security even when deploying DNSSEC is 154 undesirable or impractical. However, MTA-STS is designed not to 155 interfere with DANE deployments when the two overlap; in particular, 156 senders who implement MTA-STS validation MUST NOT allow a "valid" or 157 "testing"-only MTA-STS validation to override a failing DANE 158 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) 211 *31(ALPHA / DIGIT / "_" / "-" / ".") 213 sts-ext-value = 1*(%x21-3A / %x3C / %x3E-7E) 214 ; chars excluding "=", ";", SP, and control 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 newline-separated key/value 240 pairs: 242 o "version": (plain-text). Currently only "STSv1" is supported. 244 o "mode": (plain-text). One of "enforce", "testing", or "none", 245 indicating the expected behavior of a sending MTA in the case of a 246 policy validation failure. 248 o "max_age": Max lifetime of the policy (plain-text non-negative 249 integer seconds, maximum value of 31557600). Well-behaved clients 250 SHOULD cache a policy for up to this value from last policy fetch 251 time. To mitigate the risks of attacks at policy refresh time, it 252 is expected that this value typically be in the range of weeks or 253 greater. 255 o "mx": MX identity patterns (list of plain-text strings). One or 256 more patterns matching a Common Name ([RFC6125]) or Subject 257 Alternative Name ([RFC5280]) DNS-ID present in the X.509 258 certificate presented by any MX receiving mail for this domain. 259 For example: "mx: mail.example.com mx: .example.net" indicates 260 that mail for this domain might be handled by any MX with a 261 certificate valid for a host at "mail.example.com" or 262 "example.net". Valid patterns can be either fully specified names 263 ("example.com") or suffixes (".example.net") matching the right- 264 hand parts of a server's identity; the latter case are 265 distinguished by a leading period. If there are more than one MX 266 specified by the policy, they MUST be on separate lines within the 267 policy file. In the case of Internationalized Domain Names 268 ([RFC5891]), the MX MUST specify the Punycode-encoded A-label 269 [RFC3492] and not the Unicode-encoded U-label. The full semantics 270 of certificate validation are described in Section 4.1, "MX 271 Certificate Validation." 273 An example policy is as below: 275 version: STSv1 276 mode: enforce 277 mx: mail.example.com 278 mx: .example.net 279 mx: backupmx.example.com 280 max_age: 123456 282 The formal definition of the policy resource, defined using 283 [RFC7405], is as follows: 285 sts-policy-record = *WSP sts-policy-field *WSP 286 *(CRLF *WSP sts-policy-field *WSP) 288 [CRLF] 290 sts-policy-field = sts-policy-version / ; required once 291 sts-policy-mode / ; required once 292 sts-policy-max-age / ; required once 294 0*(sts-policy-mx *WSP CRLF) / 295 ; required at least once, except when 296 ; mode is "none" 298 sts-policy-extension ; other fields 300 field-delim = ":" *WSP 302 sts-policy-version = sts-policy-version-field field-delim 303 sts-policy-version-value 305 sts-policy-version-field = %s"version" 307 sts-policy-version-value = %s"STSv1" 309 sts-policy-mode = sts-policy-mode-field field-delim 310 sts-policy-mode-value 312 sts-policy-mode-field = %s"mode" 314 sts-policy-model-value = %s"testing" / %s"enforce" / %s"none" 316 sts-policy-mx = sts-policy-mx-field field-delim 317 sts-policy-mx-value 319 sts-policy-mx-field = %s"mx" 321 sts-policy-mx-value = 1*(ALPHA / DIGIT / "_" / "-" / ".") 323 sts-policy-max-age = sts-policy-max-age-field field-delim 324 sts-policy-max-age-value 326 sts-policy-max-age-field = %s"max_age" 328 sts-policy-max-age-value = 1*10(DIGIT) 330 sts-policy-extension = sts-policy-ext-name ; additional 331 field-delim ; extension 332 sts-policy-ext-value ; fields 334 sts-policy-ext-name = (ALPHA / DIGIT) 335 *31(ALPHA / DIGIT / "_" / "-" / ".") 337 sts-policy-ext-value = 1*(%x21-3A / %x3C / %x3E-7E) 338 ; chars, excluding "=", ";", SP, and 339 ; control chars 341 Parsers MUST accept TXT records and policy files which are 342 syntactically valid (i.e. valid key/value pairs separated by semi- 343 colons for TXT records) and but containing additional key/value pairs 344 not specified in this document, in which case unknown fields SHALL be 345 ignored. If any non-repeated field--i.e. all fields excepting "mx"-- 346 is duplicated, all entries except for the first SHALL be ignored. If 347 any field is not specified, the policy SHALL be treated as invalid. 349 3.3. HTTPS Policy Fetching 351 When fetching a new policy or updating a policy, the HTTPS endpoint 352 MUST present a X.509 certificate which is valid for the "mta-sts" 353 host (e.g. "mta-sts.example.com") as described below, chain to a 354 root CA that is trusted by the sending MTA, and be non-expired. It 355 is expected that sending MTAs use a set of trusted CAs similar to 356 those in widely deployed Web browsers and operating systems. 358 The certificate is valid for the "mta-sts" host with respect to the 359 rules described in [RFC6125], with the following application-specific 360 considerations: 362 o Matching is performed only against the DNS-ID identifiers. 364 o DNS domain names in server certificates MAY contain the wildcard 365 character '*' as the complete left-most label within the 366 identifier. 368 The certificate MAY be checked for revocation via the Online 369 Certificate Status Protocol (OCSP) [RFC6960], certificate revocation 370 lists (CRLs), or some other mechanism. 372 Policies fetched via HTTPS are only valid if the HTTP response code 373 is 200 (OK). HTTP 3xx redirects MUST NOT be followed, and HTTP 374 caching (as specified in [RFC7234]) MUST NOT be used. 376 Senders may wish to rate-limit the frequency of attempts to fetch the 377 HTTPS endpoint even if a valid TXT record for the recipient domain 378 exists. In the case that the HTTPS GET fails, we suggest 379 implementions may limit further attempts to a period of five minutes 380 or longer per version ID, to avoid overwhelming resource-constrained 381 recipients with cascading failures. 383 Senders MAY impose a timeout on the HTTPS GET and/or a limit on the 384 maximum size of the response body to avoid long delays or resource 385 exhaustion during attempted policy updates. A suggested timeout is 386 one minute, and a suggested maximum policy size 64 kilobytes; policy 387 hosts SHOULD respond to requests with a complete policy body within 388 that timeout and size limit. 390 If a valid TXT record is found but no policy can be fetched via HTTPS 391 (for any reason), and there is no valid (non-expired) previously- 392 cached policy, senders MUST continue with delivery as though the 393 domain has not implemented MTA-STS. 395 Conversely, if no "live" policy can be discovered via DNS or fetched 396 via HTTPS, but a valid (non-expired) policy exists in the sender's 397 cache, the sender MUST apply that cached policy. 399 Finally, to mitigate the risk of persistent interference with policy 400 refresh, as discussed in-depth in Section 10, MTAs SHOULD 401 proactivecly refresh cached policies before they expire; a suggested 402 refresh frequency is once per day. To enable administrators to 403 discover problems with policy refresh, MTAs SHOULD alert 404 administrators (through the use of logs or similar) when such 405 attempts fail, unless the cached policy mode is "none". 407 3.4. Policy Selection for Smart Hosts and Subdomains 409 When sending mail via a "smart host"--an intermediate SMTP relay 410 rather than the message recipient's server--compliant senders MUST 411 treat the smart host domain as the policy domain for the purposes of 412 policy discovery and application. 414 When sending mail to a mailbox at a subdomain, compliant senders MUST 415 NOT attempt to fetch a policy from the parent zone. Thus for mail 416 sent to "user@mail.example.com", the policy can be fetched only from 417 "mail.example.com", not "example.com". 419 4. Policy Validation 421 When sending to an MX at a domain for which the sender has a valid 422 and non-expired MTA-STS policy, a sending MTA honoring MTA-STS MUST 423 validate: 425 1. That the recipient MX supports STARTTLS and offers a valid PKIX- 426 based TLS certificate. 428 2. That at least one of the policy's "mx" patterns matches at least 429 one of the identities presented in the MX's X.509 certificate, as 430 described in "MX Certificate Validation". 432 This section does not dictate the behavior of sending MTAs when 433 policies fail to validate; see Section 5, "Policy Application" for a 434 description of sending MTA behavior when policy validation fails. 436 4.1. MX Certificate Validation 438 The certificate presented by the receiving MX MUST chain to a root CA 439 that is trusted by the sending MTA and be non-expired. The 440 certificate MUST have a subject alternative name (SAN, [RFC5280]) 441 with a DNS-ID matching the "mx" pattern. The MX's certificate MAY 442 also be checked for revocation via OCSP [RFC6960], CRLs [RFC6818], or 443 some other mechanism. 445 Because the "mx" patterns are not hostnames, however, matching is not 446 identical to other common cases of X.509 certificate authentication 447 (as described, for example, in [RFC6125]). Consider the example 448 policy given above, with an "mx" pattern containing ".example.com". 449 In this case, if the MX server's X.509 certificate contains a SAN 450 matching "*.example.com", we are required to implement "wildcard-to- 451 wildcard" matching. 453 To simplify this case, we impose the following constraints on 454 wildcard certificates, identical to those in [RFC7672] section 3.2.3 455 and [RFC6125] section 6.4.3: wildcards are valid in DNS-IDs, but must 456 be the entire first label of the identifier (that is, 457 "*.example.com", not "mail*.example.com"). Senders who are comparing 458 a "suffix" MX pattern with a wildcard identifier should thus strip 459 the wildcard and ensure that the two sides match label-by-label, 460 until all labels of the shorter side (if unequal length) are 461 consumed. 463 Note that a wildcard must match a label; an "mx" pattern of 464 ".example.com" thus does not match a SAN of "example.com", nor does a 465 SAN of "*.example.com" match an "mx" of "example.com". 467 A simple pseudocode implementation of this algorithm is presented in 468 Appendix B. 470 5. Policy Application 472 When sending to an MX at a domain for which the sender has a valid, 473 non-expired MTA-STS policy, a sending MTA honoring MTA-STS applies 474 the result of a policy validation failure one of two ways, depending 475 on the value of the policy "mode" field: 477 1. "enforce": In this mode, sending MTAs MUST NOT deliver the 478 message to hosts which fail MX matching or certificate 479 validation. 481 2. "testing": In this mode, sending MTAs which also implement the 482 TLSRPT specification [I-D.ietf-uta-smtp-tlsrpt] merely send a 483 report indicating policy application failures (so long as TLSRPT 484 is also implemented by the recipient domain). 486 3. "none": In this mode, sending MTAs should treat the policy domain 487 as though it does not have any active policy; see Section 8.3, 488 "Removing MTA-STS", for use of this mode value. 490 When a message fails to deliver due to an "enforce" policy, a 491 compliant MTA MUST NOT permanently fail to deliver messages before 492 checking for the presence of an updated policy at the Policy Domain. 493 (In all cases, MTAs SHOULD treat such failures as transient errors 494 and retry delivery later.) This allows implementing domains to 495 update long-lived policies on the fly. 497 5.1. Policy Application Control Flow 499 An example control flow for a compliant sender consists of the 500 following steps: 502 1. Check for a cached policy whose time-since-fetch has not exceeded 503 its "max_age". If none exists, attempt to fetch a new policy 504 (perhaps asynchronously, so as not to block message delivery). 505 Optionally, sending MTAs may unconditionally check for a new 506 policy at this step. 508 2. For each candidate MX, in order of MX priority, attempt to 509 deliver the message, enforcing STARTTLS and, assuming a policy is 510 present, PKIX certificate validation as described in Section 4.1, 511 "MX Certificate Validation." 513 3. A message delivery MUST NOT be permanently failed until the 514 sender has first checked for the presence of a new policy (as 515 indicated by the "id" field in the "_mta-sts" TXT record). If a 516 new policy is not found, existing rules for the case of temporary 517 message delivery failures apply (as discussed in [RFC5321] 518 section 4.5.4.1). 520 6. Reporting Failures 522 MTA-STS is intended to be used along with TLSRPT 523 [I-D.ietf-uta-smtp-tlsrpt] in order to ensure implementing domains 524 can detect cases of both benign and malicious failures, and to ensure 525 that failures that indicate an active attack are discoverable. As 526 such, senders who also implement TLSRPT SHOULD treat the following 527 events as reportable failures: 529 o HTTPS policy fetch failures when a valid TXT record is present. 531 o Policy fetch failures of any kind when a valid policy exists in 532 the policy cache, except if that policy's mode is "none". 534 o Delivery attempts in which a contacted MX does not support 535 STARTTLS or does not present a certificate which validates 536 according to the applied policy, except if that policy's mode is 537 "none". 539 7. Interoperability Considerations 541 7.1. SNI Support 543 To ensure that the server sends the right certificate chain, the SMTP 544 client MUST have support for the TLS SNI extension [RFC6066]. When 545 connecting to a HTTP server to retrieve the MTA-STS policy, the SNI 546 extension MUST contain the name of the policy host (e.g. "mta- 547 sts.example.com"). When connecting to an SMTP server, the SNI 548 extension MUST contain the MX hostname. 550 HTTP servers used to deliver MTA-STS policies MUST have support for 551 the TLS SNI extension and MAY rely on SNI to determine which 552 certificate chain to present to the client. In either case, HTTP 553 servers MUST respond with a certificate chain that matches the policy 554 hostname or abort the TLS handshake if unable to do so. 556 SMTP servers MUST have support for the TLS SNI extension and MAY rely 557 on SNI to determine which certificate chain to present to the client. 558 If the client sends no SNI extension or sends an SNI extension for an 559 unsupported server name, the server MUST simply send a fallback 560 certificate chain of its choice. The reason for not enforcing strict 561 matching of the requested SNI hostname is that MTA-STS TLS clients 562 may be typically willing to accept multiple server names but can only 563 send one name in the SNI extension. The server's fallback 564 certificate may match a different name that is acceptable to the 565 client, e.g., the original next-hop domain. 567 7.2. Minimum TLS Version Support 569 MTAs supporting MTA-STS MUST have support for TLS version 1.2 570 [RFC5246] or higher. The general TLS usage guidance in [RFC7525] 571 SHOULD be followed. 573 8. Operational Considerations 575 8.1. Policy Updates 577 Updating the policy requires that the owner make changes in two 578 places: the "_mta-sts" TXT record in the Policy Domain's DNS zone and 579 at the corresponding HTTPS endpoint. As a result, recipients should 580 expect a policy will continue to be used by senders until both the 581 HTTPS and TXT endpoints are updated and the TXT record's TTL has 582 passed. 584 In other words, a sender who is unable to successfully deliver a 585 message while applying a cache of the recipient's now-outdated policy 586 may be unable to discover that a new policy exists until the DNS TTL 587 has passed. Recipients should therefore ensure that old policies 588 continue to work for message delivery during this period of time, or 589 risk message delays. 591 Recipients should also prefer to update the HTTPS policy body before 592 updating the TXT record; this ordering avoids the risk that senders, 593 seeing a new TXT record, mistakenly cache the old policy from HTTPS. 595 8.2. Policy Delegation 597 Domain owners commonly delegate SMTP hosting to a different 598 organization, such as an ISP or a Web host. In such a case, they may 599 wish to also delegate the MTA-STS policy to the same organization 600 which can be accomplished with two changes. 602 First, the Policy Domain must point the "_mta-sts" record, via CNAME, 603 to the "_mta-sts" record maintained by the hosting organization. 604 This allows the hosting organization to control update signaling. 606 Second, the Policy Domain must point the "well-known" policy location 607 to the hosting organization. This can be done either by setting the 608 "mta-sts" record to an IP address or CNAME specified by the hosting 609 organization and by giving the hosting organization a TLS certificate 610 which is valid for that host, or by setting up a "reverse proxy" 611 (also known as a "gateway") server that serves as the Policy Domain's 612 policy the policy currently served by the hosting organization. 614 For example, given a user domain "user.example" hosted by a mail 615 provider "provider.example", the following configuration would allow 616 policy delegation: 618 DNS: 620 _mta-sts.user.example. IN CNAME _mta-sts.provider.example. 622 Policy: 624 > GET /.well-known/mta-sts.txt 625 > Host: mta-sts.user.example 626 < HTTP/1.1 200 OK # Response proxies content from 627 # https://mta-sts.provider.example 629 Note that while sending MTAs MUST NOT use HTTP caching when fetching 630 policies via HTTPS, such caching may nonetheless be useful to a 631 reverse proxy configured as described in this section. An HTTPS 632 policy endpoint expecting to be proxied for multiple hosted domains-- 633 as with a large mail hosting provider or similar--may wish to 634 indicate an HTTP Cache-Control "max-age" response directive (as 635 specified in [RFC7234]) of 60 seconds as a reasonable value to save 636 reverse proxies an unnecessarily high-rate of proxied policy 637 fetching. 639 8.3. Removing MTA-STS 641 In order to facilitate clean opt-out of MTA-STS by implementing 642 policy domains, and to distinguish clearly between failures which 643 indicate attacks and those which indicate such opt-outs, MTA-STS 644 implements the "none" mode, which allows validated policies to 645 indicate authoritatively that the policy domain wishes to no longer 646 implement MTA-STS and may, in the future, remove the MTA-STS TXT and 647 policy endpoints entirely. 649 A suggested workflow to implement such an opt out is as follows: 651 1. Publish a new policy with "mode" equal to "none" and a small 652 "max_age" (e.g. one day). 654 2. Publish a new TXT record to trigger fetching of the new policy. 656 3. When all previously served policies have expired--normally this 657 is the time the previously published policy was last served plus 658 that policy's "max_age", but note that older policies may have 659 been served with a greater "max_age", allowing overlapping policy 660 caches--safely remove the TXT record and HTTPS endpoint. 662 9. IANA Considerations 664 9.1. Well-Known URIs Registry 666 A new "well-known" URI as described in Section 3 will be registered 667 in the Well-Known URIs registry as described below: 669 URI Suffix: mta-sts.txt Change Controller: IETF 671 9.2. MTA-STS TXT Record Fields 673 IANA is requested to create a new registry titled "MTA-STS TXT Record 674 Fields". The initial entries in the registry are: 676 +------------+--------------------+------------------------+ 677 | Field Name | Description | Reference | 678 +------------+--------------------+------------------------+ 679 | v | Record version | Section 3.1 of RFC XXX | 680 | id | Policy instance ID | Section 3.1 of RFC XXX | 681 +------------+--------------------+------------------------+ 683 New fields are added to this registry using IANA's "Expert Review" 684 policy. 686 9.3. MTA-STS Policy Fields 688 IANA is requested to create a new registry titled "MTA-STS Policy 689 Fields". The initial entries in the registry are: 691 +------------+----------------------+------------------------+ 692 | Field Name | Description | Reference | 693 +------------+----------------------+------------------------+ 694 | version | Policy version | Section 3.2 of RFC XXX | 695 | mode | Enforcement behavior | Section 3.2 of RFC XXX | 696 | max_age | Policy lifetime | Section 3.2 of RFC XXX | 697 | mx | MX identities | Section 3.2 of RFC XXX | 698 +------------+----------------------+------------------------+ 700 New fields are added to this registry using IANA's "Expert Review" 701 policy. 703 10. Security Considerations 705 SMTP MTA Strict Transport Security attempts to protect against an 706 active attacker who wishes to intercept or tamper with mail between 707 hosts who support STARTTLS. There are two classes of attacks 708 considered: 710 o Foiling TLS negotiation, for example by deleting the "250 711 STARTTLS" response from a server or altering TLS session 712 negotiation. This would result in the SMTP session occurring over 713 plaintext, despite both parties supporting TLS. 715 o Impersonating the destination mail server, whereby the sender 716 might deliver the message to an impostor, who could then monitor 717 and/or modify messages despite opportunistic TLS. This 718 impersonation could be accomplished by spoofing the DNS MX record 719 for the recipient domain, or by redirecting client connections 720 intended for the legitimate recipient server (for example, by 721 altering BGP routing tables). 723 MTA-STS can thwart such attacks only if the sender is able to 724 previously obtain and cache a policy for the recipient domain, and 725 only if the attacker is unable to obtain a valid certificate that 726 complies with that policy. Below, we consider specific attacks on 727 this model. 729 10.1. Obtaining a Signed Certificate 731 SMTP MTA-STS relies on certificate validation via PKIX based TLS 732 identity checking [RFC6125]. Attackers who are able to obtain a 733 valid certificate for the targeted recipient mail service (e.g. by 734 compromising a certificate authority) are thus able to circumvent STS 735 authentication. 737 10.2. Preventing Policy Discovery 739 Since MTA-STS uses DNS TXT records for policy discovery, an attacker 740 who is able to block DNS responses can suppress the discovery of an 741 MTA-STS Policy, making the Policy Domain appear not to have an MTA- 742 STS Policy. The sender policy cache is designed to resist this 743 attack by decreasing the frequency of policy discovery and thus 744 reducing the window of vulnerability; it is nonetheless a risk that 745 attackers who can predict or induce policy discovery--for example, by 746 inducing a sending domain to send mail to a never-before-contacted 747 recipient while carrying out a man-in-the-middle attack--may be able 748 to foil policy discovery and effectively downgrade the security of 749 the message delivery. 751 Since this attack depends upon intercepting initial policy discovery, 752 we strongly recommend implementers to prefer policy "max_age" values 753 to be as long as is practical. 755 Because this attack is also possible upon refresh of a cached policy, 756 we suggest implementers do not wait until a cached policy has expired 757 before checking for an update; if senders attempt to refresh the 758 cache regularly (for instance, by checking their cached version 759 string against the TXT record on each successful send, or in a 760 background task that runs daily or weekly), an attacker would have to 761 foil policy discovery consistently over the lifetime of a cached 762 policy to prevent a successful refresh. 764 Additionally, MTAs should alert administrators to repeated policy 765 refresh failures long before cached policies expire (through warning 766 logs or similar applicable mechanisms), allowing administrators to 767 detect such a persistent attack on policy refresh. (However, they 768 should not implement such alerts if the cached policy has a "none" 769 mode, to allow clean MTA-STS removal, as described in Section 8.3.) 771 Resistance to downgrade attacks of this nature--due to the ability to 772 authoritatively determine "lack of a record" even for non- 773 participating recipients--is a feature of DANE, due to its use of 774 DNSSEC for policy discovery. 776 10.3. Denial of Service 778 We additionally consider the Denial of Service risk posed by an 779 attacker who can modify the DNS records for a recipient domain. 780 Absent MTA-STS, such an attacker can cause a sending MTA to cache 781 invalid MX records, but only for however long the sending resolver 782 caches those records. With MTA-STS, the attacker can additionally 783 advertise a new, long-"max_age" MTA-STS policy with "mx" constraints 784 that validate the malicious MX record, causing senders to cache the 785 policy and refuse to deliver messages once the victim has resecured 786 the MX records. 788 This attack is mitigated in part by the ability of a victim domain to 789 (at any time) publish a new policy updating the cached, malicious 790 policy, though this does require the victim domain to both obtain a 791 valid CA-signed certificate and to understand and properly configure 792 MTA-STS. 794 Similarly, we consider the possibility of domains that deliberately 795 allow untrusted users to serve untrusted content on user-specified 796 subdomains. In some cases (e.g. the service Tumblr.com) this takes 797 the form of providing HTTPS hosting of user-registered subdomains; in 798 other cases (e.g. dynamic DNS providers) this takes the form of 799 allowing untrusted users to register custom DNS records at the 800 provider's domain. 802 In these cases, there is a risk that untrusted users would be able to 803 serve custom content at the "mta-sts" host, including serving an 804 illegitimate MTA-STS policy. We believe this attack is rendered more 805 difficult by the need for the attacker to also serve the "_mta-sts" 806 TXT record on the same domain--something not, to our knowledge, 807 widely provided to untrusted users. This attack is additionally 808 mitigated by the aforementioned ability for a victim domain to update 809 an invalid policy at any future date. 811 10.4. Weak Policy Constraints 813 Even if an attacker cannot modify a served policy, the potential 814 exists for configurations that allow attackers on the same domain to 815 receive mail for that domain. For example, an easy configuration 816 option when authoring an MTA-STS Policy for "example.com" is to set 817 the "mx" equal to ".example.com"; recipient domains must consider in 818 this case the risk that any user possessing a valid hostname and CA- 819 signed certificate (for example, "dhcp-123.example.com") will, from 820 the perspective of MTA-STS Policy validation, be a valid MX host for 821 that domain. 823 10.5. Compromise of the Web PKI System 825 A host of risks apply to the PKI system used for certificate 826 authentication, both of the "mta-sts" HTTPS host's certificate and 827 the SMTP servers' certificates. These risks are broadly applicable 828 within the Web PKI ecosystem and are not specific to MTA-STS; 829 nonetheless, they deserve some consideration in this context. 831 Broadly speaking, attackers may compromise the system by obtaining 832 certificates under fraudulent circumstances (i.e. by impersonating 833 the legitimate owner of the victim domain), by compromising a 834 Certificate Authority or Delegate Authority's private keys, by 835 obtaining a legitimate certificate issued to the victim domain, and 836 similar. 838 One approach commonly employed by Web browsers to help mitigate 839 against some of these attacks is to allow for revocation of 840 compromised or fraudulent certificates via OCSP [RFC6960] or CRLs 841 [RFC6818]. Such mechanisms themselves represent tradeoffs and are 842 not universally implemented; we nonetheless recommend implementors of 843 MTA-STS to implement revocation mechanisms which are most applicable 844 to their implementations. 846 11. Contributors 848 Nicolas Lidzborski Google, Inc nlidz (at) google (dot com) 850 Wei Chuang Google, Inc weihaw (at) google (dot com) 852 Brandon Long Google, Inc blong (at) google (dot com) 854 Franck Martin LinkedIn, Inc fmartin (at) linkedin (dot com) 856 Klaus Umbach 1&1 Mail & Media Development & Technology GmbH 857 klaus.umbach (at) 1und1 (dot de) 858 Markus Laber 1&1 Mail & Media Development & Technology GmbH 859 markus.laber (at) 1und1 (dot de) 861 12. References 863 12.1. Normative References 865 [I-D.ietf-uta-smtp-tlsrpt] 866 Margolis, D., Brotman, A., Ramakrishnan, B., Jones, J., 867 and M. Risher, "SMTP TLS Reporting", draft-ietf-uta-smtp- 868 tlsrpt-13 (work in progress), December 2017. 870 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 871 Requirement Levels", BCP 14, RFC 2119, 872 DOI 10.17487/RFC2119, March 1997, 873 . 875 [RFC3492] Costello, A., "Punycode: A Bootstring encoding of Unicode 876 for Internationalized Domain Names in Applications 877 (IDNA)", RFC 3492, DOI 10.17487/RFC3492, March 2003, 878 . 880 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 881 (TLS) Protocol Version 1.2", RFC 5246, 882 DOI 10.17487/RFC5246, August 2008, 883 . 885 [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., 886 Housley, R., and W. Polk, "Internet X.509 Public Key 887 Infrastructure Certificate and Certificate Revocation List 888 (CRL) Profile", RFC 5280, DOI 10.17487/RFC5280, May 2008, 889 . 891 [RFC5321] Klensin, J., "Simple Mail Transfer Protocol", RFC 5321, 892 DOI 10.17487/RFC5321, October 2008, 893 . 895 [RFC5785] Nottingham, M. and E. Hammer-Lahav, "Defining Well-Known 896 Uniform Resource Identifiers (URIs)", RFC 5785, 897 DOI 10.17487/RFC5785, April 2010, 898 . 900 [RFC6066] Eastlake 3rd, D., "Transport Layer Security (TLS) 901 Extensions: Extension Definitions", RFC 6066, 902 DOI 10.17487/RFC6066, January 2011, 903 . 905 [RFC6125] Saint-Andre, P. and J. Hodges, "Representation and 906 Verification of Domain-Based Application Service Identity 907 within Internet Public Key Infrastructure Using X.509 908 (PKIX) Certificates in the Context of Transport Layer 909 Security (TLS)", RFC 6125, DOI 10.17487/RFC6125, March 910 2011, . 912 [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 913 Protocol (HTTP/1.1): Semantics and Content", RFC 7231, 914 DOI 10.17487/RFC7231, June 2014, 915 . 917 [RFC7405] Kyzivat, P., "Case-Sensitive String Support in ABNF", 918 RFC 7405, DOI 10.17487/RFC7405, December 2014, 919 . 921 [RFC7525] Sheffer, Y., Holz, R., and P. Saint-Andre, 922 "Recommendations for Secure Use of Transport Layer 923 Security (TLS) and Datagram Transport Layer Security 924 (DTLS)", BCP 195, RFC 7525, DOI 10.17487/RFC7525, May 925 2015, . 927 12.2. Informative References 929 [RFC3207] Hoffman, P., "SMTP Service Extension for Secure SMTP over 930 Transport Layer Security", RFC 3207, DOI 10.17487/RFC3207, 931 February 2002, . 933 [RFC4033] Arends, R., Austein, R., Larson, M., Massey, D., and S. 934 Rose, "DNS Security Introduction and Requirements", 935 RFC 4033, DOI 10.17487/RFC4033, March 2005, 936 . 938 [RFC5322] Resnick, P., Ed., "Internet Message Format", RFC 5322, 939 DOI 10.17487/RFC5322, October 2008, 940 . 942 [RFC5891] Klensin, J., "Internationalized Domain Names in 943 Applications (IDNA): Protocol", RFC 5891, 944 DOI 10.17487/RFC5891, August 2010, 945 . 947 [RFC6818] Yee, P., "Updates to the Internet X.509 Public Key 948 Infrastructure Certificate and Certificate Revocation List 949 (CRL) Profile", RFC 6818, DOI 10.17487/RFC6818, January 950 2013, . 952 [RFC6960] Santesson, S., Myers, M., Ankney, R., Malpani, A., 953 Galperin, S., and C. Adams, "X.509 Internet Public Key 954 Infrastructure Online Certificate Status Protocol - OCSP", 955 RFC 6960, DOI 10.17487/RFC6960, June 2013, 956 . 958 [RFC7234] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, 959 Ed., "Hypertext Transfer Protocol (HTTP/1.1): Caching", 960 RFC 7234, DOI 10.17487/RFC7234, June 2014, 961 . 963 [RFC7672] Dukhovni, V. and W. Hardaker, "SMTP Security via 964 Opportunistic DNS-Based Authentication of Named Entities 965 (DANE) Transport Layer Security (TLS)", RFC 7672, 966 DOI 10.17487/RFC7672, October 2015, 967 . 969 Appendix A. MTA-STS example record & policy 971 The owner of "example.com" wishes to begin using MTA-STS with a 972 policy that will solicit reports from senders without affecting how 973 the messages are processed, in order to verify the identity of MXs 974 that handle mail for "example.com", confirm that TLS is correctly 975 used, and ensure that certificates presented by the recipient MX 976 validate. 978 MTA-STS policy indicator TXT RR: 980 _mta-sts.example.com. IN TXT "v=STSv1; id=20160831085700Z;" 982 MTA-STS Policy file served as the response body at "https://mta- 983 sts.example.com/.well-known/mta-sts.txt": 985 version: STSv1 986 mode: testing 987 mx: mx1.example.com 988 mx: mx2.example.com 989 mx: mx.backup-example.com 990 max_age: 12345678 992 Appendix B. Message delivery pseudocode 994 Below is pseudocode demonstrating the logic of a compliant sending 995 MTA. 997 While this pseudocode implementation suggests synchronous policy 998 retrieval in the delivery path, in a working implementation that may 999 be undesirable, and we expect some implementers to instead prefer a 1000 background fetch that does not block delivery if no cached policy is 1001 present. 1003 func isEnforce(policy) { 1004 // Return true if the policy mode is "enforce". 1005 } 1007 func isNonExpired(policy) { 1008 // Return true if the policy is not expired. 1009 } 1011 func tryStartTls(connection) { 1012 // Attempt to open an SMTP connection with STARTTLS with the MX. 1013 } 1015 func isWildcardMatch(pat, host) { 1016 // Literal matches are true. 1017 if pat == host { 1018 return true 1019 } 1020 // Leading '.' matches a wildcard against the first part, i.e. 1021 // .example.com matches x.example.com but not x.y.example.com. 1022 if pat[0] == '.' { 1023 parts = SplitN(host, '.', 2) // Split on the first '.'. 1024 if len(parts) > 1 && parts[1] == pat[1:] { 1025 return true 1026 } 1027 } 1028 return false 1029 } 1031 func certMatches(connection, policy) { 1032 // Assume a handy function to return DNS-ID SANs. 1033 for san in getDnsIdSansFromCert(connection) { 1034 for mx in policy.mx { 1035 // Return if the server certificate from "connection" matches the 1036 // "mx" host. 1037 if san[0] == '*' { 1038 // Invalid wildcard! 1039 if san[1] != '.' continue 1040 san = san[1:] 1041 } 1042 if isWildcardMatch(san, mx) || isWildcardMatch(mx, san) { 1043 return true 1044 } 1045 } 1046 } 1047 return false 1048 } 1050 func tryDeliverMail(connection, message) { 1051 // Attempt to deliver "message" via "connection". 1052 } 1054 func tryGetNewPolicy(domain) { 1055 // Check for an MTA-STS TXT record for "domain" in DNS, and return the 1056 // indicated policy. 1057 } 1059 func cachePolicy(domain, policy) { 1060 // Store "policy" as the cached policy for "domain". 1061 } 1063 func tryGetCachedPolicy(domain) { 1064 // Return a cached policy for "domain". 1065 } 1067 func reportError(error) { 1068 // Report an error via TLSRPT. 1069 } 1071 func tryMxAccordingTo(message, mx, policy) { 1072 connection := connect(mx) 1073 if !connection { 1074 return false // Can't connect to the MX so it's not an MTA-STS 1075 // error. 1076 } 1077 secure := true 1078 if !tryStartTls(connection) { 1079 secure = false 1080 reportError(E_NO_VALID_TLS) 1081 } else if !certMatches(connection, policy) { 1082 secure = false 1083 reportError(E_CERT_MISMATCH) 1084 } 1085 if secure || !isEnforce(policy) { 1086 return tryDeliverMail(connection, message) 1087 } 1088 return false 1089 } 1091 func tryWithPolicy(message, domain, policy) { 1092 mxes := getMxForDomain(domain) 1093 for mx in mxes { 1094 if tryMxAccordingTo(message, mx, policy) { 1095 return true 1096 } 1097 } 1098 return false 1099 } 1101 func handleMessage(message) { 1102 domain := ... // domain part after '@' from recipient 1103 policy := tryGetNewPolicy(domain) 1104 if policy { 1105 cachePolicy(domain, policy) 1106 } else { 1107 policy = tryGetCachedPolicy(domain) 1108 } 1109 if policy { 1110 return tryWithPolicy(message, domain, policy) 1111 } 1112 // Try to deliver the message normally (i.e. without MTA-STS). 1113 } 1115 Authors' Addresses 1117 Daniel Margolis 1118 Google, Inc 1120 Email: dmargolis (at) google (dot com) 1122 Mark Risher 1123 Google, Inc 1125 Email: risher (at) google (dot com) 1127 Binu Ramakrishnan 1128 Yahoo!, Inc 1130 Email: rbinu (at) yahoo-inc (dot com) 1132 Alexander Brotman 1133 Comcast, Inc 1135 Email: alex_brotman (at) comcast (dot com) 1136 Janet Jones 1137 Microsoft, Inc 1139 Email: janet.jones (at) microsoft (dot com)