draft-ietf-uta-mta-sts-21.txt   rfc8461.txt 
Using TLS in Applications D. Margolis Internet Engineering Task Force (IETF) D. Margolis
Internet-Draft M. Risher Request for Comments: 8461 M. Risher
Intended status: Standards Track Google, Inc Category: Standards Track Google, Inc.
Expires: December 18, 2018 B. Ramakrishnan ISSN: 2070-1721 B. Ramakrishnan
Yahoo!, Inc Oath, Inc.
A. Brotman A. Brotman
Comcast, Inc Comcast, Inc.
J. Jones J. Jones
Microsoft, Inc Microsoft, Inc.
June 16, 2018 September 2018
SMTP MTA Strict Transport Security (MTA-STS) SMTP MTA Strict Transport Security (MTA-STS)
draft-ietf-uta-mta-sts-21
Abstract Abstract
SMTP Mail Transfer Agent Strict Transport Security (MTA-STS) is a SMTP MTA Strict Transport Security (MTA-STS) is a mechanism enabling
mechanism enabling mail service providers to declare their ability to mail service providers (SPs) to declare their ability to receive
receive Transport Layer Security (TLS) secure SMTP connections, and Transport Layer Security (TLS) secure SMTP connections and to specify
to specify whether sending SMTP servers should refuse to deliver to whether sending SMTP servers should refuse to deliver to MX hosts
MX hosts that do not offer TLS with a trusted server certificate. that do not offer TLS with a trusted server certificate.
Status of This Memo Status of This Memo
This Internet-Draft is submitted in full conformance with the This is an Internet Standards Track document.
provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months This document is a product of the Internet Engineering Task Force
and may be updated, replaced, or obsoleted by other documents at any (IETF). It represents the consensus of the IETF community. It has
time. It is inappropriate to use Internet-Drafts as reference received public review and has been approved for publication by the
material or to cite them other than as "work in progress." Internet Engineering Steering Group (IESG). Further information on
Internet Standards is available in Section 2 of RFC 7841.
This Internet-Draft will expire on December 18, 2018. Information about the current status of this document, any errata,
and how to provide feedback on it may be obtained at
https://www.rfc-editor.org/info/rfc8461.
Copyright Notice Copyright Notice
Copyright (c) 2018 IETF Trust and the persons identified as the Copyright (c) 2018 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of (https://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License. described in the Simplified BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . 3 1.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . 4
2. Related Technologies . . . . . . . . . . . . . . . . . . . . 4 2. Related Technologies . . . . . . . . . . . . . . . . . . . . 5
3. Policy Discovery . . . . . . . . . . . . . . . . . . . . . . 4 3. Policy Discovery . . . . . . . . . . . . . . . . . . . . . . 5
3.1. MTA-STS TXT Records . . . . . . . . . . . . . . . . . . . 4 3.1. MTA-STS TXT Records . . . . . . . . . . . . . . . . . . . 6
3.2. MTA-STS Policies . . . . . . . . . . . . . . . . . . . . 6 3.2. MTA-STS Policies . . . . . . . . . . . . . . . . . . . . 7
3.3. HTTPS Policy Fetching . . . . . . . . . . . . . . . . . . 9 3.3. HTTPS Policy Fetching . . . . . . . . . . . . . . . . . . 10
3.4. Policy Selection for Smart Hosts and Subdomains . . . . . 10 3.4. Policy Selection for Smart Hosts and Subdomains . . . . . 11
4. Policy Validation . . . . . . . . . . . . . . . . . . . . . . 10 4. Policy Validation . . . . . . . . . . . . . . . . . . . . . . 11
4.1. MX Host Validation . . . . . . . . . . . . . . . . . . . 11 4.1. MX Host Validation . . . . . . . . . . . . . . . . . . . 12
4.2. Recipient MTA Certificate Validation . . . . . . . . . . 11 4.2. Recipient MTA Certificate Validation . . . . . . . . . . 12
5. Policy Application . . . . . . . . . . . . . . . . . . . . . 11 5. Policy Application . . . . . . . . . . . . . . . . . . . . . 12
5.1. Policy Application Control Flow . . . . . . . . . . . . . 12 5.1. Policy Application Control Flow . . . . . . . . . . . . . 13
6. Reporting Failures . . . . . . . . . . . . . . . . . . . . . 12 6. Reporting Failures . . . . . . . . . . . . . . . . . . . . . 13
7. Interoperability Considerations . . . . . . . . . . . . . . . 13 7. Interoperability Considerations . . . . . . . . . . . . . . . 14
7.1. SNI Support . . . . . . . . . . . . . . . . . . . . . . . 13 7.1. SNI Support . . . . . . . . . . . . . . . . . . . . . . . 14
7.2. Minimum TLS Version Support . . . . . . . . . . . . . . . 13 7.2. Minimum TLS Version Support . . . . . . . . . . . . . . . 14
8. Operational Considerations . . . . . . . . . . . . . . . . . 14 8. Operational Considerations . . . . . . . . . . . . . . . . . 15
8.1. Policy Updates . . . . . . . . . . . . . . . . . . . . . 14 8.1. Policy Updates . . . . . . . . . . . . . . . . . . . . . 15
8.2. Policy Delegation . . . . . . . . . . . . . . . . . . . . 14 8.2. Policy Delegation . . . . . . . . . . . . . . . . . . . . 15
8.3. Removing MTA-STS . . . . . . . . . . . . . . . . . . . . 15 8.3. Removing MTA-STS . . . . . . . . . . . . . . . . . . . . 16
8.4. Preserving MX Candidate Traversal . . . . . . . . . . . . 16 8.4. Preserving MX Candidate Traversal . . . . . . . . . . . . 17
9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 16 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 17
9.1. Well-Known URIs Registry . . . . . . . . . . . . . . . . 16 9.1. Well-Known URIs Registry . . . . . . . . . . . . . . . . 17
9.2. MTA-STS TXT Record Fields . . . . . . . . . . . . . . . . 16 9.2. MTA-STS TXT Record Fields . . . . . . . . . . . . . . . . 17
9.3. MTA-STS Policy Fields . . . . . . . . . . . . . . . . . . 17 9.3. MTA-STS Policy Fields . . . . . . . . . . . . . . . . . . 18
10. Security Considerations . . . . . . . . . . . . . . . . . . . 17 10. Security Considerations . . . . . . . . . . . . . . . . . . . 18
10.1. Obtaining a Signed Certificate . . . . . . . . . . . . . 17 10.1. Obtaining a Signed Certificate . . . . . . . . . . . . . 18
10.2. Preventing Policy Discovery . . . . . . . . . . . . . . 18 10.2. Preventing Policy Discovery . . . . . . . . . . . . . . 19
10.3. Denial of Service . . . . . . . . . . . . . . . . . . . 18 10.3. Denial of Service . . . . . . . . . . . . . . . . . . . 19
10.4. Weak Policy Constraints . . . . . . . . . . . . . . . . 19 10.4. Weak Policy Constraints . . . . . . . . . . . . . . . . 20
10.5. Compromise of the Web PKI System . . . . . . . . . . . . 19 10.5. Compromise of the Web PKI System . . . . . . . . . . . . 20
11. Contributors . . . . . . . . . . . . . . . . . . . . . . . . 20 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 21
12. References . . . . . . . . . . . . . . . . . . . . . . . . . 20 11.1. Normative References . . . . . . . . . . . . . . . . . . 21
12.1. Normative References . . . . . . . . . . . . . . . . . . 20 11.2. Informative References . . . . . . . . . . . . . . . . . 23
12.2. Informative References . . . . . . . . . . . . . . . . . 22 Appendix A. MTA-STS Example Record and Policy . . . . . . . . . 25
Appendix A. MTA-STS example record & policy . . . . . . . . . . 23 Appendix B. Message Delivery Pseudocode . . . . . . . . . . . . 25
Appendix B. Message delivery pseudocode . . . . . . . . . . . . 23 Contributors . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 26 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 29
1. Introduction 1. Introduction
The STARTTLS extension to SMTP [RFC3207] allows SMTP clients and The STARTTLS extension to SMTP [RFC3207] allows SMTP clients and
hosts to negotiate the use of a TLS channel for encrypted mail hosts to negotiate the use of a TLS channel for encrypted mail
transmission. transmission.
While this opportunistic encryption protocol by itself provides a While this opportunistic encryption protocol by itself provides a
high barrier against passive man-in-the-middle traffic interception, high barrier against passive man-in-the-middle traffic interception,
any attacker who can delete parts of the SMTP session (such as the any attacker who can delete parts of the SMTP session (such as the
skipping to change at page 3, line 32 skipping to change at page 4, line 32
authenticated TLS support authenticated TLS support
o what a conforming client should do with messages when TLS cannot o what a conforming client should do with messages when TLS cannot
be successfully negotiated be successfully negotiated
1.1. Terminology 1.1. Terminology
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
"OPTIONAL" in this document are to be interpreted as described in "OPTIONAL" in this document are to be interpreted as described in
[BCP 14] [RFC2119] [RFC8174] when, and only when, they appear in all BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all
capitals, as shown here. capitals, as shown here.
We also define the following terms for further use in this document: We also define the following terms for further use in this document:
o MTA-STS Policy: A commitment by the Policy Domain to support PKIX o MTA-STS Policy: A commitment by the Policy Domain to support TLS
[RFC5280] authenticated TLS for the specified MX hosts. authenticated with PKIX [RFC5280] for the specified MX hosts.
o Policy Domain: The domain for which an MTA-STS Policy is defined. o Policy Domain: The domain for which an MTA-STS Policy is defined.
This is the next-hop domain; when sending mail to This is the next-hop domain; when sending mail to
"alice@example.com" this would ordinarily be "example.com", but "alice@example.com", this would ordinarily be "example.com", but
this may be overridden by explicit routing rules (as described in this may be overridden by explicit routing rules (as described in
Section 3.4, "Policy Selection for Smart Hosts and Subdomains"). Section 3.4, "Policy Selection for Smart Hosts and Subdomains").
o Policy Host: The HTTPS host which serves the MTA-STS Policy for a o Policy Host: The HTTPS host that serves the MTA-STS Policy for a
Policy Domain. Rules for constructing the hostname are described Policy Domain. Rules for constructing the hostname are described
in Section 3.2, "MTA-STS Policies". in Section 3.2, "MTA-STS Policies".
o Sender: The SMTP Mail Transfer Agent sending an email message. o Sender or Sending MTA: The SMTP MTA sending an email message.
o ABNF: Augmented Backus-Naur Form, a syntax for formally specifying o ABNF: Augmented Backus-Naur Form, a syntax for formally specifying
syntax, defined in [RFC5234] and [RFC7405]. syntax, defined in [RFC5234] and [RFC7405].
2. Related Technologies 2. Related Technologies
The DANE TLSA record [RFC7672] is similar, in that DANE is also The DNS-Based Authentication of a Named Entities (DANE) TLSA record
designed to upgrade unauthenticated encryption or plaintext [RFC7672] is similar, in that DANE is also designed to upgrade
transmission into authenticated, downgrade-resistant encrypted unauthenticated encryption or plaintext transmission into
transmission. DANE requires DNSSEC [RFC4033] for authentication; the authenticated, downgrade-resistant encrypted transmission. DANE
mechanism described here instead relies on certificate authorities requires DNSSEC [RFC4033] for authentication; the mechanism described
(CAs) and does not require DNSSEC, at a cost of risking malicious here instead relies on certification authorities (CAs) and does not
downgrades. For a thorough discussion of this trade-off, see require DNSSEC, at a cost of risking malicious downgrades. For a
Section 10, "Security Considerations". thorough discussion of this trade-off, see Section 10, "Security
Considerations".
In addition, MTA-STS provides an optional testing-only mode, enabling In addition, MTA-STS provides an optional testing-only mode, enabling
soft deployments to detect policy failures; partial deployments can soft deployments to detect policy failures; partial deployments can
be achieved in DANE by deploying TLSA records only for some of a be achieved in DANE by deploying TLSA records only for some of a
domain's MXs, but such a mechanism is not possible for the per-domain domain's MXes, but such a mechanism is not possible for the per-
policies used by MTA-STS. domain policies used by MTA-STS.
The primary motivation of MTA-STS is to provide a mechanism for The primary motivation of MTA-STS is to provide a mechanism for
domains to ensure transport security even when deploying DNSSEC is domains to ensure transport security even when deploying DNSSEC is
undesirable or impractical. However, MTA-STS is designed not to undesirable or impractical. However, MTA-STS is designed not to
interfere with DANE deployments when the two overlap; in particular, interfere with DANE deployments when the two overlap; in particular,
senders who implement MTA-STS validation MUST NOT allow a "valid" or senders who implement MTA-STS validation MUST NOT allow MTA-STS
"testing"-only MTA-STS validation to override a failing DANE Policy validation to override a failing DANE validation.
validation.
3. Policy Discovery 3. Policy Discovery
MTA-STS policies are distributed via HTTPS from a "well-known" MTA-STS policies are distributed via HTTPS from a "well-known"
[RFC5785] path served within the Policy Domain, and their presence [RFC5785] path served within the Policy Domain, and their presence
and current version are indicated by a TXT record at the Policy and current version are indicated by a TXT record at the Policy
Domain. These TXT records additionally contain a policy "id" field, Domain. These TXT records additionally contain a policy "id" field,
allowing sending MTAs to check the currency of a cached policy allowing Sending MTAs to check that a cached policy is still current
without performing an HTTPS request. without performing an HTTPS request.
To discover if a recipient domain implements MTA-STS, a sender need To discover if a recipient domain implements MTA-STS, a sender need
only resolve a single TXT record. To see if an updated policy is only resolve a single TXT record. To see if an updated policy is
available for a domain for which the sender has a previously cached available for a domain for which the sender has a previously cached
policy, the sender need only check the TXT record's version "id" policy, the sender need only check the TXT record's version "id"
against the cached value. against the cached value.
3.1. MTA-STS TXT Records 3.1. MTA-STS TXT Records
The MTA-STS TXT record is a TXT record with the name "_mta-sts" at The MTA-STS TXT record is a TXT record with the name "_mta-sts" at
the Policy Domain. For the domain "example.com", this record would the Policy Domain. For the domain "example.com", this record would
be "_mta-sts.example.com". MTA-STS TXT records MUST be US-ASCII, be "_mta-sts.example.com". MTA-STS TXT records MUST be US-ASCII,
semicolon-separated key/value pairs containing the following fields: semicolon-separated key/value pairs containing the following fields:
o "v": (plain-text, required). Currently only "STSv1" is supported. o "v" (plaintext, required): Currently, only "STSv1" is supported.
o "id": (plain-text, required). A short string used to track policy o "id" (plaintext, required): A short string used to track policy
updates. This string MUST uniquely identify a given instance of a updates. This string MUST uniquely identify a given instance of a
policy, such that senders can determine when the policy has been policy, such that senders can determine when the policy has been
updated by comparing to the "id" of a previously seen policy. updated by comparing to the "id" of a previously seen policy.
There is no implied ordering of "id" fields between revisions. There is no implied ordering of "id" fields between revisions.
An example TXT record is as below: An example TXT record is as below:
_mta-sts.example.com. IN TXT "v=STSv1; id=20160831085700Z;" _mta-sts.example.com. IN TXT "v=STSv1; id=20160831085700Z;"
The formal definition of the "_mta-sts" TXT record, defined using The formal definition of the "_mta-sts" TXT record, defined using
ABNF ([RFC7405]), is as follows: ABNF [RFC7405], is as follows:
sts-text-record = sts-version 1*(sts-field-delim sts-field) sts-text-record = sts-version 1*(sts-field-delim sts-field)
[sts-field-delim] [sts-field-delim]
sts-field = sts-id / ; Note that sts-id record sts-field = sts-id / ; Note that sts-id record
sts-extension ; is required. sts-extension ; is required.
sts-field-delim = *WSP ";" *WSP sts-field-delim = *WSP ";" *WSP
sts-version = %s"v=STSv1" sts-version = %s"v=STSv1"
skipping to change at page 5, line 42 skipping to change at page 6, line 47
sts-id = %s"id=" 1*32(ALPHA / DIGIT) ; id=... sts-id = %s"id=" 1*32(ALPHA / DIGIT) ; id=...
sts-extension = sts-ext-name "=" sts-ext-value ; name=value sts-extension = sts-ext-name "=" sts-ext-value ; name=value
sts-ext-name = (ALPHA / DIGIT) sts-ext-name = (ALPHA / DIGIT)
*31(ALPHA / DIGIT / "_" / "-" / ".") *31(ALPHA / DIGIT / "_" / "-" / ".")
sts-ext-value = 1*(%x21-3A / %x3C / %x3E-7E) sts-ext-value = 1*(%x21-3A / %x3C / %x3E-7E)
; chars excluding "=", ";", SP, and CTLs ; chars excluding "=", ";", SP, and CTLs
The TXT record MUST begin with sts-version field, and the order of The TXT record MUST begin with the sts-version field; the order of
other fields is not significant. If multiple TXT records for "_mta- other fields is not significant. If multiple TXT records for
sts" are returned by the resolver, records which do not begin with "_mta-sts" are returned by the resolver, records that do not begin
"v=STSv1;" are discarded. If the number of resulting records is not with "v=STSv1;" are discarded. If the number of resulting records is
one, or if the resulting record is syntactically invalid, senders not one, or if the resulting record is syntactically invalid, senders
MUST assume the recipient domain does not have an available MTA-STS MUST assume the recipient domain does not have an available MTA-STS
policy and skip the remaining steps of policy discovery. (Note that Policy and skip the remaining steps of policy discovery. (Note that
absence of a usable TXT record is not by itself sufficient to remove the absence of a usable TXT record is not by itself sufficient to
a sender's previously cached policy for the Policy Domain, as remove a sender's previously cached policy for the Policy Domain, as
discussed in Section 5.1, "Policy Application Control Flow".) If the discussed in Section 5.1, "Policy Application Control Flow".) If the
resulting TXT record contains multiple strings, then the record MUST resulting TXT record contains multiple strings, then the record MUST
be treated as if those strings are concatenated together without be treated as if those strings are concatenated without adding
adding spaces. spaces.
The "_mta-sts" record MAY return a CNAME that points (directly or via
other CNAMEs) to a TXT record, in which case senders MUST follow the
CNAME pointers. This can be used for policy delegation, as described
in Section 8.2.
3.2. MTA-STS Policies 3.2. MTA-STS Policies
The policy itself is a set of key/value pairs (similar to [RFC5322] The policy itself is a set of key/value pairs (similar to header
header fields) served via the HTTPS GET method from the fixed fields in [RFC5322]) served via the HTTPS GET method from the fixed
[RFC5785] "well-known" path of ".well-known/mta-sts.txt" served by "well-known" [RFC5785] path of ".well-known/mta-sts.txt" served by
the Policy Host. The Policy Host DNS name is constructed by the Policy Host. The Policy Host DNS name is constructed by
prepending "mta-sts" to the Policy Domain. prepending "mta-sts" to the Policy Domain.
Thus for a Policy Domain of "example.com" the full URL is Thus, for a Policy Domain of "example.com", the full URL is
"https://mta-sts.example.com/.well-known/mta-sts.txt". "https://mta-sts.example.com/.well-known/mta-sts.txt".
When fetching a policy, senders SHOULD validate that the media type When fetching a policy, senders SHOULD validate that the media type
is "text/plain" to guard against cases where webservers allow is "text/plain" to guard against cases where web servers allow
untrusted users to host non-text content (typically, HTML or images) untrusted users to host non-text content (typically, HTML or images)
at a user-defined path. All parameters other than charset=utf-8 or at a user-defined path. All parameters other than charset=utf-8 or
charset=us-ascii are ignored. Additional "Content-Type" parameters charset=us-ascii are ignored. Additional "Content-Type" parameters
are also ignored. are also ignored.
This resource contains the following CRLF-separated key/value pairs: This resource contains the following CRLF-separated key/value pairs:
o "version": Currently only "STSv1" is supported. o "version": Currently, only "STSv1" is supported.
o "mode": One of "enforce", "testing", or "none", indicating the o "mode": One of "enforce", "testing", or "none", indicating the
expected behavior of a sending MTA in the case of a policy expected behavior of a Sending MTA in the case of a policy
validation failure. See Section 5, "Policy Application." for more validation failure. See Section 5, "Policy Application", for more
details about the three modes. details about the three modes.
o "max_age": Max lifetime of the policy (plain-text non-negative o "max_age": Max lifetime of the policy (plaintext non-negative
integer seconds, maximum value of 31557600). Well-behaved clients integer seconds, maximum value of 31557600). Well-behaved clients
SHOULD cache a policy for up to this value from last policy fetch SHOULD cache a policy for up to this value from the last policy
time. To mitigate the risks of attacks at policy refresh time, it fetch time. To mitigate the risks of attacks at policy refresh
is expected that this value typically be in the range of weeks or time, it is expected that this value typically be in the range of
greater. weeks or greater.
o "mx": Allowed MX patterns. One or more patterns matching allowed o "mx": Allowed MX patterns. One or more patterns matching allowed
MX hosts for the Policy Domain. As an example, MX hosts for the Policy Domain. As an example,
mx: mail.example.com <CRLF> mx: mail.example.com <CRLF>
mx: *.example.net mx: *.example.net
indicates that mail for this domain might be handled by MX indicates that mail for this domain might be handled by MX
"mail.example.com" or any MX at "example.net". Valid patterns can be "mail.example.com" or any MX at "example.net". Valid patterns can be
either fully specified names ("example.com") or suffixes prefixed by either fully specified names ("example.com") or suffixes prefixed by
a wildcard ("*.example.net"). If a policy specifies more than one a wildcard ("*.example.net"). If a policy specifies more than one
MX, each MX MUST have its own "mx:" key, and each MX key/value pair MX, each MX MUST have its own "mx:" key, and each MX key/value pair
MUST be on its own line in the policy file. In the case of MUST be on its own line in the policy file. In the case of
Internationalized Domain Names ([RFC5891]), the "mx" value MUST Internationalized Domain Names [RFC5891], the "mx" value MUST specify
specify the Punycode-encoded A-label [RFC3492] to match against, and the Punycode-encoded A-label [RFC3492] to match against, and not the
not the Unicode-encoded U-label. The full semantics of certificate Unicode-encoded U-label. The full semantics of certificate
validation (including the use of wildcard patterns) are described in validation (including the use of wildcard patterns) are described in
Section 4.1, "MX Host Validation." Section 4.1, "MX Host Validation".
An example policy is as below: An example policy is as below:
version: STSv1 version: STSv1
mode: enforce mode: enforce
mx: mail.example.com mx: mail.example.com
mx: *.example.net mx: *.example.net
mx: backupmx.example.com mx: backupmx.example.com
max_age: 604800 max_age: 604800
The formal definition of the policy resource, defined using The formal definition of the policy resource, defined using ABNF
[RFC7405], is as follows: [RFC7405], is as follows:
sts-policy-record = sts-policy-field *WSP sts-policy-record = sts-policy-field *WSP
*(sts-policy-term sts-policy-field *WSP) *(sts-policy-term sts-policy-field *WSP)
[sts-policy-term] [sts-policy-term]
sts-policy-field = sts-policy-version / ; required once sts-policy-field = sts-policy-version / ; required once
sts-policy-mode / ; required once sts-policy-mode / ; required once
sts-policy-max-age / ; required once sts-policy-max-age / ; required once
sts-policy-mx /
sts-policy-term /
; required at least once, except when ; required at least once, except when
; mode is "none" ; mode is "none"
sts-policy-extension ; other fields sts-policy-extension ; other fields
sts-policy-field-delim = ":" *WSP sts-policy-field-delim = ":" *WSP
sts-policy-version = sts-policy-version-field sts-policy-field-delim sts-policy-version = sts-policy-version-field sts-policy-field-delim
sts-policy-version-value sts-policy-version-value
sts-policy-version-field = %s"version" sts-policy-version-field = %s"version"
sts-policy-version-value = %s"STSv1" sts-policy-version-value = %s"STSv1"
sts-policy-mode = sts-policy-mode-field sts-policy-field-delim sts-policy-mode = sts-policy-mode-field sts-policy-field-delim
sts-policy-mode-value sts-policy-mode-value
sts-policy-mode-field = %s"mode" sts-policy-mode-field = %s"mode"
sts-policy-mode-value = %s"testing" / %s"enforce" / %s"none" sts-policy-mode-value = %s"testing" / %s"enforce" / %s"none"
sts-policy-mx = sts-policy-mx-field sts-policy-field-delim sts-policy-mx = sts-policy-mx-field sts-policy-field-delim
sts-policy-mx-value sts-policy-mx-value
sts-policy-mx-field = %s"mx" sts-policy-mx-field = %s"mx"
sts-policy-mx-value = ["."] Domain sts-policy-mx-value = ["*."] Domain
sts-policy-mx-label = sts-policy-alphanum /
sts-policy-alphanum *(sts-policy-alphanum / "-")
sts-policy-alphanum
sts-policy-mx-toplabel = ALPHA / ALPHA *(sts-policy-alphanum / "-")
sts-policy-alphanum
sts-policy-max-age = sts-policy-max-age-field sts-policy-field-delim sts-policy-max-age = sts-policy-max-age-field sts-policy-field-delim
sts-policy-max-age-value sts-policy-max-age-value
sts-policy-max-age-field = %s"max_age" sts-policy-max-age-field = %s"max_age"
sts-policy-max-age-value = 1*10(DIGIT) sts-policy-max-age-value = 1*10(DIGIT)
sts-policy-extension = sts-policy-ext-name ; additional sts-policy-extension = sts-policy-ext-name ; additional
sts-policy-field-delim ; extension sts-policy-field-delim ; extension
sts-policy-ext-value ; fields sts-policy-ext-value ; fields
sts-policy-ext-name = (sts-policy-alphanum) sts-policy-ext-name = (sts-policy-alphanum)
*31(sta-policy-alphanum / "_" / "-" / ".") *31(sta-policy-alphanum / "_" / "-" / ".")
sts-policy-term = LF / CRLF sts-policy-term = LF / CRLF
sts-policy-ext-value = sts-policy-vchar sts-policy-ext-value = sts-policy-vchar
[*(%x20 / sts-policy-vchar) [*(%x20 / sts-policy-vchar)
sts-policy-vchar] sts-policy-vchar]
; chars, including UTF-8 [@!RFC3629], ; chars, including UTF-8 [RFC3629],
; excluding CTLs and no ; excluding CTLs and no
; leading/trailing spaces ; leading/trailing spaces
sts-policy-alphanum = ALPHA / DIGIT sts-policy-alphanum = ALPHA / DIGIT
sts-policy-vchar = %x21-7E / UTF8-2 / UTF8-3 / UTF8-4 sts-policy-vchar = %x21-7E / UTF8-2 / UTF8-3 / UTF8-4
UTF8-2 = <Defined in Section 4 of [@!RFC3629]> UTF8-2 = <Defined in Section 4 of [RFC3629]>
UTF8-3 = <Defined in Section 4 of [@!RFC3629]> UTF8-3 = <Defined in Section 4 of [RFC3629]>
UTF8-4 = <Defined in Section 4 of [@!RFC3629]> UTF8-4 = <Defined in Section 4 of [RFC3629]>
Domain = <see RFC 5321 4.1.2> Domain = <Defined in Section 4.1.2 of [RFC5321]>
Parsers MUST accept TXT records and policy files which are Parsers MUST accept TXT records and policy files that are
syntactically valid (i.e., valid key/value pairs separated by semi- syntactically valid (i.e., valid key/value pairs separated by
colons for TXT records), possibly containing additional key/value semicolons for TXT records), possibly containing additional key/value
pairs not specified in this document, in which case unknown fields pairs not specified in this document, in which case unknown fields
SHALL be ignored. If any non-repeated field--i.e., all fields SHALL be ignored. If any non-repeated field -- i.e., all fields
excepting "mx"--is duplicated, all entries except for the first SHALL excepting "mx" -- is duplicated, all entries except for the first
be ignored. SHALL be ignored.
3.3. HTTPS Policy Fetching 3.3. HTTPS Policy Fetching
Policy bodies are, as described above, retrieved by sending MTAs via Policy bodies are, as described above, retrieved by Sending MTAs via
HTTPS [RFC2818]. During the TLS handshake initiated to fetch a new HTTPS [RFC2818]. During the TLS handshake initiated to fetch a new
or updated policy from the Policy Host, the Policy Host HTTPS server or updated policy from the Policy Host, the Policy Host HTTPS server
MUST present a X.509 certificate which is valid for the "mta-sts" MUST present an X.509 certificate that is valid for the "mta-sts"
DNS-ID ([RFC6125]) (e.g., "mta-sts.example.com") as described below, DNS-ID [RFC6125] (e.g., "mta-sts.example.com") as described below,
chain to a root CA that is trusted by the sending MTA, and be non- chain to a root CA that is trusted by the Sending MTA, and be non-
expired. It is expected that sending MTAs use a set of trusted CAs expired. It is expected that Sending MTAs use a set of trusted CAs
similar to those in widely deployed Web browsers and operating similar to those in widely deployed web browsers and operating
systems. See [RFC5280] for more details about certificate systems. See [RFC5280] for more details about certificate
verification. verification.
The certificate is valid for the Policy Host (i.e., "mta-sts" The certificate is valid for the Policy Host (i.e., "mta-sts"
prepended to the Policy Domain) with respect to the rules described prepended to the Policy Domain) with respect to the rules described
in [RFC6125], with the following application-specific considerations: in [RFC6125], with the following application-specific considerations:
o Matching is performed only against the DNS-ID identifiers. o Matching is performed only against the DNS-ID identifiers.
o DNS domain names in server certificates MAY contain the wildcard o DNS domain names in server certificates MAY contain the wildcard
skipping to change at page 9, line 47 skipping to change at page 10, line 47
The certificate MAY be checked for revocation via the Online The certificate MAY be checked for revocation via the Online
Certificate Status Protocol (OCSP) [RFC6960], certificate revocation Certificate Status Protocol (OCSP) [RFC6960], certificate revocation
lists (CRLs), or some other mechanism. lists (CRLs), or some other mechanism.
Policies fetched via HTTPS are only valid if the HTTP response code Policies fetched via HTTPS are only valid if the HTTP response code
is 200 (OK). HTTP 3xx redirects MUST NOT be followed, and HTTP is 200 (OK). HTTP 3xx redirects MUST NOT be followed, and HTTP
caching (as specified in [RFC7234]) MUST NOT be used. caching (as specified in [RFC7234]) MUST NOT be used.
Senders may wish to rate-limit the frequency of attempts to fetch the Senders may wish to rate-limit the frequency of attempts to fetch the
HTTPS endpoint even if a valid TXT record for the recipient domain HTTPS endpoint even if a valid TXT record for the recipient domain
exists. In the case that the HTTPS GET fails, implementers SHOULD exists. In the case where the HTTPS GET fails, implementers SHOULD
limit further attempts to a period of five minutes or longer per limit further attempts to a period of five minutes or longer per
version ID, to avoid overwhelming resource-constrained recipients version ID, to avoid overwhelming resource-constrained recipients
with cascading failures. with cascading failures.
Senders MAY impose a timeout on the HTTPS GET and/or a limit on the Senders MAY impose a timeout on the HTTPS GET and/or a limit on the
maximum size of the response body to avoid long delays or resource maximum size of the response body to avoid long delays or resource
exhaustion during attempted policy updates. A suggested timeout is exhaustion during attempted policy updates. A suggested timeout is
one minute, and a suggested maximum policy size 64 kilobytes; policy one minute, and a suggested maximum policy size is 64 kilobytes;
hosts SHOULD respond to requests with a complete policy body within Policy Hosts SHOULD respond to requests with a complete policy body
that timeout and size limit. within that timeout and size limit.
If a valid TXT record is found but no policy can be fetched via HTTPS If a valid TXT record is found but no policy can be fetched via HTTPS
(for any reason), and there is no valid (non-expired) previously- (for any reason), and there is no valid (non-expired) previously
cached policy, senders MUST continue with delivery as though the cached policy, senders MUST continue with delivery as though the
domain has not implemented MTA-STS. domain has not implemented MTA-STS.
Conversely, if no "live" policy can be discovered via DNS or fetched Conversely, if no "live" policy can be discovered via DNS or fetched
via HTTPS, but a valid (non-expired) policy exists in the sender's via HTTPS, but a valid (non-expired) policy exists in the sender's
cache, the sender MUST apply that cached policy. cache, the sender MUST apply that cached policy.
Finally, to mitigate the risk of persistent interference with policy Finally, to mitigate the risk of persistent interference with policy
refresh, as discussed in-depth in Section 10, MTAs SHOULD proactively refresh, as discussed in-depth in Section 10, MTAs SHOULD proactively
refresh cached policies before they expire; a suggested refresh refresh cached policies before they expire; a suggested refresh
frequency is once per day. To enable administrators to discover frequency is once per day. To enable administrators to discover
problems with policy refresh, MTAs SHOULD alert administrators problems with policy refresh, MTAs SHOULD alert administrators
(through the use of logs or similar) when such attempts fail, unless (through the use of logs or similar) when such attempts fail, unless
the cached policy mode is "none". the cached policy mode is "none".
3.4. Policy Selection for Smart Hosts and Subdomains 3.4. Policy Selection for Smart Hosts and Subdomains
When sending mail via a "smart host"--an administratively configured When sending mail via a "smart host" -- an administratively
intermediate SMTP relay, which is different from the message configured intermediate SMTP relay, which is different from the
recipient's server as determined from DNS --compliant senders MUST message recipient's server as determined from DNS -- compliant
treat the smart host domain as the policy domain for the purposes of senders MUST treat the smart host domain as the Policy Domain for the
policy discovery and application. This specification does not purposes of policy discovery and application. This specification
provide a means of associating policies with addresses that employ does not provide a means of associating policies with email addresses
Address Literals [RFC5321]. that employ Address Literals [RFC5321].
When sending mail to a mailbox at a subdomain, compliant senders MUST When sending mail to a mailbox at a subdomain, compliant senders MUST
NOT attempt to fetch a policy from the parent zone. Thus for mail NOT attempt to fetch a policy from the parent zone. Thus, for mail
sent to "user@mail.example.com", the policy can be fetched only from sent to "user@mail.example.com", the policy can be fetched only from
"mail.example.com", not "example.com". "mail.example.com", not "example.com".
4. Policy Validation 4. Policy Validation
When sending to an MX at a domain for which the sender has a valid When sending to an MX at a domain for which the sender has a valid
and non-expired MTA-STS policy, a sending MTA honoring MTA-STS MUST and non-expired MTA-STS Policy, a Sending MTA honoring MTA-STS MUST
check whether: check whether:
1. At least one of the policy's "mx" patterns matches the selected 1. At least one of the policy's "mx" patterns matches the selected
MX host, as described in Section 4.1, "MX Host Validation". MX host, as described in Section 4.1, "MX Host Validation".
2. The recipient mail server supports STARTTLS and offers a PKIX- 2. The recipient mail server supports STARTTLS and offers a PKIX-
based TLS certificate, during TLS handshake, which is valid for based TLS certificate, during TLS handshake, which is valid for
that host, as described in Section 4.2, "Recipient MTA that host, as described in Section 4.2, "Recipient MTA
Certificate Validation". Certificate Validation".
When these conditions are not met, a policy is said to fail to When these conditions are not met, a policy is said to fail to
validate. This section does not dictate the behavior of sending MTAs validate. This section does not dictate the behavior of Sending MTAs
when the above conditions are not met; see Section 5, "Policy when the above conditions are not met; see Section 5, "Policy
Application" for a description of sending MTA behavior when policy Application", for a description of Sending MTA behavior when policy
validation fails. validation fails.
4.1. MX Host Validation 4.1. MX Host Validation
A receiving candidate MX host is valid according to an applied MTA- A receiving candidate MX host is valid according to an applied MTA-
STS policy if the MX record name matches one or more of the "mx" STS Policy if the MX record name matches one or more of the "mx"
fields in the applied policy. Matching is identical to the rules fields in the applied policy. Matching is identical to the rules
given in [RFC6125], with restriction that the wildcard character "*" given in [RFC6125], with the restriction that the wildcard character
may only be used to match the entire left-most label in the presented '*' may only be used to match the entire left-most label in the
identifier. Thus the mx pattern "*.example.com" matches presented identifier. Thus, the mx pattern "*.example.com" matches
"mail.example.com" but not "example.com" or "foo.bar.example.com". "mail.example.com" but not "example.com" or "foo.bar.example.com".
4.2. Recipient MTA Certificate Validation 4.2. Recipient MTA Certificate Validation
The certificate presented by the receiving MTA MUST not be expired, The certificate presented by the receiving MTA MUST not be expired
and MUST chain to a root CA that is trusted by the sending MTA. The and MUST chain to a root CA that is trusted by the Sending MTA. The
certificate MUST have a subject alternative name (SAN, [RFC5280]) certificate MUST have a subject alternative name (SAN) [RFC5280] with
with a DNS-ID ([RFC6125]) matching the host name, per the rules given a DNS-ID [RFC6125] matching the hostname, per the rules given in
in [RFC6125]. The MX's certificate MAY also be checked for [RFC6125]. The MX's certificate MAY also be checked for revocation
revocation via OCSP [RFC6960], CRLs [RFC6818], or some other via OCSP [RFC6960], CRLs [RFC6818], or some other mechanism.
mechanism.
5. Policy Application 5. Policy Application
When sending to an MX at a domain for which the sender has a valid, When sending to an MX at a domain for which the sender has a valid,
non-expired MTA-STS policy, a sending MTA honoring MTA-STS applies non-expired MTA-STS Policy, a Sending MTA honoring MTA-STS applies
the result of a policy validation failure one of two ways, depending the result of a policy validation failure in one of two ways,
on the value of the policy "mode" field: depending on the value of the policy "mode" field:
1. "enforce": In this mode, sending MTAs MUST NOT deliver the 1. "enforce": In this mode, Sending MTAs MUST NOT deliver the
message to hosts which fail MX matching or certificate message to hosts that fail MX matching or certificate validation
validation, or do not support STARTTLS. or that do not support STARTTLS.
2. "testing": In this mode, sending MTAs which also implement the 2. "testing": In this mode, Sending MTAs that also implement the
TLSRPT specification [I-D.ietf-uta-smtp-tlsrpt] merely send a TLSRPT (TLS Reporting) specification [RFC8460] send a report
report indicating policy application failures (so long as TLSRPT indicating policy application failures (as long as TLSRPT is also
is also implemented by the recipient domain). implemented by the recipient domain); in any case, messages may
be delivered as though there were no MTA-STS validation failure.
3. "none": In this mode, sending MTAs should treat the policy domain 3. "none": In this mode, Sending MTAs should treat the Policy Domain
as though it does not have any active policy; see Section 8.3, as though it does not have any active policy; see Section 8.3,
"Removing MTA-STS", for use of this mode value. "Removing MTA-STS", for use of this mode value.
When a message fails to deliver due to an "enforce" policy, a When a message fails to deliver due to an "enforce" policy, a
compliant MTA MUST NOT permanently fail to deliver messages before compliant MTA MUST NOT permanently fail to deliver messages before
checking, via DNS, for the presence of an updated policy at the checking, via DNS, for the presence of an updated policy at the
Policy Domain. (In all cases, MTAs SHOULD treat such failures as Policy Domain. (In all cases, MTAs SHOULD treat such failures as
transient errors and retry delivery later.) This allows implementing transient errors and retry delivery later.) This allows implementing
domains to update long-lived policies on the fly. domains to update long-lived policies on the fly.
5.1. Policy Application Control Flow 5.1. Policy Application Control Flow
An example control flow for a compliant sender consists of the An example control flow for a compliant sender consists of the
following steps: following steps:
1. Check for a cached policy whose time-since-fetch has not exceeded 1. Check for a cached policy whose time-since-fetch has not exceeded
its "max_age". If none exists, attempt to fetch a new policy its "max_age". If none exists, attempt to fetch a new policy
(perhaps asynchronously, so as not to block message delivery). (perhaps asynchronously, so as not to block message delivery).
Optionally, sending MTAs may unconditionally check for a new Optionally, Sending MTAs may unconditionally check for a new
policy at this step. policy at this step.
2. For each candidate MX, in order of MX priority, attempt to 2. For each candidate MX, in order of MX priority, attempt to
deliver the message. If a policy is present with an "enforce" deliver the message. If a policy is present with an "enforce"
mode, when attempting to deliver to each candidate MX, ensure mode, when attempting to deliver to each candidate MX, ensure
STARTTLS support and host identity validity as described in STARTTLS support and host identity validity as described in
Section 4, "Policy Validation". If a candidate fails validation, Section 4, "Policy Validation". If a candidate fails validation,
continue to the next candidate (if there is one). continue to the next candidate (if there is one).
3. A message delivery MUST NOT be permanently failed until the 3. A message delivery attempt MUST NOT be permanently failed until
sender has first checked for the presence of a new policy (as the sender has first checked for the presence of a new policy (as
indicated by the "id" field in the "_mta-sts" TXT record). If a indicated by the "id" field in the "_mta-sts" TXT record). If a
new policy is not found, existing rules for the case of temporary new policy is not found, existing rules for the case of temporary
message delivery failures apply (as discussed in [RFC5321] message delivery failures apply (as discussed in [RFC5321],
section 4.5.4.1). Section 4.5.4.1).
6. Reporting Failures 6. Reporting Failures
MTA-STS is intended to be used along with TLSRPT MTA-STS is intended to be used along with TLSRPT [RFC8460] in order
[I-D.ietf-uta-smtp-tlsrpt] in order to ensure implementing domains to ensure that implementing domains can detect cases of both benign
can detect cases of both benign and malicious failures, and to ensure and malicious failures and to ensure that failures that indicate an
that failures that indicate an active attack are discoverable. As active attack are discoverable. As such, senders that also implement
such, senders who also implement TLSRPT SHOULD treat the following TLSRPT SHOULD treat the following events as reportable failures:
events as reportable failures:
o HTTPS policy fetch failures when a valid TXT record is present. o HTTPS policy fetch failures when a valid TXT record is present.
o Policy fetch failures of any kind when a valid policy exists in o Policy fetch failures of any kind when a valid policy exists in
the policy cache, except if that policy's mode is "none". the policy cache, except if that policy's mode is "none".
o Delivery attempts in which a contacted MX does not support o Delivery attempts in which a contacted MX does not support
STARTTLS or does not present a certificate which validates STARTTLS or does not present a certificate that validates
according to the applied policy, except if that policy's mode is according to the applied policy, except if that policy's mode is
"none". "none".
7. Interoperability Considerations 7. Interoperability Considerations
7.1. SNI Support 7.1. SNI Support
To ensure that the server sends the right certificate chain, the SMTP To ensure that the server sends the right certificate chain, the SMTP
client MUST have support for the TLS SNI extension [RFC6066]. When client MUST have support for the TLS Server Name Indication (SNI)
connecting to a HTTP server to retrieve the MTA-STS policy, the SNI extension [RFC6066]. When connecting to an HTTP server to retrieve
extension MUST contain the name of the policy host (e.g., "mta- the MTA-STS Policy, the SNI extension MUST contain the name of the
sts.example.com"). When connecting to an SMTP server, the SNI Policy Host (e.g., "mta-sts.example.com"). When connecting to an
extension MUST contain the MX hostname. SMTP server, the SNI extension MUST contain the MX hostname.
HTTP servers used to deliver MTA-STS policies MAY rely on SNI to HTTP servers used to deliver MTA-STS policies MAY rely on SNI to
determine which certificate chain to present to the client. HTTP determine which certificate chain to present to the client. HTTP
servers MUST respond with a certificate chain that matches the policy servers MUST respond with a certificate chain that matches the policy
hostname or abort the TLS handshake if unable to do so. Clients that hostname or abort the TLS handshake if unable to do so. Clients that
do not send SNI information may not see the expected certificate do not send SNI information may not see the expected certificate
chain. chain.
SMTP servers MAY rely on SNI to determine which certificate chain to SMTP servers MAY rely on SNI to determine which certificate chain to
present to the client. However servers that have one identity and a present to the client. However, servers that have one identity and a
single matching certificate do not require SNI support. Servers MUST single matching certificate do not require SNI support. Servers MUST
NOT enforce the use of SNI by clients, as the client may be using NOT enforce the use of SNI by clients, as the client may be using
unauthenticated opportunistic TLS and may not expect any particular unauthenticated opportunistic TLS and may not expect any particular
certificate from the server. If the client sends no SNI extension or certificate from the server. If the client sends no SNI extension or
sends an SNI extension for an unsupported server name, the server sends an SNI extension for an unsupported server name, the server
MUST simply send a fallback certificate chain of its choice. The MUST simply send a fallback certificate chain of its choice. The
reason for not enforcing strict matching of the requested SNI reason for not enforcing strict matching of the requested SNI
hostname is that MTA-STS TLS clients may be typically willing to hostname is that MTA-STS TLS clients may be typically willing to
accept multiple server names but can only send one name in the SNI accept multiple server names but can only send one name in the SNI
extension. The server's fallback certificate may match a different extension. The server's fallback certificate may match a different
name that is acceptable to the client, e.g., the original next-hop name that is acceptable to the client, e.g., the original next-hop
domain. domain.
7.2. Minimum TLS Version Support 7.2. Minimum TLS Version Support
MTAs supporting MTA-STS MUST have support for TLS version 1.2 MTAs supporting MTA-STS MUST have support for TLS 1.2 [RFC5246] or
[RFC5246] or higher. The general TLS usage guidance in [RFC7525] TLS 1.3 [RFC8446] or higher. The general TLS usage guidance in
SHOULD be followed. [RFC7525] SHOULD be followed.
8. Operational Considerations 8. Operational Considerations
8.1. Policy Updates 8.1. Policy Updates
Updating the policy requires that the owner make changes in two Updating the policy requires that the owner make changes in two
places: the "_mta-sts" TXT record in the Policy Domain's DNS zone and places: the "_mta-sts" TXT record in the Policy Domain's DNS zone and
at the corresponding HTTPS endpoint. As a result, recipients should at the corresponding HTTPS endpoint. As a result, recipients should
expect a policy will continue to be used by senders until both the expect that a policy will continue to be used by senders until both
HTTPS and TXT endpoints are updated and the TXT record's TTL has the HTTPS and TXT endpoints are updated and the TXT record's TTL has
passed. passed.
In other words, a sender who is unable to successfully deliver a In other words, a sender who is unable to successfully deliver a
message while applying a cache of the recipient's now-outdated policy message while applying a cache of the recipient's now-outdated policy
may be unable to discover that a new policy exists until the DNS TTL may be unable to discover that a new policy exists until the DNS TTL
has passed. Recipients SHOULD therefore ensure that old policies has passed. Recipients SHOULD therefore ensure that old policies
continue to work for message delivery during this period of time, or continue to work for message delivery during this period of time, or
risk message delays. risk message delays.
Recipients SHOULD also update the HTTPS policy body before updating Recipients SHOULD also update the HTTPS policy body before updating
the TXT record; this ordering avoids the risk that senders, seeing a the TXT record; this ordering avoids the risk that senders, seeing a
new TXT record, mistakenly cache the old policy from HTTPS. new TXT record, mistakenly cache the old policy from HTTPS.
8.2. Policy Delegation 8.2. Policy Delegation
Domain owners commonly delegate SMTP hosting to a different Domain owners commonly delegate SMTP hosting to a different
organization, such as an ISP or a Web host. In such a case, they may organization, such as an ISP or a web host. In such a case, they may
wish to also delegate the MTA-STS policy to the same organization wish to also delegate the MTA-STS Policy to the same organization,
which can be accomplished with two changes. which can be accomplished with two changes.
First, the Policy Domain must point the "_mta-sts" record, via CNAME, First, the Policy Domain must point the "_mta-sts" record, via CNAME,
to the "_mta-sts" record maintained by the hosting organization. to the "_mta-sts" record maintained by the provider. This allows the
This allows the hosting organization to control update signaling. provider to control update signaling.
Second, the Policy Domain must point the "well-known" policy location Second, the Policy Domain must point the "well-known" policy location
to the hosting organization. This can be done either by setting the to the provider. This can be done either by setting the "mta-sts"
"mta-sts" record to an IP address or CNAME specified by the hosting record to an IP address or CNAME specified by the provider and by
organization and by giving the hosting organization a TLS certificate giving the provider a TLS certificate that is valid for that host or
which is valid for that host, or by setting up a "reverse proxy" by setting up a "reverse proxy" (also known as a "gateway") server
(also known as a "gateway") server that serves as the Policy Domain's for the Policy Domain's Policy Host, configured to serve proxied
policy the policy currently served by the hosting organization. responses from the Policy Host of the provider.
For example, given a user domain "user.example" hosted by a mail For example, given a user domain "user.example" hosted by a mail
provider "provider.example", the following configuration would allow provider "provider.example", the following configuration would allow
policy delegation: policy delegation:
DNS: DNS:
_mta-sts.user.example. IN CNAME _mta-sts.provider.example. _mta-sts.user.example. IN CNAME _mta-sts.provider.example.
Policy: Policy:
> GET /.well-known/mta-sts.txt Host: mta-sts.user.example > GET /.well-known/mta-sts.txt Host: mta-sts.user.example
< HTTP/1.1 200 OK # Response proxies content from < HTTP/1.1 200 OK # Response proxies content from
# https://mta-sts.provider.example # https://mta-sts.provider.example
Note that in all such cases, the policy endpoint ("https://mta- Note that in all such cases, the policy endpoint
sts.user.example/.well-known/mta-sts.txt" in this example) must still ("https://mta-sts.user.example/.well-known/mta-sts.txt" in this
present a certificate valid for the Policy Host ("mta- example) must still present a certificate valid for the Policy Host
sts.user.example"), and not for that host at the provider's domain ("mta-sts.user.example"), and not for that host at the provider's
("mta-sts.provider.example"). domain ("mta-sts.provider.example").
Note that while sending MTAs MUST NOT use HTTP caching when fetching Note that while Sending MTAs MUST NOT use HTTP caching when fetching
policies via HTTPS, such caching may nonetheless be useful to a policies via HTTPS, such caching may nonetheless be useful to a
reverse proxy configured as described in this section. An HTTPS reverse proxy configured as described in this section. An HTTPS
policy endpoint expecting to be proxied for multiple hosted domains-- policy endpoint expecting to be proxied for multiple hosted domains
as with a large mail hosting provider or similar--may wish to -- as with a large mail hosting provider or similar -- may wish to
indicate an HTTP Cache-Control "max-age" response directive (as indicate an HTTP Cache-Control "max-age" response directive (as
specified in [RFC7234]) of 60 seconds as a reasonable value to save specified in [RFC7234]) of 60 seconds as a reasonable value to save
reverse proxies an unnecessarily high-rate of proxied policy reverse proxies an unnecessarily high-rate of proxied policy
fetching. fetching.
8.3. Removing MTA-STS 8.3. Removing MTA-STS
In order to facilitate clean opt-out of MTA-STS by implementing In order to facilitate clean opt-out of MTA-STS by implementing
policy domains, and to distinguish clearly between failures which Policy Domains, and to distinguish clearly between failures that
indicate attacks and those which indicate such opt-outs, MTA-STS indicate attacks and those that indicate such opt-outs, MTA-STS
implements the "none" mode, which allows validated policies to implements the "none" mode, which allows validated policies to
indicate authoritatively that the policy domain wishes to no longer indicate authoritatively that the Policy Domain wishes to no longer
implement MTA-STS and may, in the future, remove the MTA-STS TXT and implement MTA-STS and may, in the future, remove the MTA-STS TXT and
policy endpoints entirely. policy endpoints entirely.
A suggested workflow to implement such an opt out is as follows: A suggested workflow to implement such an opt out is as follows:
1. Publish a new policy with "mode" equal to "none" and a small 1. Publish a new policy with "mode" equal to "none" and a small
"max_age" (e.g., one day). "max_age" (e.g., one day).
2. Publish a new TXT record to trigger fetching of the new policy. 2. Publish a new TXT record to trigger fetching of the new policy.
3. When all previously served policies have expired--normally this 3. When all previously served policies have expired -- normally this
is the time the previously published policy was last served plus is the time the previously published policy was last served plus
that policy's "max_age", but note that older policies may have that policy's "max_age", but note that policies older than the
been served with a greater "max_age", allowing overlapping policy previously published policy may have been served with a greater
caches--safely remove the TXT record and HTTPS endpoint. "max_age" than the previously published policy, allowing
overlapping policy caches -- safely remove the TXT record and
HTTPS endpoint.
8.4. Preserving MX Candidate Traversal 8.4. Preserving MX Candidate Traversal
Implementors of send-time MTA-STS validation in mail transfer agents Implementers of send-time MTA-STS validation in mail transfer agents
should take note of the risks of modifying the logic of traversing MX should take note of the risks of modifying the logic of traversing MX
candidate lists. Because an MTA-STS policy can be used to prefilter candidate lists. Because an MTA-STS Policy can be used to prefilter
invalid MX candidates from the MX candidate list, it is tempting to invalid MX candidates from the MX candidate list, it is tempting to
implement a "two-pass" model, where MX candidates are first filtered implement a "two-pass" model, where MX candidates are first filtered
for possible validity according to the MTA-STS policy, and then the for possible validity according to the MTA-STS Policy, and then the
remaining candidates attempted in order as without an MTA-STS policy. remaining candidates are attempted in order as without an MTA-STS
This may lead to incorrect implementations, such a message loops; Policy. This may lead to incorrect implementations, such as message
implementors are instead recommended to traverse the MX candidate loops; instead, it is recommended that implementers traverse the MX
list as usual, and treat invalid candidates as though they were candidate list as usual, and treat invalid candidates as though they
unreachable (i.e., as though there were some transient error when were unreachable (i.e., as though there were some transient error
trying to deliver to that candidate). when trying to deliver to that candidate).
One consequence of validating MX hosts in order of ordinary candidate One consequence of validating MX hosts in order of ordinary candidate
traversal is that, in the event that a higher-priority MX is MTA-STS traversal is that in the event a higher-priority MX is MTA-STS valid
valid and a lower-priority MX is not, senders may never encounter the and a lower-priority MX is not, senders may never encounter the
lower-priority MX, leading to a risk that policy misconfigurations lower-priority MX, leading to a risk that policy misconfigurations
that apply only to "backup" MXes may only be discovered in the case that apply only to "backup" MXes may only be discovered in the case
of primary MX failure. of primary MX failure.
9. IANA Considerations 9. IANA Considerations
9.1. Well-Known URIs Registry 9.1. Well-Known URIs Registry
A new "well-known" URI as described in Section 3 will be registered A new "well-known" URI as described in Section 3 has been registered
in the Well-Known URIs registry as described below: in the "Well-Known URIs" registry as described below:
URI Suffix: mta-sts.txt Change Controller: IETF URI Suffix: mta-sts.txt
Change Controller: IETF
9.2. MTA-STS TXT Record Fields 9.2. MTA-STS TXT Record Fields
IANA is requested to create a new registry titled "MTA-STS TXT Record IANA has created a new registry titled "MTA-STS TXT Record Fields".
Fields". The initial entries in the registry are: The initial entries in the registry are:
+------------+--------------------+------------------------+ +------------+--------------------+-------------------------+
| Field Name | Description | Reference | | Field Name | Description | Reference |
+------------+--------------------+------------------------+ +------------+--------------------+-------------------------+
| v | Record version | Section 3.1 of RFC XXX | | v | Record version | Section 3.1 of RFC 8461 |
| id | Policy instance ID | Section 3.1 of RFC XXX | | id | Policy instance ID | Section 3.1 of RFC 8461 |
+------------+--------------------+------------------------+ +------------+--------------------+-------------------------+
New fields are added to this registry using IANA's "Expert Review" New fields are added to this registry using IANA's "Expert Review"
policy. policy [RFC8126].
9.3. MTA-STS Policy Fields 9.3. MTA-STS Policy Fields
IANA is requested to create a new registry titled "MTA-STS Policy IANA has created a new registry titled "MTA-STS Policy Fields". The
Fields". The initial entries in the registry are: initial entries in the registry are:
+------------+----------------------+------------------------+ +------------+----------------------+-------------------------+
| Field Name | Description | Reference | | Field Name | Description | Reference |
+------------+----------------------+------------------------+ +------------+----------------------+-------------------------+
| version | Policy version | Section 3.2 of RFC XXX | | version | Policy version | Section 3.2 of RFC 8461 |
| mode | Enforcement behavior | Section 3.2 of RFC XXX | | mode | Enforcement behavior | Section 3.2 of RFC 8461 |
| max_age | Policy lifetime | Section 3.2 of RFC XXX | | max_age | Policy lifetime | Section 3.2 of RFC 8461 |
| mx | MX identities | Section 3.2 of RFC XXX | | mx | MX identities | Section 3.2 of RFC 8461 |
+------------+----------------------+------------------------+ +------------+----------------------+-------------------------+
New fields are added to this registry using IANA's "Expert Review" New fields are added to this registry using IANA's "Expert Review"
policy. policy.
10. Security Considerations 10. Security Considerations
SMTP MTA Strict Transport Security attempts to protect against an SMTP MTA-STS attempts to protect against an active attacker trying to
active attacker trying to intercept or tamper with mail between hosts intercept or tamper with mail between hosts that support STARTTLS.
that support STARTTLS. There are two classes of attacks considered: There are two classes of attacks considered:
o Foiling TLS negotiation, for example by deleting the "250 o Foiling TLS negotiation (for example, by deleting the "250
STARTTLS" response from a server or altering TLS session STARTTLS" response from a server or altering TLS session
negotiation. This would result in the SMTP session occurring over negotiation). This would result in the SMTP session occurring
plaintext, despite both parties supporting TLS. over plaintext, despite both parties supporting TLS.
o Impersonating the destination mail server, whereby the sender o Impersonating the destination mail server, whereby the sender
might deliver the message to an impostor, who could then monitor might deliver the message to an impostor, who could then monitor
and/or modify messages despite opportunistic TLS. This and/or modify messages despite opportunistic TLS. This
impersonation could be accomplished by spoofing the DNS MX record impersonation could be accomplished by spoofing the DNS MX record
for the recipient domain, or by redirecting client connections for the recipient domain or by redirecting client connections
intended for the legitimate recipient server (for example, by intended for the legitimate recipient server (for example, by
altering BGP routing tables). altering BGP routing tables).
MTA-STS can thwart such attacks only if the sender is able to MTA-STS can thwart such attacks only if the sender is able to
previously obtain and cache a policy for the recipient domain, and previously obtain and cache a policy for the recipient domain, and
only if the attacker is unable to obtain a valid certificate that only if the attacker is unable to obtain a valid certificate that
complies with that policy. Below, we consider specific attacks on complies with that policy. Below, we consider specific attacks on
this model. this model.
10.1. Obtaining a Signed Certificate 10.1. Obtaining a Signed Certificate
SMTP MTA-STS relies on certificate validation via PKIX based TLS SMTP MTA-STS relies on certificate validation via PKIX-based TLS
identity checking [RFC6125]. Attackers who are able to obtain a identity checking [RFC6125]. Attackers who are able to obtain a
valid certificate for the targeted recipient mail service (e.g., by valid certificate for the targeted recipient mail service (e.g., by
compromising a certificate authority) are thus able to circumvent STS compromising a CA) are thus able to circumvent STS authentication.
authentication.
10.2. Preventing Policy Discovery 10.2. Preventing Policy Discovery
Since MTA-STS uses DNS TXT records for policy discovery, an attacker Since MTA-STS uses DNS TXT records for policy discovery, an attacker
who is able to block DNS responses can suppress the discovery of an who is able to block DNS responses can suppress the discovery of an
MTA-STS Policy, making the Policy Domain appear not to have an MTA- MTA-STS Policy, making the Policy Domain appear not to have an MTA-
STS Policy. The sender policy cache is designed to resist this STS Policy. The sender policy cache is designed to resist this
attack by decreasing the frequency of policy discovery and thus attack by decreasing the frequency of policy discovery and thus
reducing the window of vulnerability; it is nonetheless a risk that reducing the window of vulnerability; it is nonetheless a risk that
attackers who can predict or induce policy discovery--for example, by attackers who can predict or induce policy discovery -- for example,
inducing a sending domain to send mail to a never-before-contacted by inducing a sending domain to send mail to a never-before-contacted
recipient while carrying out a man-in-the-middle attack--may be able recipient while carrying out a man-in-the-middle attack -- may be
to foil policy discovery and effectively downgrade the security of able to foil policy discovery and effectively downgrade the security
the message delivery. of the message delivery.
Since this attack depends upon intercepting initial policy discovery, Since this attack depends upon intercepting initial policy discovery,
implementers SHOULD prefer policy "max_age" values to be as long as implementers SHOULD prefer policy "max_age" values to be as long as
is practical. is practical.
Because this attack is also possible upon refresh of a cached policy, Because this attack is also possible upon refresh of a cached policy,
implementors SHOULD NOT wait until a cached policy has expired before implementers SHOULD NOT wait until a cached policy has expired before
checking for an update; if senders attempt to refresh the cache checking for an update; if senders attempt to refresh the cache
regularly (for example, by fetching currently live policy in a regularly (for example, by fetching the current live policy in a
background task that runs daily or weekly, regardless of the state of background task that runs daily or weekly, regardless of the state of
the "_mta_sts" TXT record, and updating their cache's "max age" the "_mta-sts" TXT record, and updating their cache's "max age"
accordingly), an attacker would have to foil policy discovery accordingly), an attacker would have to foil policy discovery
consistently over the lifetime of a cached policy to prevent a consistently over the lifetime of a cached policy to prevent a
successful refresh. successful refresh.
Additionally, MTAs SHOULD alert administrators to repeated policy Additionally, MTAs SHOULD alert administrators to repeated policy
refresh failures long before cached policies expire (through warning refresh failures long before cached policies expire (through warning
logs or similar applicable mechanisms), allowing administrators to logs or similar applicable mechanisms), allowing administrators to
detect such a persistent attack on policy refresh. (However, they detect such a persistent attack on policy refresh. (However, they
should not implement such alerts if the cached policy has a "none" should not implement such alerts if the cached policy has a "none"
mode, to allow clean MTA-STS removal, as described in Section 8.3.) mode, to allow clean MTA-STS removal, as described in Section 8.3.)
Resistance to downgrade attacks of this nature--due to the ability to Resistance to downgrade attacks of this nature -- due to the ability
authoritatively determine "lack of a record" even for non- to authoritatively determine "lack of a record" even for non-
participating recipients--is a feature of DANE, due to its use of participating recipients -- is a feature of DANE, due to its use of
DNSSEC for policy discovery. DNSSEC for policy discovery.
10.3. Denial of Service 10.3. Denial of Service
We additionally consider the Denial of Service risk posed by an We additionally consider the Denial-of-Service risk posed by an
attacker who can modify the DNS records for a recipient domain. attacker who can modify the DNS records for a recipient domain.
Absent MTA-STS, such an attacker can cause a sending MTA to cache Absent MTA-STS, such an attacker can cause a Sending MTA to cache
invalid MX records, but only for however long the sending resolver invalid MX records, but only for however long the sending resolver
caches those records. With MTA-STS, the attacker can additionally caches those records. With MTA-STS, the attacker can additionally
advertise a new, long-"max_age" MTA-STS policy with "mx" constraints advertise a new, long "max_age" MTA-STS Policy with "mx" constraints
that validate the malicious MX record, causing senders to cache the that validate the malicious MX record, causing senders to cache the
policy and refuse to deliver messages once the victim has resecured policy and refuse to deliver messages once the victim has resecured
the MX records. the MX records.
This attack is mitigated in part by the ability of a victim domain to This attack is mitigated in part by the ability of a victim domain to
(at any time) publish a new policy updating the cached, malicious (at any time) publish a new policy updating the cached, malicious
policy, though this does require the victim domain to both obtain a policy, though this does require the victim domain to both obtain a
valid CA-signed certificate and to understand and properly configure valid CA-signed certificate and to understand and properly configure
MTA-STS. MTA-STS.
Similarly, we consider the possibility of domains that deliberately Similarly, we consider the possibility of domains that deliberately
allow untrusted users to serve untrusted content on user-specified allow untrusted users to serve untrusted content on user-specified
subdomains. In some cases (e.g., the service Tumblr.com) this takes subdomains. In some cases (e.g., the service "tumblr.com"), this
the form of providing HTTPS hosting of user-registered subdomains; in takes the form of providing HTTPS hosting of user-registered
other cases (e.g. dynamic DNS providers) this takes the form of subdomains; in other cases (e.g. dynamic DNS providers), this takes
allowing untrusted users to register custom DNS records at the the form of allowing untrusted users to register custom DNS records
provider's domain. at the provider's domain.
In these cases, there is a risk that untrusted users would be able to In these cases, there is a risk that untrusted users would be able to
serve custom content at the "mta-sts" host, including serving an serve custom content at the "mta-sts" host, including serving an
illegitimate MTA-STS policy. We believe this attack is rendered more illegitimate MTA-STS Policy. We believe this attack is rendered more
difficult by the need for the attacker to also serve the "_mta-sts" difficult by the need for the attacker to also serve the "_mta-sts"
TXT record on the same domain--something not, to our knowledge, TXT record on the same domain -- something not, to our knowledge,
widely provided to untrusted users. This attack is additionally widely provided to untrusted users. This attack is additionally
mitigated by the aforementioned ability for a victim domain to update mitigated by the aforementioned ability for a victim domain to update
an invalid policy at any future date. an invalid policy at any future date.
10.4. Weak Policy Constraints 10.4. Weak Policy Constraints
Even if an attacker cannot modify a served policy, the potential Even if an attacker cannot modify a served policy, the potential
exists for configurations that allow attackers on the same domain to exists for configurations that allow attackers on the same domain to
receive mail for that domain. For example, an easy configuration receive mail for that domain. For example, an easy configuration
option when authoring an MTA-STS Policy for "example.com" is to set option when authoring an MTA-STS Policy for "example.com" is to set
the "mx" equal to "*.example.com"; recipient domains must consider in the "mx" equal to "*.example.com"; in this case, recipient domains
this case the risk that any user possessing a valid hostname and CA- must consider the risk that any user possessing a valid hostname and
signed certificate (for example, "dhcp-123.example.com") will, from CA-signed certificate (for example, "dhcp-123.example.com") will,
the perspective of MTA-STS Policy validation, be a valid MX host for from the perspective of MTA-STS Policy validation, be a valid MX host
that domain. for that domain.
10.5. Compromise of the Web PKI System 10.5. Compromise of the Web PKI System
A host of risks apply to the PKI system used for certificate A number of risks apply to the PKI system that is used for
authentication, both of the "mta-sts" HTTPS host's certificate and certificate authentication, both of the "mta-sts" HTTPS host's
the SMTP servers' certificates. These risks are broadly applicable certificate and the SMTP servers' certificates. These risks are
within the Web PKI ecosystem and are not specific to MTA-STS; broadly applicable within the Web PKI ecosystem and are not specific
nonetheless, they deserve some consideration in this context. to MTA-STS; nonetheless, they deserve some consideration in this
context.
Broadly speaking, attackers may compromise the system by obtaining Broadly speaking, attackers may compromise the system by obtaining
certificates under fraudulent circumstances (i.e., by impersonating certificates under fraudulent circumstances (i.e., by impersonating
the legitimate owner of the victim domain), by compromising a the legitimate owner of the victim domain), by compromising a CA or
Certificate Authority or Delegate Authority's private keys, by Delegate Authority's private keys, by obtaining a legitimate
obtaining a legitimate certificate issued to the victim domain, and certificate issued to the victim domain, and similar.
similar.
One approach commonly employed by Web browsers to help mitigate One approach commonly employed by web browsers to help mitigate
against some of these attacks is to allow for revocation of against some of these attacks is to allow for revocation of
compromised or fraudulent certificates via OCSP [RFC6960] or CRLs compromised or fraudulent certificates via OCSP [RFC6960] or CRLs
[RFC6818]. Such mechanisms themselves represent tradeoffs and are [RFC6818]. Such mechanisms themselves represent trade-offs and are
not universally implemented; we nonetheless recommend implementors of not universally implemented; we nonetheless recommend implementers of
MTA-STS to implement revocation mechanisms which are most applicable MTA-STS to implement revocation mechanisms that are most applicable
to their implementations. to their implementations.
11. Contributors 11. References
Wei Chuang Google, Inc weihaw@google.com
Viktor Dukhovni ietf-dane@dukhovni.de
Markus Laber 1&1 Mail & Media Development & Technology GmbH
markus.laber@1und1.de
Nicolas Lidzborski Google, Inc nlidz@google.com
Brandon Long Google, Inc blong@google.com
Franck Martin LinkedIn, Inc fmartin@linkedin.com
Klaus Umbach 1&1 Mail & Media Development & Technology GmbH
klaus.umbach@1und1.de
12. References
12.1. Normative References
[I-D.ietf-uta-smtp-tlsrpt] 11.1. Normative References
Margolis, D., Brotman, A., Ramakrishnan, B., Jones, J.,
and M. Risher, "SMTP TLS Reporting", draft-ietf-uta-smtp-
tlsrpt-22 (work in progress), May 2018.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, Requirement Levels", BCP 14, RFC 2119,
DOI 10.17487/RFC2119, March 1997, <https://www.rfc- DOI 10.17487/RFC2119, March 1997,
editor.org/info/rfc2119>. <https://www.rfc-editor.org/info/rfc2119>.
[RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818,
DOI 10.17487/RFC2818, May 2000, <https://www.rfc- DOI 10.17487/RFC2818, May 2000,
editor.org/info/rfc2818>. <https://www.rfc-editor.org/info/rfc2818>.
[RFC3207] Hoffman, P., "SMTP Service Extension for Secure SMTP over [RFC3207] Hoffman, P., "SMTP Service Extension for Secure SMTP over
Transport Layer Security", RFC 3207, DOI 10.17487/RFC3207, Transport Layer Security", RFC 3207, DOI 10.17487/RFC3207,
February 2002, <https://www.rfc-editor.org/info/rfc3207>. February 2002, <https://www.rfc-editor.org/info/rfc3207>.
[RFC3492] Costello, A., "Punycode: A Bootstring encoding of Unicode [RFC3492] Costello, A., "Punycode: A Bootstring encoding of Unicode
for Internationalized Domain Names in Applications for Internationalized Domain Names in Applications
(IDNA)", RFC 3492, DOI 10.17487/RFC3492, March 2003, (IDNA)", RFC 3492, DOI 10.17487/RFC3492, March 2003,
<https://www.rfc-editor.org/info/rfc3492>. <https://www.rfc-editor.org/info/rfc3492>.
[RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO
10646", STD 63, RFC 3629, DOI 10.17487/RFC3629, November
2003, <https://www.rfc-editor.org/info/rfc3629>.
[RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax
Specifications: ABNF", STD 68, RFC 5234, Specifications: ABNF", STD 68, RFC 5234,
DOI 10.17487/RFC5234, January 2008, <https://www.rfc- DOI 10.17487/RFC5234, January 2008,
editor.org/info/rfc5234>. <https://www.rfc-editor.org/info/rfc5234>.
[RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security
(TLS) Protocol Version 1.2", RFC 5246, (TLS) Protocol Version 1.2", RFC 5246,
DOI 10.17487/RFC5246, August 2008, <https://www.rfc- DOI 10.17487/RFC5246, August 2008,
editor.org/info/rfc5246>. <https://www.rfc-editor.org/info/rfc5246>.
[RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S.,
Housley, R., and W. Polk, "Internet X.509 Public Key Housley, R., and W. Polk, "Internet X.509 Public Key
Infrastructure Certificate and Certificate Revocation List Infrastructure Certificate and Certificate Revocation List
(CRL) Profile", RFC 5280, DOI 10.17487/RFC5280, May 2008, (CRL) Profile", RFC 5280, DOI 10.17487/RFC5280, May 2008,
<https://www.rfc-editor.org/info/rfc5280>. <https://www.rfc-editor.org/info/rfc5280>.
[RFC5321] Klensin, J., "Simple Mail Transfer Protocol", RFC 5321, [RFC5321] Klensin, J., "Simple Mail Transfer Protocol", RFC 5321,
DOI 10.17487/RFC5321, October 2008, <https://www.rfc- DOI 10.17487/RFC5321, October 2008,
editor.org/info/rfc5321>. <https://www.rfc-editor.org/info/rfc5321>.
[RFC5785] Nottingham, M. and E. Hammer-Lahav, "Defining Well-Known [RFC5785] Nottingham, M. and E. Hammer-Lahav, "Defining Well-Known
Uniform Resource Identifiers (URIs)", RFC 5785, Uniform Resource Identifiers (URIs)", RFC 5785,
DOI 10.17487/RFC5785, April 2010, <https://www.rfc- DOI 10.17487/RFC5785, April 2010,
editor.org/info/rfc5785>. <https://www.rfc-editor.org/info/rfc5785>.
[RFC6066] Eastlake 3rd, D., "Transport Layer Security (TLS) [RFC6066] Eastlake 3rd, D., "Transport Layer Security (TLS)
Extensions: Extension Definitions", RFC 6066, Extensions: Extension Definitions", RFC 6066,
DOI 10.17487/RFC6066, January 2011, <https://www.rfc- DOI 10.17487/RFC6066, January 2011,
editor.org/info/rfc6066>. <https://www.rfc-editor.org/info/rfc6066>.
[RFC6125] Saint-Andre, P. and J. Hodges, "Representation and [RFC6125] Saint-Andre, P. and J. Hodges, "Representation and
Verification of Domain-Based Application Service Identity Verification of Domain-Based Application Service Identity
within Internet Public Key Infrastructure Using X.509 within Internet Public Key Infrastructure Using X.509
(PKIX) Certificates in the Context of Transport Layer (PKIX) Certificates in the Context of Transport Layer
Security (TLS)", RFC 6125, DOI 10.17487/RFC6125, March Security (TLS)", RFC 6125, DOI 10.17487/RFC6125, March
2011, <https://www.rfc-editor.org/info/rfc6125>. 2011, <https://www.rfc-editor.org/info/rfc6125>.
[RFC7405] Kyzivat, P., "Case-Sensitive String Support in ABNF", [RFC7405] Kyzivat, P., "Case-Sensitive String Support in ABNF",
RFC 7405, DOI 10.17487/RFC7405, December 2014, RFC 7405, DOI 10.17487/RFC7405, December 2014,
skipping to change at page 22, line 26 skipping to change at page 23, line 5
[RFC7525] Sheffer, Y., Holz, R., and P. Saint-Andre, [RFC7525] Sheffer, Y., Holz, R., and P. Saint-Andre,
"Recommendations for Secure Use of Transport Layer "Recommendations for Secure Use of Transport Layer
Security (TLS) and Datagram Transport Layer Security Security (TLS) and Datagram Transport Layer Security
(DTLS)", BCP 195, RFC 7525, DOI 10.17487/RFC7525, May (DTLS)", BCP 195, RFC 7525, DOI 10.17487/RFC7525, May
2015, <https://www.rfc-editor.org/info/rfc7525>. 2015, <https://www.rfc-editor.org/info/rfc7525>.
[RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC
2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174,
May 2017, <https://www.rfc-editor.org/info/rfc8174>. May 2017, <https://www.rfc-editor.org/info/rfc8174>.
12.2. Informative References [RFC8446] Rescorla, E., "The Transport Layer Security (TLS) Protocol
Version 1.3", RFC 8446, DOI 10.17487/RFC8446, August 2018,
<https://www.rfc-editor.org/info/rfc8446>.
[RFC8460] Margolis, D., Brotman, A., Ramakrishnan, B., Jones, J.,
and M. Risher, "SMTP TLS Reporting", RFC 8460,
DOI 10.17487/RFC8460, September 2018,
<https://www.rfc-editor.org/info/rfc8460>.
11.2. Informative References
[RFC4033] Arends, R., Austein, R., Larson, M., Massey, D., and S. [RFC4033] Arends, R., Austein, R., Larson, M., Massey, D., and S.
Rose, "DNS Security Introduction and Requirements", Rose, "DNS Security Introduction and Requirements",
RFC 4033, DOI 10.17487/RFC4033, March 2005, RFC 4033, DOI 10.17487/RFC4033, March 2005,
<https://www.rfc-editor.org/info/rfc4033>. <https://www.rfc-editor.org/info/rfc4033>.
[RFC5322] Resnick, P., Ed., "Internet Message Format", RFC 5322, [RFC5322] Resnick, P., Ed., "Internet Message Format", RFC 5322,
DOI 10.17487/RFC5322, October 2008, <https://www.rfc- DOI 10.17487/RFC5322, October 2008,
editor.org/info/rfc5322>. <https://www.rfc-editor.org/info/rfc5322>.
[RFC5891] Klensin, J., "Internationalized Domain Names in [RFC5891] Klensin, J., "Internationalized Domain Names in
Applications (IDNA): Protocol", RFC 5891, Applications (IDNA): Protocol", RFC 5891,
DOI 10.17487/RFC5891, August 2010, <https://www.rfc- DOI 10.17487/RFC5891, August 2010,
editor.org/info/rfc5891>. <https://www.rfc-editor.org/info/rfc5891>.
[RFC6818] Yee, P., "Updates to the Internet X.509 Public Key [RFC6818] Yee, P., "Updates to the Internet X.509 Public Key
Infrastructure Certificate and Certificate Revocation List Infrastructure Certificate and Certificate Revocation List
(CRL) Profile", RFC 6818, DOI 10.17487/RFC6818, January (CRL) Profile", RFC 6818, DOI 10.17487/RFC6818, January
2013, <https://www.rfc-editor.org/info/rfc6818>. 2013, <https://www.rfc-editor.org/info/rfc6818>.
[RFC6960] Santesson, S., Myers, M., Ankney, R., Malpani, A., [RFC6960] Santesson, S., Myers, M., Ankney, R., Malpani, A.,
Galperin, S., and C. Adams, "X.509 Internet Public Key Galperin, S., and C. Adams, "X.509 Internet Public Key
Infrastructure Online Certificate Status Protocol - OCSP", Infrastructure Online Certificate Status Protocol - OCSP",
RFC 6960, DOI 10.17487/RFC6960, June 2013, RFC 6960, DOI 10.17487/RFC6960, June 2013,
<https://www.rfc-editor.org/info/rfc6960>. <https://www.rfc-editor.org/info/rfc6960>.
[RFC7234] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, [RFC7234] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke,
Ed., "Hypertext Transfer Protocol (HTTP/1.1): Caching", Ed., "Hypertext Transfer Protocol (HTTP/1.1): Caching",
RFC 7234, DOI 10.17487/RFC7234, June 2014, RFC 7234, DOI 10.17487/RFC7234, June 2014,
<https://www.rfc-editor.org/info/rfc7234>. <https://www.rfc-editor.org/info/rfc7234>.
[RFC7672] Dukhovni, V. and W. Hardaker, "SMTP Security via [RFC7672] Dukhovni, V. and W. Hardaker, "SMTP Security via
Opportunistic DNS-Based Authentication of Named Entities Opportunistic DNS-Based Authentication of Named Entities
(DANE) Transport Layer Security (TLS)", RFC 7672, (DANE) Transport Layer Security (TLS)", RFC 7672,
DOI 10.17487/RFC7672, October 2015, <https://www.rfc- DOI 10.17487/RFC7672, October 2015,
editor.org/info/rfc7672>. <https://www.rfc-editor.org/info/rfc7672>.
Appendix A. MTA-STS example record & policy [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for
Writing an IANA Considerations Section in RFCs", BCP 26,
RFC 8126, DOI 10.17487/RFC8126, June 2017,
<https://www.rfc-editor.org/info/rfc8126>.
Appendix A. MTA-STS Example Record and Policy
The owner of "example.com" wishes to begin using MTA-STS with a The owner of "example.com" wishes to begin using MTA-STS with a
policy that will solicit reports from senders without affecting how policy that will solicit reports from senders without affecting how
the messages are processed, in order to verify the identity of MXs the messages are processed, in order to verify the identity of MXes
that handle mail for "example.com", confirm that TLS is correctly that handle mail for "example.com", confirm that TLS is correctly
used, and ensure that certificates presented by the recipient MX used, and ensure that certificates presented by the recipient MX
validate. validate.
MTA-STS policy indicator TXT RR: MTA-STS Policy indicator TXT RR:
_mta-sts.example.com. IN TXT "v=STSv1; id=20160831085700Z;" _mta-sts.example.com. IN TXT "v=STSv1; id=20160831085700Z;"
MTA-STS Policy file served as the response body at "https://mta- MTA-STS Policy file served as the response body at
sts.example.com/.well-known/mta-sts.txt": "https://mta-sts.example.com/.well-known/mta-sts.txt":
version: STSv1 version: STSv1
mode: testing mode: testing
mx: mx1.example.com mx: mx1.example.com
mx: mx2.example.com mx: mx2.example.com
mx: mx.backup-example.com mx: mx.backup-example.com
max_age: 1296000 max_age: 1296000
Appendix B. Message delivery pseudocode Appendix B. Message Delivery Pseudocode
Below is pseudocode demonstrating the logic of a compliant sending Below is pseudocode demonstrating the logic of a compliant Sending
MTA. MTA.
While this pseudocode implementation suggests synchronous policy While this pseudocode implementation suggests synchronous policy
retrieval in the delivery path, in a working implementation that may retrieval in the delivery path, that may be undesirable in a working
be undesirable, and we expect some implementers to instead prefer a implementation, and we expect some implementers to instead prefer a
background fetch that does not block delivery if no cached policy is background fetch that does not block delivery when no cached policy
present. is present.
func isEnforce(policy) { func isEnforce(policy) {
// Return true if the policy mode is "enforce". // Return true if the policy mode is "enforce".
}
} func isNonExpired(policy) {
// Return true if the policy is not expired.
}
func isNonExpired(policy) { func tryStartTls(connection) {
// Return true if the policy is not expired. // Attempt to open an SMTP STARTTLS connection with the MX.
} }
func tryStartTls(connection) { func certMatches(connection, host) {
// Attempt to open an SMTP connection with STARTTLS with the MX. // Assume a handy function to return if the server
} // certificate presented in "connection" is valid for "host".
}
func certMatches(connection, host) { func policyMatches(candidate, policy) {
// Assume a handy function to return check if the server certificate presented for mx in policy.mx {
// in "connection" is valid for "host". // Literal match.
} if mx == candidate {
return true
}
// Wildcard matches only the leftmost label.
// Wildcards must always be followed by a '.'.
if mx[0] == '*' {
parts = SplitN(candidate, '.', 2) // Split on the first '.'.
if len(parts) > 1 && parts[1] == mx[2:] {
return true
}
}
}
return false
}
func policyMatches(candidate, policy) { func tryDeliverMail(connection, message) {
for mx in policy.mx { // Attempt to deliver "message" via "connection".
// Literal match. }
if mx == candidate {
return true
}
// Wildcard matches only the leftmost label.
// Wildcards must always be followed by a '.'.
if mx[0] == '*' {
parts = SplitN(candidate, '.', 2) // Split on the first '.'.
if len(parts) > 1 && parts[1] == mx[2:] {
return true
}
}
}
return false
}
func tryDeliverMail(connection, message) { func tryGetNewPolicy(domain) {
// Attempt to deliver "message" via "connection". // Check for an MTA-STS TXT record for "domain" in DNS, and return
} // the indicated policy.
}
func tryGetNewPolicy(domain) { func cachePolicy(domain, policy) {
// Check for an MTA-STS TXT record for "domain" in DNS, and return the // Store "policy" as the cached policy for "domain".
// indicated policy. }
}
func cachePolicy(domain, policy) { func tryGetCachedPolicy(domain) {
// Store "policy" as the cached policy for "domain". // Return a cached policy for "domain".
} }
func tryGetCachedPolicy(domain) { func reportError(error) {
// Return a cached policy for "domain". // Report an error via TLSRPT.
}
} func tryMxAccordingTo(message, mx, policy) {
connection := connect(mx)
if !connection {
return false // Can't connect to the MX, so it's not an MTA-STS
// error.
func reportError(error) { }
// Report an error via TLSRPT. secure := true
} if !policyMatches(mx, policy) {
secure = false
reportError(E_HOST_MISMATCH)
} else if !tryStartTls(connection) {
secure = false
reportError(E_NO_VALID_TLS)
} else if !certMatches(connection, policy) {
secure = false
reportError(E_CERT_MISMATCH)
}
if secure || !isEnforce(policy) {
return tryDeliverMail(connection, message)
}
return false
}
func tryMxAccordingTo(message, mx, policy) { func tryWithPolicy(message, domain, policy) {
connection := connect(mx) mxes := getMxForDomain(domain)
if !connection { for mx in mxes {
return false // Can't connect to the MX so it's not an MTA-STS if tryMxAccordingTo(message, mx, policy) {
// error. return true
} }
secure := true }
if !policyMatches(mx, policy) { return false
secure = false }
reportError(E_HOST_MISMATCH)
} else if !tryStartTls(connection) {
secure = false
reportError(E_NO_VALID_TLS)
} else if !certMatches(connection, policy) {
secure = false
reportError(E_CERT_MISMATCH)
}
if secure || !isEnforce(policy) {
return tryDeliverMail(connection, message)
}
return false
}
func tryWithPolicy(message, domain, policy) { func handleMessage(message) {
mxes := getMxForDomain(domain) domain := ... // domain part after '@' from recipient
for mx in mxes { policy := tryGetNewPolicy(domain)
if tryMxAccordingTo(message, mx, policy) { if policy {
return true cachePolicy(domain, policy)
} } else {
} policy = tryGetCachedPolicy(domain)
return false }
} if policy {
return tryWithPolicy(message, domain, policy)
}
// Try to deliver the message normally (i.e., without MTA-STS).
}
func handleMessage(message) { Contributors
domain := ... // domain part after '@' from recipient
policy := tryGetNewPolicy(domain) Wei Chuang
if policy { Google, Inc.
cachePolicy(domain, policy) weihaw@google.com
} else {
policy = tryGetCachedPolicy(domain) Viktor Dukhovni
} ietf-dane@dukhovni.de
if policy {
return tryWithPolicy(message, domain, policy) Markus Laber
} 1&1 Mail & Media Development & Technology GmbH
// Try to deliver the message normally (i.e., without MTA-STS). markus.laber@1und1.de
}
Nicolas Lidzborski
Google, Inc.
nlidz@google.com
Brandon Long
Google, Inc.
blong@google.com
Franck Martin
LinkedIn, Inc.
fmartin@linkedin.com
Klaus Umbach
1&1 Mail & Media Development & Technology GmbH
klaus.umbach@1und1.de
Authors' Addresses Authors' Addresses
Daniel Margolis Daniel Margolis
Google, Inc Google, Inc.
Email: dmargolis@google.com Email: dmargolis@google.com
Mark Risher Mark Risher
Google, Inc Google, Inc.
Email: risher@google.com Email: risher@google.com
Binu Ramakrishnan Binu Ramakrishnan
Yahoo!, Inc Oath, Inc.
Email: rbinu@yahoo-inc.com Email: prbinu@yahoo.com
Alexander Brotman Alexander Brotman
Comcast, Inc Comcast, Inc.
Email: alex_brotman@comcast.com Email: alex_brotman@comcast.com
Janet Jones Janet Jones
Microsoft, Inc Microsoft, Inc.
Email: janet.jones@microsoft.com Email: janet.jones@microsoft.com
 End of changes. 159 change blocks. 
471 lines changed or deleted 488 lines changed or added

This html diff was produced by rfcdiff 1.47. The latest version is available from http://tools.ietf.org/tools/rfcdiff/