idnits 2.17.1 draft-ietf-uta-mta-sts-10.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** There are 11 instances of too long lines in the document, the longest one being 10 characters in excess of 72. == There are 3 instances of lines with non-RFC2606-compliant FQDNs in the document. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == The document seems to lack the recommended RFC 2119 boilerplate, even if it appears to use RFC 2119 keywords. (The document does seem to have the reference to RFC 2119 which the ID-Checklist requires). -- The document date (September 28, 2017) is 2374 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 282, but not defined -- Looks like a reference, but probably isn't: '0' on line 871 -- Looks like a reference, but probably isn't: '1' on line 873 ** 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 informational reference (is this intentional?): RFC 2560 (Obsoleted by RFC 6960) -- Obsolete informational reference (is this intentional?): RFC 7234 (Obsoleted by RFC 9111) Summary: 4 errors (**), 0 flaws (~~), 4 warnings (==), 6 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: April 1, 2018 B. Ramakrishnan 6 Yahoo!, Inc 7 A. Brotman 8 Comcast, Inc 9 J. Jones 10 Microsoft, Inc 11 September 28, 2017 13 SMTP MTA Strict Transport Security (MTA-STS) 14 draft-ietf-uta-mta-sts-10 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 April 1, 2018. 41 Copyright Notice 43 Copyright (c) 2017 IETF Trust and the persons identified as the 44 document authors. All rights reserved. 46 This document is subject to BCP 78 and the IETF Trust's Legal 47 Provisions Relating to IETF Documents 48 (http://trustee.ietf.org/license-info) in effect on the date of 49 publication of this document. Please review these documents 50 carefully, as they describe your rights and restrictions with respect 51 to this document. Code Components extracted from this document must 52 include Simplified BSD License text as described in Section 4.e of 53 the Trust Legal Provisions and are provided without warranty as 54 described in the Simplified BSD License. 56 Table of Contents 58 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 59 1.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . 3 60 2. Related Technologies . . . . . . . . . . . . . . . . . . . . 3 61 3. Policy Discovery . . . . . . . . . . . . . . . . . . . . . . 4 62 3.1. MTA-STS TXT Records . . . . . . . . . . . . . . . . . . . 4 63 3.2. MTA-STS Policies . . . . . . . . . . . . . . . . . . . . 5 64 3.3. HTTPS Policy Fetching . . . . . . . . . . . . . . . . . . 8 65 3.4. Policy Selection for Smart Hosts and Subdomains . . . . . 9 66 3.5. MX Certificate Validation . . . . . . . . . . . . . . . . 9 67 4. Policy Application . . . . . . . . . . . . . . . . . . . . . 10 68 4.1. Policy Application Control Flow . . . . . . . . . . . . . 11 69 5. Reporting Failures . . . . . . . . . . . . . . . . . . . . . 11 70 6. Operational Considerations . . . . . . . . . . . . . . . . . 12 71 6.1. Policy Updates . . . . . . . . . . . . . . . . . . . . . 12 72 6.2. Policy Delegation . . . . . . . . . . . . . . . . . . . . 12 73 6.3. Removing MTA-STS . . . . . . . . . . . . . . . . . . . . 13 74 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 13 75 7.1. Well-Known URIs Registry . . . . . . . . . . . . . . . . 13 76 7.2. MTA-STS TXT Record Fields . . . . . . . . . . . . . . . . 13 77 7.3. MTA-STS Policy Fields . . . . . . . . . . . . . . . . . . 14 78 8. Security Considerations . . . . . . . . . . . . . . . . . . . 14 79 8.1. Obtaining a Signed Certificate . . . . . . . . . . . . . 15 80 8.2. Preventing Policy Discovery . . . . . . . . . . . . . . . 15 81 8.3. Denial of Service . . . . . . . . . . . . . . . . . . . . 16 82 8.4. Weak Policy Constraints . . . . . . . . . . . . . . . . . 16 83 8.5. Compromise of the Web PKI System . . . . . . . . . . . . 17 84 9. Contributors . . . . . . . . . . . . . . . . . . . . . . . . 17 85 10. Appendix 1: MTA-STS example record & policy . . . . . . . . . 17 86 11. Appendix 2: Message delivery pseudocode . . . . . . . . . . . 18 87 12. References . . . . . . . . . . . . . . . . . . . . . . . . . 21 88 12.1. Normative References . . . . . . . . . . . . . . . . . . 21 89 12.2. Informative References . . . . . . . . . . . . . . . . . 22 90 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 22 92 1. Introduction 94 The STARTTLS extension to SMTP [RFC3207] allows SMTP clients and 95 hosts to negotiate the use of a TLS channel for encrypted mail 96 transmission. 98 While this opportunistic encryption protocol by itself provides a 99 high barrier against passive man-in-the-middle traffic interception, 100 any attacker who can delete parts of the SMTP session (such as the 101 "250 STARTTLS" response) or who can redirect the entire SMTP session 102 (perhaps by overwriting the resolved MX record of the delivery 103 domain) can perform downgrade or interception attacks. 105 This document defines a mechanism for recipient domains to publish 106 policies specifying: 108 o whether MTAs sending mail to this domain can expect PKIX- 109 authenticated TLS support 111 o what a conforming client should do with messages when TLS cannot 112 be successfully negotiated 114 1.1. Terminology 116 The keywords MUST, MUST NOT, REQUIRED, SHALL, SHALL NOT, SHOULD, 117 SHOULD NOT, RECOMMENDED, MAY, and OPTIONAL, when they appear in this 118 document, are to be interpreted as described in [RFC2119]. 120 We also define the following terms for further use in this document: 122 o MTA-STS Policy: A commitment by the Policy Domain to support PKIX 123 authenticated TLS for the specified MX hosts. 125 o Policy Domain: The domain for which an MTA-STS Policy is defined. 126 This is the next-hop domain; when sending mail to 127 "alice@example.com" this would ordinarily be "example.com", but 128 this may be overridden by explicit routing rules (as described in 129 Section 3.4, "Policy Selection for Smart Hosts and Subdomains"). 131 2. Related Technologies 133 The DANE TLSA record [RFC7672] is similar, in that DANE is also 134 designed to upgrade unauthenticated encryption or plaintext 135 transmission into authenticated, downgrade-resistant encrypted 136 transmission. DANE requires DNSSEC [RFC4033] for authentication; the 137 mechanism described here instead relies on certificate authorities 138 (CAs) and does not require DNSSEC, at a cost of risking malicious 139 downgrades. For a thorough discussion of this trade-off, see 140 Section 8, "Security Considerations". 142 In addition, MTA-STS provides an optional report-only mode, enabling 143 soft deployments to detect policy failures; partial deployments can 144 be achieved in DANE by deploying TLSA records only for some of a 145 domain's MXs, but such a mechanism is not possible for the per-domain 146 policies used by MTA-STS. 148 The primary motivation of MTA-STS is to provide a mechanism for 149 domains to upgrade their transport security even when deploying 150 DNSSEC is undesirable or impractical. However, MTA-STS is designed 151 not to interfere with DANE deployments when the two overlap; in 152 particular, senders who implement MTA-STS validation MUST NOT allow a 153 "valid" or "report-only" MTA-STS validation to override a failing 154 DANE validation. 156 3. Policy Discovery 158 MTA-STS policies are distributed via HTTPS from a "well-known" 159 [RFC5785] path served within the Policy Domain, and their presence 160 and current version are indicated by a TXT record at the Policy 161 Domain. These TXT records additionally contain a policy "id" field, 162 allowing sending MTAs to check the currency of a cached policy 163 without performing an HTTPS request. 165 To discover if a recipient domain implements MTA-STS, a sender need 166 only resolve a single TXT record. To see if an updated policy is 167 available for a domain for which the sender has a previously cached 168 policy, the sender need only check the TXT record's version "id" 169 against the cached value. 171 3.1. MTA-STS TXT Records 173 The MTA-STS TXT record is a TXT record with the name "_mta-sts" at 174 the Policy Domain. For the domain "example.com", this record would 175 be "_mta-sts.example.com". MTA-STS TXT records MUST be US-ASCII, 176 semicolon-separated key/value pairs containing the following fields: 178 o "v": (plain-text, required). Currently only "STSv1" is supported. 180 o "id": (plain-text, required). A short string used to track policy 181 updates. This string MUST uniquely identify a given instance of a 182 policy, such that senders can determine when the policy has been 183 updated by comparing to the "id" of a previously seen policy. 184 There is no implied ordering of "id" fields between revisions. 186 An example TXT record is as below: 188 "_mta-sts.example.com. IN TXT "v=STSv1; id=20160831085700Z;"" 190 The formal definition of the "_mta-sts" TXT record, defined using 191 [RFC7405], is as follows: 193 sts-text-record = sts-version 1*(field-delim sts-field) [field-delim] 195 sts-field = sts-id / ; Note that sts-id record 196 sts-extension ; is required. 198 field-delim = *WSP ";" *WSP 200 sts-version = %s"v=STSv1" 202 sts-id = %s"id=" 1*32(ALPHA / DIGIT) ; id=... 204 sts-extension = sts-ext-name "=" sts-ext-value ; name=value 206 sts-ext-name = (ALPHA / DIGIT) *31(ALPHA / DIGIT / "_" / "-" / ".") 208 sts-ext-value = 1*(%x21-3A / %x3C / %x3E-7E) ; chars excluding "=", 209 ; ";", SP, and control 210 ; chars 212 If multiple TXT records for "_mta-sts" are returned by the resolver, 213 records which do not begin with "v=STSv1;" are discarded. If the 214 number of resulting records is not one, senders MUST assume the 215 recipient domain does not implement MTA-STS and skip the remaining 216 steps of policy discovery. If the resulting TXT record contains 217 multiple strings, then the record MUST be treated as if those strings 218 are concatenated together without adding spaces. 220 3.2. MTA-STS Policies 222 The policy itself is a set of key/value pairs (similar to [RFC5322] 223 header fields) served via the HTTPS GET method from the fixed 224 [RFC5785] "well-known" path of ".well-known/mta-sts.txt" served by 225 the "mta-sts" host at the Policy Domain. Thus for "example.com" the 226 path is "https://mta-sts.example.com/.well-known/mta-sts.txt". 228 The [RFC7231] "Content-Type" media type for this resource MUST be 229 "text/plain". When fetching a policy, senders SHOULD validate that 230 the media type is "text/plain" to guard against cases where 231 webservers allow untrusted users to host non-text content (typically, 232 HTML or images) at a user-defined path. Additional "Content-Type" 233 parameters are ignored. 235 This resource contains the following line-separated key/value pairs: 237 o "version": (plain-text). Currently only "STSv1" is supported. 239 o "mode": (plain-text). One of "enforce", "report", or "none", 240 indicating the expected behavior of a sending MTA in the case of a 241 policy validation failure. 243 o "max_age": Max lifetime of the policy (plain-text non-negative 244 integer seconds, maximum value of 31557600). Well-behaved clients 245 SHOULD cache a policy for up to this value from last policy fetch 246 time. To mitigate the risks of attacks at policy refresh time, it 247 is expected that this value typically be in the range of weeks or 248 greater. 250 o "mx": MX identity patterns (list of plain-text strings). One or 251 more patterns matching a Common Name ([RFC6125]) or Subject 252 Alternative Name ([RFC5280]) DNS-ID present in the X.509 253 certificate presented by any MX receiving mail for this domain. 254 For example: "mx: mail.example.com mx: .example.net" indicates 255 that mail for this domain might be handled by any MX with a 256 certificate valid for a host at "mail.example.com" or 257 "example.net". Valid patterns can be either fully specified names 258 ("example.com") or suffixes (".example.net") matching the right- 259 hand parts of a server's identity; the latter case are 260 distinguished by a leading period. If there are more than one MX 261 specified by the policy, they MUST be on separate lines within the 262 policy file. In the case of Internationalized Domain Names 263 ([RFC5891]), the MX MUST specify the Punycode-encoded A-label 264 [RFC3492] and not the Unicode-encoded U-label. The full semantics 265 of certificate validation are described in Section 3.5, "MX 266 Certificate Validation." 268 An example policy is as below: 270 version: STSv1 271 mode: enforce 272 mx: mail.example.com 273 mx: .example.net 274 mx: backupmx.example.com 275 max_age: 123456 277 The formal definition of the policy resource, defined using 278 [RFC7405], is as follows: 280 sts-policy-record = *WSP sts-policy-field *WSP 281 *(CRLF *WSP sts-policy-field *WSP) 282 [CRLF] 284 sts-policy-field = sts-policy-version / ; required once 285 sts-policy-mode / ; required once 286 sts-policy-max-age / ; required once 287 0*(sts-policy-mx *WSP CRLF) / ; required at 288 ; least once 289 ; except when mode 290 ; is "none" 291 sts-policy-extension ; other fields 293 field-delim = ":" *WSP 295 sts-policy-version = sts-policy-version-field field-delim 296 sts-policy-version-value 298 sts-policy-version-field = %s"version" 300 sts-policy-version-value = %s"STSv1" 302 sts-policy-mode = sts-policy-mode-field field-delim 303 sts-policy-mode-value 305 sts-policy-mode-field = %s"mode" 307 sts-policy-model-value = %s"report" / %s"enforce" / %s"none" 309 sts-policy-mx = sts-policy-mx-field field-delim 310 sts-policy-mx-value 312 sts-policy-mx-field = %s"mx" 314 sts-policy-mx-value = 1*(ALPHA / DIGIT / "_" / "-" / ".") 316 sts-policy-max-age = sts-policy-max-age-field field-delim 317 sts-policy-max-age-value 319 sts-policy-max-age-field = %s"max_age" 321 sts-policy-max-age-value = 1*10(DIGIT) 323 sts-policy-extension = sts-policy-ext-name field-delim ; additional 324 sts-policy-ext-value ; extension 325 ; fields 327 sts-policy-ext-name = (ALPHA / DIGIT) *31(ALPHA / DIGIT / "_" / "-" / ".") 329 sts-policy-ext-value = 1*(%x21-3A / %x3C / %x3E-7E) ; chars excluding 330 ; "=", ";", SP, 331 ; and control 332 ; chars 334 Parsers MUST accept TXT records and policy files which are 335 syntactically valid (i.e. valid key/value pairs separated by semi- 336 colons for TXT records) and but containing additional key/value pairs 337 not specified in this document, in which case unknown fields SHALL be 338 ignored. If any non-repeated field--i.e. all fields excepting "mx"-- 339 is duplicated, all entries except for the first SHALL be ignored. If 340 any field is not specified, the policy SHALL be treated as invalid. 342 3.3. HTTPS Policy Fetching 344 When fetching a new policy or updating a policy, the HTTPS endpoint 345 MUST present a X.509 certificate which is valid for the "mta-sts" 346 host (e.g. "mta-sts.example.com") as described below, chain to a 347 root CA that is trusted by the sending MTA, and be non-expired. It 348 is expected that sending MTAs use a set of trusted CAs similar to 349 those in widely deployed Web browsers and operating systems. 351 The certificate is valid for the "mta-sts" host with respect to the 352 rules described in [RFC6125], with the following application-specific 353 considerations: 355 o Matching is performed only against the DNS-ID and CN-ID 356 identifiers. 358 o DNS domain names in server certificates MAY contain the wildcard 359 character '*' as the complete left-most label within the 360 identifier. 362 The certificate MAY be checked for revocation via the Online 363 Certificate Status Protocol (OCSP) [RFC2560], certificate revocation 364 lists (CRLs), or some other mechanism. 366 Policies fetched via HTTPS are only valid if the HTTP response code 367 is 200 (OK). HTTP 3xx redirects MUST NOT be followed, and HTTP 368 caching (as specified in [RFC7234]) MUST NOT be used. 370 Senders may wish to rate-limit the frequency of attempts to fetch the 371 HTTPS endpoint even if a valid TXT record for the recipient domain 372 exists. In the case that the HTTPS GET fails, we suggest 373 implementions may limit further attempts to a period of five minutes 374 or longer per version ID, to avoid overwhelming resource-constrained 375 recipients with cascading failures. 377 Senders MAY impose a timeout on the HTTPS GET and/or a limit on the 378 maximum size of the response body to avoid long delays or resource 379 exhaustion during attempted policy updates. A suggested timeout is 380 one minute, and a suggested maximum policy size 64 kilobytes; policy 381 hosts SHOULD respond to requests with a complete policy body within 382 that timeout and size limit. 384 If a valid TXT record is found but no policy can be fetched via HTTPS 385 (for any reason), and there is no valid (non-expired) previously- 386 cached policy, senders MUST continue with delivery as though the 387 domain has not implemented MTA-STS. 389 Conversely, if no "live" policy can be discovered via DNS or fetched 390 via HTTPS, but a valid (non-expired) policy exists in the sender's 391 cache, the sender MUST apply that cached policy. 393 3.4. Policy Selection for Smart Hosts and Subdomains 395 When sending mail via a "smart host"--an intermediate SMTP relay 396 rather than the message recipient's server--compliant senders MUST 397 treat the smart host domain as the policy domain for the purposes of 398 policy discovery and application. 400 When sending mail to a mailbox at a subdomain, compliant senders MUST 401 NOT attempt to fetch a policy from the parent zone. Thus for mail 402 sent to "user@mail.example.com", the policy can be fetched only from 403 "mail.example.com", not "example.com". 405 #Policy Validation 407 When sending to an MX at a domain for which the sender has a valid 408 and non-expired MTA-STS policy, a sending MTA honoring MTA-STS MUST 409 validate: 411 1. That the recipient MX supports STARTTLS and offers a valid PKIX- 412 based TLS certificate. 414 2. That at least one of the policy's "mx" patterns matches at least 415 one of the identities presented in the MX's X.509 certificate, as 416 described in "MX Certificate Validation". 418 This section does not dictate the behavior of sending MTAs when 419 policies fail to validate; in particular, validation failures of 420 policies which specify mode values of "report" or "none" MUST NOT be 421 interpreted as delivery failures, as described in Section 4, "Policy 422 Application". 424 3.5. MX Certificate Validation 426 The certificate presented by the receiving MX MUST chain to a root CA 427 that is trusted by the sending MTA and be non-expired. The 428 certificate MUST have a CN-ID ([RFC6125]) or subject alternative name 429 (SAN, [RFC5280]) with a DNS-ID matching the "mx" pattern. The MX's 430 certificate MAY also be checked for revocation via OCSP [RFC2560], 431 CRLs [RFC6818], or some other mechanism. 433 Because the "mx" patterns are not hostnames, however, matching is not 434 identical to other common cases of X.509 certificate authentication 435 (as described, for example, in [RFC6125]). Consider the example 436 policy given above, with an "mx" pattern containing ".example.com". 437 In this case, if the MX server's X.509 certificate contains a SAN 438 matching "*.example.com", we are required to implement "wildcard-to- 439 wildcard" matching. 441 To simplify this case, we impose the following constraints on 442 wildcard certificates, identical to those in [RFC7672] section 3.2.3 443 and [@?RFC6125 section 6.4.3: wildcards are valid in DNS-IDs or CN- 444 IDs, but must be the entire first label of the identifier (that is, 445 "*.example.com", not "mail*.example.com"). Senders who are comparing 446 a "suffix" MX pattern with a wildcard identifier should thus strip 447 the wildcard and ensure that the two sides match label-by-label, 448 until all labels of the shorter side (if unequal length) are 449 consumed. 451 Note that a wildcard _must_ match a label; an "mx" pattern of 452 ".example.com" thus does not match a SAN of "example.com", nor does a 453 SAN of "*.example.com" match an "mx" of "example.com". 455 A simple pseudocode implementation of this algorithm is presented in 456 the Appendix. 458 4. Policy Application 460 When sending to an MX at a domain for which the sender has a valid, 461 non-expired MTA-STS policy, a sending MTA honoring MTA-STS applies 462 the result of a policy validation failure one of two ways, depending 463 on the value of the policy "mode" field: 465 1. "enforce": In this mode, sending MTAs MUST NOT deliver the 466 message to hosts which fail MX matching or certificate 467 validation. 469 2. "report": In this mode, sending MTAs which also implement the 470 TLSRPT specification (TODO: add ref) merely send a report 471 indicating policy application failures (so long as TLSRPT is also 472 implemented by the recipient domain). 474 3. "none": In this mode, sending MTAs should treat the policy domain 475 as though it does not have any active policy; see Section 6.3, 476 "Removing MTA-STS", for use of this mode value. 478 When a message fails to deliver due to an "enforce" policy, a 479 compliant MTA MUST NOT permanently fail to deliver messages before 480 checking for the presence of an updated policy at the Policy Domain. 481 (In all cases, MTAs SHOULD treat such failures as transient errors 482 and retry delivery later.) This allows implementing domains to 483 update long-lived policies on the fly. 485 4.1. Policy Application Control Flow 487 An example control flow for a compliant sender consists of the 488 following steps: 490 1. Check for a cached policy whose time-since-fetch has not exceeded 491 its "max_age". If none exists, attempt to fetch a new policy 492 (perhaps asynchronously, so as not to block message delivery). 493 Optionally, sending MTAs may unconditionally check for a new 494 policy at this step. 496 2. For each candidate MX, in order of MX priority, attempt to 497 deliver the message, enforcing STARTTLS and, assuming a policy is 498 present, PKIX certificate validation as described in Section 3.5, 499 "MX Certificate Validation." 501 3. A message delivery MUST NOT be permanently failed until the 502 sender has first checked for the presence of a new policy (as 503 indicated by the "id" field in the "_mta-sts" TXT record). If a 504 new policy is not found, existing rules for the case of temporary 505 message delivery failures apply (as discussed in [RFC5321] 506 section 4.5.4.1). 508 5. Reporting Failures 510 MTA-STS is intended to be used along with TLSRPT (TODO: add ref) in 511 order to ensure implementing domains can detect cases of both benign 512 and malicious failures, and to ensure that failures that indicate an 513 active attack are discoverable. As such, senders who also implement 514 TLSRPT SHOULD treat the following events as reportable failures: 516 o HTTPS policy fetch failures when a valid TXT record is present. 518 o Policy fetch failures of any kind when a valid policy exists in 519 the policy cache, except if that policy's mode is "none". 521 o Delivery attempts in which a contacted MX does not support 522 STARTTLS or does not present a certificate which validates 523 according to the applied policy, except if that policy's mode is 524 "none". 526 6. Operational Considerations 528 6.1. Policy Updates 530 Updating the policy requires that the owner make changes in two 531 places: the "_mta-sts" TXT record in the Policy Domain's DNS zone and 532 at the corresponding HTTPS endpoint. As a result, recipients should 533 expect a policy will continue to be used by senders until both the 534 HTTPS and TXT endpoints are updated and the TXT record's TTL has 535 passed. 537 In other words, a sender who is unable to successfully deliver a 538 message while applying a cache of the recipient's now-outdated policy 539 may be unable to discover that a new policy exists until the DNS TTL 540 has passed. Recipients should therefore ensure that old policies 541 continue to work for message delivery during this period of time, or 542 risk message delays. 544 Recipients should also prefer to update the HTTPS policy body before 545 updating the TXT record; this ordering avoids the risk that senders, 546 seeing a new TXT record, mistakenly cache the old policy from HTTPS. 548 6.2. Policy Delegation 550 Domain owners commonly delegate SMTP hosting to a different 551 organization, such as an ISP or a Web host. In such a case, they may 552 wish to also delegate the MTA-STS policy to the same organization 553 which can be accomplished with two changes. 555 First, the Policy Domain must point the "_mta-sts" record, via CNAME, 556 to the "_mta-sts" record maintained by the hosting organization. 557 This allows the hosting organization to control update signaling. 559 Second, the Policy Domain must point the "well-known" policy location 560 to the hosting organization. This can be done either by setting the 561 "mta-sts" record to a host or CNAME specified by the hosting 562 organization and by giving the hosting organization a TLS certificate 563 which is valid for that host, or by setting up a "reverse proxy" 564 (also known as a "gateway") server that serves as the Policy Domain's 565 policy the policy currently served by the hosting organization. 567 For example, given a user domain "user.com" hosted by a mail provider 568 "provider.com", the following configuration would allow policy 569 delegation: 571 DNS: 573 _mta-sts.user.com. IN CNAME _mta-sts.provider.com. 575 Policy: 577 > GET /.well-known/mta-sts.txt 578 > Host: mta-sts.user.com 579 < HTTP/1.1 200 OK # Response proxies content from https://mta-sts.provider.com 581 6.3. Removing MTA-STS 583 In order to facilitate clean opt-out of MTA-STS by implementing 584 policy domains, and to distinguish clearly between failures which 585 indicate attacks and those which indicate such opt-outs, MTA-STS 586 implements the "none" mode, which allows validated policies to 587 indicate authoritatively that the policy domain wishes to no longer 588 implement MTA-STS and may, in the future, remove the MTA-STS TXT and 589 policy endpoints entirely. 591 A suggested workflow to implement such an opt out is as follows: 593 1. Publish a new policy with "mode" equal to "none" and a small 594 "max_age" (e.g. one day). 596 2. Publish a new TXT record to trigger fetching of the new policy. 598 3. When all previously served policies have expired--normally this 599 is the time the previously published policy was last served plus 600 that policy's "max_age", but note that older policies may have 601 been served with a greater "max_age", allowing overlapping policy 602 caches--safely remove the TXT record and HTTPS endpoint. 604 7. IANA Considerations 606 7.1. Well-Known URIs Registry 608 A new .well-known URI will be registered in the Well-Known URIs 609 registry as described below: 611 URI Suffix: mta-sts.txt Change Controller: IETF 613 7.2. MTA-STS TXT Record Fields 615 IANA is requested to create a new registry titled "MTA-STS TXT Record 616 Fields". The initial entries in the registry are: 618 +------------+--------------------+------------------------+ 619 | Field Name | Description | Reference | 620 +------------+--------------------+------------------------+ 621 | v | Record version | Section 3.1 of RFC XXX | 622 | id | Policy instance ID | Section 3.1 of RFC XXX | 623 +------------+--------------------+------------------------+ 625 New fields are added to this registry using IANA's "Expert Review" 626 policy. 628 7.3. MTA-STS Policy Fields 630 IANA is requested to create a new registry titled "MTA-STS Policy 631 Fields". The initial entries in the registry are: 633 +------------+----------------------+------------------------+ 634 | Field Name | Description | Reference | 635 +------------+----------------------+------------------------+ 636 | version | Policy version | Section 3.2 of RFC XXX | 637 | mode | Enforcement behavior | Section 3.2 of RFC XXX | 638 | max_age | Policy lifetime | Section 3.2 of RFC XXX | 639 | mx | MX identities | Section 3.2 of RFC XXX | 640 +------------+----------------------+------------------------+ 642 New fields are added to this registry using IANA's "Expert Review" 643 policy. 645 8. Security Considerations 647 SMTP MTA Strict Transport Security attempts to protect against an 648 active attacker who wishes to intercept or tamper with mail between 649 hosts who support STARTTLS. There are two classes of attacks 650 considered: 652 o Foiling TLS negotiation, for example by deleting the "250 653 STARTTLS" response from a server or altering TLS session 654 negotiation. This would result in the SMTP session occurring over 655 plaintext, despite both parties supporting TLS. 657 o Impersonating the destination mail server, whereby the sender 658 might deliver the message to an impostor, who could then monitor 659 and/or modify messages despite opportunistic TLS. This 660 impersonation could be accomplished by spoofing the DNS MX record 661 for the recipient domain, or by redirecting client connections 662 intended for the legitimate recipient server (for example, by 663 altering BGP routing tables). 665 MTA-STS can thwart such attacks only if the sender is able to 666 previously obtain and cache a policy for the recipient domain, and 667 only if the attacker is unable to obtain a valid certificate that 668 complies with that policy. Below, we consider specific attacks on 669 this model. 671 8.1. Obtaining a Signed Certificate 673 SMTP MTA-STS relies on certificate validation via PKIX based TLS 674 identity checking [RFC6125]. Attackers who are able to obtain a 675 valid certificate for the targeted recipient mail service (e.g. by 676 compromising a certificate authority) are thus able to circumvent STS 677 authentication. 679 8.2. Preventing Policy Discovery 681 Since MTA-STS uses DNS TXT records for policy discovery, an attacker 682 who is able to block DNS responses can suppress the discovery of an 683 MTA-STS Policy, making the Policy Domain appear not to have an MTA- 684 STS Policy. The sender policy cache is designed to resist this 685 attack by decreasing the frequency of policy discovery and thus 686 reducing the window of vulnerability; it is nonetheless a risk that 687 attackers who can predict or induce policy discovery--for example, by 688 inducing a victim sending domain to send mail to a never-before- 689 contacted recipient while carrying out a man-in-the-middle attack-- 690 may be able to foil policy discovery and effectively downgrade the 691 security of the message delivery. 693 Since this attack depends upon intercepting initial policy discovery, 694 we strongly recommend implementers to prefer policy "max_age" values 695 to be as long as is practical. 697 Because this attack is also possible upon refresh of a cached policy, 698 we suggest implementers do not wait until a cached policy has expired 699 before checking for an update; if senders attempt to refresh the 700 cache regularly (for instance, by checking their cached version 701 string against the TXT record on each successful send, or in a 702 background task that runs daily or weekly), an attacker would have to 703 foil policy discovery consistently over the lifetime of a cached 704 policy to prevent a successful refresh. 706 Additionally, MTAs should alert administrators to repeated policy 707 refresh failures long before cached policies expire (through warning 708 logs or similar applicable mechanisms), allowing administrators to 709 detect such a persistent attack on policy refresh. (However, they 710 should not implement such alerts if the cached policy has a "none" 711 mode, to allow clean MTA-STS removal, as described in Section 6.3.) 712 Resistance to downgrade attacks of this nature--due to the ability to 713 authoritatively determine "lack of a record" even for non- 714 participating recipients--is a feature of DANE, due to its use of 715 DNSSEC for policy discovery. 717 8.3. Denial of Service 719 We additionally consider the Denial of Service risk posed by an 720 attacker who can modify the DNS records for a victim domain. Absent 721 MTA-STS, such an attacker can cause a sending MTA to cache invalid MX 722 records, but only for however long the sending resolver caches those 723 records. With MTA-STS, the attacker can additionally advertise a 724 new, long-"max_age" MTA-STS policy with "mx" constraints that 725 validate the malicious MX record, causing senders to cache the policy 726 and refuse to deliver messages once the victim has resecured the MX 727 records. 729 This attack is mitigated in part by the ability of a victim domain to 730 (at any time) publish a new policy updating the cached, malicious 731 policy, though this does require the victim domain to both obtain a 732 valid CA-signed certificate and to understand and properly configure 733 MTA-STS. 735 Similarly, we consider the possibility of domains that deliberately 736 allow untrusted users to serve untrusted content on user-specified 737 subdomains. In some cases (e.g. the service Tumblr.com) this takes 738 the form of providing HTTPS hosting of user-registered subdomains; in 739 other cases (e.g. dynamic DNS providers) this takes the form of 740 allowing untrusted users to register custom DNS records at the 741 provider's domain. 743 In these cases, there is a risk that untrusted users would be able to 744 serve custom content at the "mta-sts" host, including serving an 745 illegitimate MTA-STS policy. We believe this attack is rendered more 746 difficult by the need for the attacker to also serve the "_mta-sts" 747 TXT record on the same domain--something not, to our knowledge, 748 widely provided to untrusted users. This attack is additionally 749 mitigated by the aforementioned ability for a victim domain to update 750 an invalid policy at any future date. 752 8.4. Weak Policy Constraints 754 Even if an attacker cannot modify a served policy, the potential 755 exists for configurations that allow attackers on the same domain to 756 receive mail for that domain. For example, an easy configuration 757 option when authoring an MTA-STS Policy for "example.com" is to set 758 the "mx" equal to ".example.com"; recipient domains must consider in 759 this case the risk that any user possessing a valid hostname and CA- 760 signed certificate (for example, "dhcp-123.example.com") will, from 761 the perspective of MTA-STS Policy validation, be a valid MX host for 762 that domain. 764 8.5. Compromise of the Web PKI System 766 A host of risks apply to the PKI system used for certificate 767 authentication, both of the "mta-sts" HTTPS host's certificate and 768 the SMTP servers' certificates. These risks are broadly applicable 769 within the Web PKI ecosystem and are not specific to MTA-STS; 770 nonetheless, they deserve some consideration in this context. 772 Broadly speaking, attackers may compromise the system by obtaining 773 certificates under fraudulent circumstances (i.e. by impersonating 774 the legitimate owner of the victim domain), by compromising a 775 Certificate Authority or Delegate Authority's private keys, by 776 obtaining a legitimate certificate issued to the victim domain, and 777 similar. 779 One approach commonly employed by Web browsers to help mitigate 780 against some of these attacks is to allow for revocation of 781 compromised or fraudulent certificates via OCSP [RFC2560] or CRLs 782 [RFC6818]. Such mechanisms themselves represent tradeoffs and are 783 not universally implemented; we nonetheless recommend implementors of 784 MTA-STS to implement revocation mechanisms which are most applicable 785 to their implementations. 787 9. Contributors 789 Nicolas Lidzborski Google, Inc nlidz (at) google (dot com) 791 Wei Chuang Google, Inc weihaw (at) google (dot com) 793 Brandon Long Google, Inc blong (at) google (dot com) 795 Franck Martin LinkedIn, Inc fmartin (at) linkedin (dot com) 797 Klaus Umbach 1&1 Mail & Media Development & Technology GmbH 798 klaus.umbach (at) 1und1 (dot de) 800 Markus Laber 1&1 Mail & Media Development & Technology GmbH 801 markus.laber (at) 1und1 (dot de) 803 10. Appendix 1: MTA-STS example record & policy 805 The owner of "example.com" wishes to begin using MTA-STS with a 806 policy that will solicit reports from senders without affecting how 807 the messages are processed, in order to verify the identity of MXs 808 that handle mail for "example.com", confirm that TLS is correctly 809 used, and ensure that certificates presented by the recipient MX 810 validate. 812 MTA-STS policy indicator TXT RR: 814 _mta-sts.example.com. IN TXT "v=STSv1; id=20160831085700Z;" 816 MTA-STS Policy file served as the response body at 819 version: STSv1 820 mode: report 821 mx: mx1.example.com 822 mx: mx2.example.com 823 mx: mx.backup-example.com 824 max_age: 12345678 826 11. Appendix 2: Message delivery pseudocode 828 Below is pseudocode demonstrating the logic of a compliant sending 829 MTA. 831 While this pseudocode implementation suggests synchronous policy 832 retrieval in the delivery path, in a working implementation that may 833 be undesirable, and we expect some implementers to instead prefer a 834 background fetch that does not block delivery if no cached policy is 835 present. 837 func isEnforce(policy) { 838 // Return true if the policy mode is "enforce". 839 } 841 func isNonExpired(policy) { 842 // Return true if the policy is not expired. 843 } 845 func tryStartTls(connection) { 846 // Attempt to open an SMTP connection with STARTTLS with the MX. 847 } 849 func isWildcardMatch(pat, host) { 850 // Literal matches are true. 851 if pat == host { 852 return true 853 } 854 // Leading '.' matches a wildcard against the first part, i.e. 856 // .example.com matches x.example.com but not x.y.example.com. 857 if pat[0] == '.' { 858 parts = SplitN(host, '.', 2) // Split on the first '.'. 859 if len(parts) > 1 && parts[1] == pat[1:] { 860 return true 861 } 862 } 863 return false 864 } 866 func certMatches(connection, policy) { 867 // Assume a handy function to return CN and DNS-ID SANs. 868 for san in getDnsIdSansAndCnFromCert(connection) { 869 for mx in policy.mx { 870 // Return if the server certificate from "connection" matches the "mx" host. 871 if san[0] == '*' { 872 // Invalid wildcard! 873 if san[1] != '.' continue 874 san = san[1:] 875 } 876 if isWildcardMatch(san, mx) || isWildcardMatch(mx, san) { 877 return true 878 } 879 } 880 } 881 return false 882 } 884 func tryDeliverMail(connection, message) { 885 // Attempt to deliver "message" via "connection". 886 } 888 func tryGetNewPolicy(domain) { 889 // Check for an MTA-STS TXT record for "domain" in DNS, and return the 890 // indicated policy. 891 } 893 func cachePolicy(domain, policy) { 894 // Store "policy" as the cached policy for "domain". 895 } 897 func tryGetCachedPolicy(domain) { 898 // Return a cached policy for "domain". 899 } 901 func reportError(error) { 902 // Report an error via TLSRPT. 903 } 904 func tryMxAccordingTo(message, mx, policy) { 905 connection := connect(mx) 906 if !connection { 907 return false // Can't connect to the MX so it's not an MTA-STS error. 908 } 909 secure := true 910 if !tryStartTls(connection) { 911 secure = false 912 reportError(E_NO_VALID_TLS) 913 } else if !certMatches(connection, policy) { 914 secure = false 915 reportError(E_CERT_MISMATCH) 916 } 917 if secure || !isEnforce(policy) { 918 return tryDeliverMail(connection, message) 919 } 920 return false 921 } 923 func tryWithPolicy(message, domain, policy) { 924 mxes := getMxForDomain(domain) 925 for mx in mxes { 926 if tryMxAccordingTo(message, mx, policy) { 927 return true 928 } 929 } 930 return false 931 } 933 func handleMessage(message) { 934 domain := ... // domain part after '@' from recipient 935 policy := tryGetNewPolicy(domain) 936 if policy { 937 cachePolicy(domain, policy) 938 } else { 939 policy = tryGetCachedPolicy(domain) 940 } 941 if policy { 942 return tryWithPolicy(message, domain, policy) 943 } 944 // Try to deliver the message normally (i.e. without MTA-STS). 945 } 946 12. References 948 12.1. Normative References 950 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 951 Requirement Levels", BCP 14, RFC 2119, 952 DOI 10.17487/RFC2119, March 1997, . 955 [RFC3492] Costello, A., "Punycode: A Bootstring encoding of Unicode 956 for Internationalized Domain Names in Applications 957 (IDNA)", RFC 3492, DOI 10.17487/RFC3492, March 2003, 958 . 960 [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., 961 Housley, R., and W. Polk, "Internet X.509 Public Key 962 Infrastructure Certificate and Certificate Revocation List 963 (CRL) Profile", RFC 5280, DOI 10.17487/RFC5280, May 2008, 964 . 966 [RFC5321] Klensin, J., "Simple Mail Transfer Protocol", RFC 5321, 967 DOI 10.17487/RFC5321, October 2008, . 970 [RFC5785] Nottingham, M. and E. Hammer-Lahav, "Defining Well-Known 971 Uniform Resource Identifiers (URIs)", RFC 5785, 972 DOI 10.17487/RFC5785, April 2010, . 975 [RFC6125] Saint-Andre, P. and J. Hodges, "Representation and 976 Verification of Domain-Based Application Service Identity 977 within Internet Public Key Infrastructure Using X.509 978 (PKIX) Certificates in the Context of Transport Layer 979 Security (TLS)", RFC 6125, DOI 10.17487/RFC6125, March 980 2011, . 982 [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 983 Protocol (HTTP/1.1): Semantics and Content", RFC 7231, 984 DOI 10.17487/RFC7231, June 2014, . 987 [RFC7405] Kyzivat, P., "Case-Sensitive String Support in ABNF", 988 RFC 7405, DOI 10.17487/RFC7405, December 2014, 989 . 991 12.2. Informative References 993 [RFC2560] Myers, M., Ankney, R., Malpani, A., Galperin, S., and C. 994 Adams, "X.509 Internet Public Key Infrastructure Online 995 Certificate Status Protocol - OCSP", RFC 2560, 996 DOI 10.17487/RFC2560, June 1999, . 999 [RFC3207] Hoffman, P., "SMTP Service Extension for Secure SMTP over 1000 Transport Layer Security", RFC 3207, DOI 10.17487/RFC3207, 1001 February 2002, . 1003 [RFC4033] Arends, R., Austein, R., Larson, M., Massey, D., and S. 1004 Rose, "DNS Security Introduction and Requirements", 1005 RFC 4033, DOI 10.17487/RFC4033, March 2005, 1006 . 1008 [RFC5322] Resnick, P., Ed., "Internet Message Format", RFC 5322, 1009 DOI 10.17487/RFC5322, October 2008, . 1012 [RFC5891] Klensin, J., "Internationalized Domain Names in 1013 Applications (IDNA): Protocol", RFC 5891, 1014 DOI 10.17487/RFC5891, August 2010, . 1017 [RFC6818] Yee, P., "Updates to the Internet X.509 Public Key 1018 Infrastructure Certificate and Certificate Revocation List 1019 (CRL) Profile", RFC 6818, DOI 10.17487/RFC6818, January 1020 2013, . 1022 [RFC7234] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, 1023 Ed., "Hypertext Transfer Protocol (HTTP/1.1): Caching", 1024 RFC 7234, DOI 10.17487/RFC7234, June 2014, 1025 . 1027 [RFC7672] Dukhovni, V. and W. Hardaker, "SMTP Security via 1028 Opportunistic DNS-Based Authentication of Named Entities 1029 (DANE) Transport Layer Security (TLS)", RFC 7672, 1030 DOI 10.17487/RFC7672, October 2015, . 1033 Authors' Addresses 1035 Daniel Margolis 1036 Google, Inc 1038 Email: dmargolis (at) google.com 1039 Mark Risher 1040 Google, Inc 1042 Email: risher (at) google (dot com) 1044 Binu Ramakrishnan 1045 Yahoo!, Inc 1047 Email: rbinu (at) yahoo-inc (dot com) 1049 Alexander Brotman 1050 Comcast, Inc 1052 Email: alex_brotman (at) comcast.com 1054 Janet Jones 1055 Microsoft, Inc 1057 Email: janet.jones (at) microsoft (dot com)