draft-ietf-uta-mta-sts-04.txt   draft-ietf-uta-mta-sts-05.txt 
Using TLS in Applications D. Margolis Using TLS in Applications D. Margolis
Internet-Draft M. Risher Internet-Draft M. Risher
Intended status: Standards Track Google, Inc Intended status: Standards Track Google, Inc
Expires: October 5, 2017 B. Ramakrishnan Expires: November 4, 2017 B. Ramakrishnan
Yahoo!, Inc Yahoo!, Inc
A. Brotman A. Brotman
Comcast, Inc Comcast, Inc
J. Jones J. Jones
Microsoft, Inc Microsoft, Inc
April 3, 2017 May 3, 2017
SMTP MTA Strict Transport Security (MTA-STS) SMTP MTA Strict Transport Security (MTA-STS)
draft-ietf-uta-mta-sts-04 draft-ietf-uta-mta-sts-05
Abstract Abstract
SMTP Mail Transfer Agent Strict Transport Security (MTA-STS) is a SMTP Mail Transfer Agent Strict Transport Security (MTA-STS) is a
mechanism enabling mail service providers to declare their ability to mechanism enabling mail service providers to declare their ability to
receive Transport Layer Security (TLS) secure SMTP connections, and receive Transport Layer Security (TLS) secure SMTP connections, and
to specify whether sending SMTP servers should refuse to deliver to to specify whether sending SMTP servers should refuse to deliver to
MX hosts that do not offer TLS with a trusted server certificate. MX hosts that do not offer TLS with a trusted server certificate.
Status of This Memo Status of This Memo
skipping to change at page 1, line 40 skipping to change at page 1, line 40
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current/. Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on October 5, 2017. This Internet-Draft will expire on November 4, 2017.
Copyright Notice Copyright Notice
Copyright (c) 2017 IETF Trust and the persons identified as the Copyright (c) 2017 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 (http://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
skipping to change at page 2, line 21 skipping to change at page 2, line 21
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . 3 1.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . 3
2. Related Technologies . . . . . . . . . . . . . . . . . . . . 3 2. Related Technologies . . . . . . . . . . . . . . . . . . . . 3
3. Policy Discovery . . . . . . . . . . . . . . . . . . . . . . 4 3. Policy Discovery . . . . . . . . . . . . . . . . . . . . . . 4
3.1. MTA-STS TXT Records . . . . . . . . . . . . . . . . . . . 4 3.1. MTA-STS TXT Records . . . . . . . . . . . . . . . . . . . 4
3.2. MTA-STS Policies . . . . . . . . . . . . . . . . . . . . 5 3.2. MTA-STS Policies . . . . . . . . . . . . . . . . . . . . 5
3.3. HTTPS Policy Fetching . . . . . . . . . . . . . . . . . . 6 3.3. HTTPS Policy Fetching . . . . . . . . . . . . . . . . . . 6
3.4. Policy Selection for Smart Hosts and Subdomains . . . . . 7 3.4. Policy Selection for Smart Hosts and Subdomains . . . . . 7
4. Policy Validation . . . . . . . . . . . . . . . . . . . . . . 7 4. Policy Validation . . . . . . . . . . . . . . . . . . . . . . 8
4.1. MX Certificate Validation . . . . . . . . . . . . . . . . 7 4.1. MX Certificate Validation . . . . . . . . . . . . . . . . 8
5. Policy Application . . . . . . . . . . . . . . . . . . . . . 8 5. Policy Application . . . . . . . . . . . . . . . . . . . . . 9
5.1. Policy Application Control Flow . . . . . . . . . . . . . 8 5.1. Policy Application Control Flow . . . . . . . . . . . . . 9
6. Operational Considerations . . . . . . . . . . . . . . . . . 9 6. Operational Considerations . . . . . . . . . . . . . . . . . 10
6.1. Policy Updates . . . . . . . . . . . . . . . . . . . . . 9 6.1. Policy Updates . . . . . . . . . . . . . . . . . . . . . 10
7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 9 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 10
8. Security Considerations . . . . . . . . . . . . . . . . . . . 9 8. Security Considerations . . . . . . . . . . . . . . . . . . . 10
8.1. Obtaining a Signed Certificate . . . . . . . . . . . . . 10 8.1. Obtaining a Signed Certificate . . . . . . . . . . . . . 11
8.2. Preventing Policy Discovery . . . . . . . . . . . . . . . 10 8.2. Preventing Policy Discovery . . . . . . . . . . . . . . . 11
8.3. Denial of Service . . . . . . . . . . . . . . . . . . . . 11 8.3. Denial of Service . . . . . . . . . . . . . . . . . . . . 12
8.4. Weak Policy Constraints . . . . . . . . . . . . . . . . . 11 8.4. Weak Policy Constraints . . . . . . . . . . . . . . . . . 12
9. Contributors . . . . . . . . . . . . . . . . . . . . . . . . 12 9. Contributors . . . . . . . . . . . . . . . . . . . . . . . . 13
10. Appendix 1: MTA-STS example record & policy . . . . . . . . . 12 10. Appendix 1: MTA-STS example record & policy . . . . . . . . . 13
11. Appendix 2: Message delivery pseudocode . . . . . . . . . . . 12 11. Appendix 2: Message delivery pseudocode . . . . . . . . . . . 13
12. References . . . . . . . . . . . . . . . . . . . . . . . . . 15 12. References . . . . . . . . . . . . . . . . . . . . . . . . . 16
12.1. Normative References . . . . . . . . . . . . . . . . . . 15 12.1. Normative References . . . . . . . . . . . . . . . . . . 16
12.2. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 16 12.2. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 16 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 17
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 31 skipping to change at page 3, line 31
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 PKIX
authenticated TLS for the specified MX hosts. authenticated TLS 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 ordinarly be "example.com", but "alice@example.com" this would ordinarly be "example.com", but
this may be overriden by explicit routing rules (as described in this may be overriden by explicit routing rules (as described in
"Policy Selection for Smart Hosts"). Section 3.4, "Policy Selection for Smart Hosts and Subdomains").
2. Related Technologies 2. Related Technologies
The DANE TLSA record [RFC7672] is similar, in that DANE is also The DANE TLSA record [RFC7672] is similar, in that DANE is also
designed to upgrade unauthenticated encryption or plaintext designed to upgrade unauthenticated encryption or plaintext
transmission into authenticated, downgrade-resistent encrypted transmission into authenticated, downgrade-resistent encrypted
tarnsmission. DANE requires DNSSEC [RFC4033] for authentication; the tarnsmission. DANE requires DNSSEC [RFC4033] for authentication; the
mechanism described here instead relies on certificate authorities mechanism described here instead relies on certificate authorities
(CAs) and does not require DNSSEC, at a cost of risking malicious (CAs) and does not require DNSSEC, at a cost of risking malicious
downgrades. For a thorough discussion of this trade-off, see the downgrades. For a thorough discussion of this trade-off, see
section "Security Considerations". Section 8, "Security Considerations".
In addition, MTA-STS provides an optional report-only mode, enabling In addition, MTA-STS provides an optional report-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 MXs, but such a mechanism is not possible for the per-domain
policies used by MTA-STS. 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 upgrade their transport security even when deploying domains to upgrade their transport security even when deploying
DNSSEC is undesirable or impractical. However, MTA-STS is designed DNSSEC is undesirable or impractical. However, MTA-STS is designed
skipping to change at page 5, line 5 skipping to change at page 5, line 5
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
[RFC5234], is as follows: [RFC5234], is as follows:
sts-text-record = sts-version *WSP %x3B *WSP sts-id [%x3B] sts-text-record = sts-version *WSP field-delim *WSP sts-id
[field-delim [sts-extensions]]
sts-version = "v" *WSP "=" *WSP %x53 %x54 ; "STSv1" field-delim = %x3B ; ";"
%x53 %x76 %x31
sts-id = "id" *WSP "=" *WSP 1*32(ALPHA / DIGIT) sts-version = %x76 *WSP "=" *WSP %x53 %x54 ; "v=STSv1"
%x53 %x76 %x31
sts-id = %x69 %x64 *WSP "="
*WSP 1*32(ALPHA / DIGIT) ; "id="
sts-extensions = sts-extension *(field-delim sts-extension)
[field-delim] ; extension fields
sts-extension = sts-ext-name *WSP "=" *WSP sts-ext-value
sts-ext-name = (ALPHA / DIGIT) *31(ALPHA / DIGIT / "_" / "-" / ".")
sts-ext-value = 1*(%x21-3A / %x3C / %x3E-7E) ; chars excluding
; "=", ";", SP, and
; control chars
If multiple TXT records for "_mta-sts" are returned by the resolver, If multiple TXT records for "_mta-sts" are returned by the resolver,
records which do not begin with "v=STSv1;" are discarded. If the records which do not begin with "v=STSv1;" are discarded. If the
number of resulting records is not one, senders MUST assume the number of resulting records is not one, senders MUST assume the
recipient domain does not implement MTA-STS and skip the remaining recipient domain does not implement MTA-STS and skip the remaining
steps of policy discovery. steps of policy discovery.
3.2. MTA-STS Policies 3.2. MTA-STS Policies
The policy itself is a JSON [RFC4627] object served via the HTTPS GET The policy itself is a JSON [RFC7159] object served via the HTTPS GET
method from the fixed [RFC5785] "well-known" path of ".well-known/ method from the fixed [RFC5785] "well-known" path of ".well-known/
mta-sts.json" served by the "mta-sts" host at the Policy Domain. mta-sts.json" served by the "mta-sts" host at the Policy Domain.
Thus for "example.com" the path is "https://mta-sts.example.com Thus for "example.com" the path is "https://mta-sts.example.com
/.well-known/mta-sts.json". /.well-known/mta-sts.json".
This JSON object contains the following key/value pairs: This JSON object contains the following key/value pairs:
o "version": (plain-text, required). Currently only "STSv1" is o "version": (plain-text, required). Currently only "STSv1" is
supported. supported.
skipping to change at page 5, line 48 skipping to change at page 6, line 14
mitigate the risks of attacks at policy refresh time, it is mitigate the risks of attacks at policy refresh time, it is
expected that this value typically be in the range of weeks or expected that this value typically be in the range of weeks or
greater. greater.
o "mx": MX identity patterns (list of plain-text strings, required). o "mx": MX identity patterns (list of plain-text strings, required).
One or more patterns matching a Common Name ([RFC6125]) or Subject One or more patterns matching a Common Name ([RFC6125]) or Subject
Alternative Name ([RFC5280]) DNS-ID present in the X.509 Alternative Name ([RFC5280]) DNS-ID present in the X.509
certificate presented by any MX receiving mail for this domain. certificate presented by any MX receiving mail for this domain.
For example, "["mail.example.com", ".example.net"]" indicates that For example, "["mail.example.com", ".example.net"]" indicates that
mail for this domain might be handled by any MX with a certificate mail for this domain might be handled by any MX with a certificate
valid for a host at "example.com" or "example.net". Valid valid for a host at "mail.example.com" or "example.net". Valid
patterns can be either fully specified names ("example.com") or patterns can be either fully specified names ("example.com") or
suffixes (".example.net") matching the right-hand parts of a suffixes (".example.net") matching the right-hand parts of a
server's identity; the latter case are distinguished by a leading server's identity; the latter case are distinguished by a leading
period. In the case of Internationalized Domain Names period. In the case of Internationalized Domain Names
([RFC5891]), the MX MUST specify the Punycode-encoded A-label ([RFC5891]), the MX MUST specify the Punycode-encoded A-label
[RFC3492] and not the Unicode-encoded U-label. The full semantics [RFC3492] and not the Unicode-encoded U-label. The full semantics
of certificate validation are described in "MX Certificate of certificate validation are described in Section 4.1, "MX
Validation." Certificate Validation."
An example JSON policy is as below: An example JSON policy is as below:
{ {
"version": "STSv1", "version": "STSv1",
"mode": "enforce", "mode": "enforce",
"mx": [".mail.example.com"], "mx": [".mail.example.com"],
"max_age": 123456 "max_age": 123456
} }
Parsers SHOULD accept TXT records and policy files which are Parsers MUST accept TXT records and policy files which are
syntactically valid (i.e. valid key-value pairs separated by semi- syntactically valid (i.e. valid key-value pairs separated by semi-
colons for TXT records and valid JSON for policy files) and colons for TXT records and valid JSON for policy files) and
implementing a superset of this specification, in which case unknown implementing a superset of this specification, in which case unknown
fields SHALL be ignored. fields SHALL be ignored.
3.3. HTTPS Policy Fetching 3.3. HTTPS Policy Fetching
When fetching a new policy or updating a policy, the HTTPS endpoint When fetching a new policy or updating a policy, the HTTPS endpoint
MUST present a X.509 certificate which is valid for the "mta-sts" MUST present a X.509 certificate which is valid for the "mta-sts"
host (as described in [RFC6125]), chain to a root CA that is trusted host (as described below), chain to a root CA that is trusted by the
by the sending MTA, and be non-expired. It is expected that sending sending MTA, and be non-expired. It is expected that sending MTAs
MTAs use a set of trusted CAs similar to those in widely deployed Web use a set of trusted CAs similar to those in widely deployed Web
browsers and operating systems. browsers and operating systems.
The certificate is valid for the "mta-sts" host with respect to the
rules described in [RFC6125], with the following application-specific
considerations:
o Matching is performed only against the DNS-ID and CN-ID
identifiers.
o DNS domain names in server certificates MAY contain the wildcard
character '*' as the complete left-most label within the
identifier.
The certificate MAY be checked for revocation via the Online
Certificate Status Protocol (OCSP) [RFC2560], certificate revocation
lists (CRLs), or some other mechanism.
HTTP 3xx redirects MUST NOT be followed. HTTP 3xx redirects MUST NOT be followed.
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, we suggest exists. In the case that the HTTPS GET fails, we suggest
implementions may limit further attempts to a period of five minutes implementions may limit further attempts to a period of five minutes
or longer per version ID, to avoid overwhelming resource-constrained or longer per version ID, to avoid overwhelming resource-constrained
recipients with cascading failures. recipients with cascading failures.
Senders MAY impose a timeout on the HTTPS GET to avoid long delays Senders MAY impose a timeout on the HTTPS GET and/or a limit on the
imposed by attempted policy updates. A suggested timeout is one maximum size of the response body to avoid long delays or resource
minute; policy hosts SHOULD respond to requests with a complete exhaustion during attempted policy updates. A suggested timeout is
policy body within that timeout. one minute, and a suggested maximum policy size 64 kilobytes; policy
hosts SHOULD respond to requests with a complete policy body within
that timeout and size limit.
If a valid TXT record is found but no policy can be fetched via If a valid TXT record is found but no policy can be fetched via HTTPS
HTTPS, and there is no valid (non-expired) previously-cached policy, (for any reason), and there is no valid (non-expired) previously-
senders MUST treat the recipient domain as one that has not cached policy, senders MUST continue with delivery as though the
implemented MTA-STS. domain has not implemented MTA-STS. Senders who implement TLSRPT
(TODO: add ref) should, however, report this failure to the recipient
domain if the domain implements TLSRPT as well.
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
cache, the sender MUST apply that cached policy.
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 intermediate SMTP relay When sending mail via a "smart host"--an intermediate SMTP relay
rather than the message recipient's server--compliant senders MUST rather than the message recipient's server--compliant senders MUST
treat the smart host domain as the policy domain for the purposes of treat the smart host domain as the policy domain for the purposes of
policy discovery and application. policy discovery and application.
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
skipping to change at page 7, line 28 skipping to change at page 8, line 18
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
validate: validate:
1. That the recipient MX supports STARTTLS and offers a valid PKIX- 1. That the recipient MX supports STARTTLS and offers a valid PKIX-
based TLS certificate. based TLS certificate.
2. That at least one of the policy's "mx" patterns matches at least 2. That at least one of the policy's "mx" patterns matches at least
one of the identities presented in the MX's X.509 certificate, as one of the identities presented in the MX's X.509 certificate, as
descriped in "MX Certificate Validation". described in "MX Certificate Validation".
This section does not dictate the behavior of sending MTAs when This section does not dictate the behavior of sending MTAs when
policies fail to validate; in particular, validation failures of policies fail to validate; in particular, validation failures of
policies which specify "report" mode MUST NOT be interpreted as policies which specify "report" mode MUST NOT be interpreted as
delivery failures, as described in the section "Policy Application". delivery failures, as described in Section 5, "Policy Application".
4.1. MX Certificate Validation 4.1. MX Certificate Validation
The certificate presented by the receiving MX MUST chain to a root CA The certificate presented by the receiving MX MUST chain to a root CA
that is trusted by the sending MTA and be non-expired. The that is trusted by the sending MTA and be non-expired. The
certificate MUST have a CN-ID ([RFC6125]) or SAN ([RFC5280]) with a certificate MUST have a CN-ID ([RFC6125]) or SAN ([RFC5280]) with a
DNS-ID matching the "mx" pattern. DNS-ID matching the "mx" pattern. The MX's certificate MAY also be
checked for revocation via OCSP [RFC2560], certificate revocation
lists (CRLs), or some other mechanism.
Because the "mx" patterns are not hostnames, however, matching is not Because the "mx" patterns are not hostnames, however, matching is not
identical to other common cases of X.509 certificate authentication identical to other common cases of X.509 certificate authentication
(as described, for example, in [RFC6125]). Consider the example (as described, for example, in [RFC6125]). Consider the example
policy given above, with an "mx" pattern containing ".example.net". policy given above, with an "mx" pattern containing ".example.net".
In this case, if the MX server's X.509 certificate contains a SAN In this case, if the MX server's X.509 certificate contains a SAN
matching "*.example.net", we are required to implement "wildcard-to- matching "*.example.net", we are required to implement "wildcard-to-
wildcard" matching. wildcard" matching.
To simplify this case, we impose the following constraints on To simplify this case, we impose the following constraints on
wildcard certificates, identical to those in [RFC7672] section 3.2.3: wildcard certificates, identical to those in [RFC7672] section 3.2.3
wildcards are valid in DNS-IDs or CN-IDs, but must be the entire and [@!RFC6125 section 6.4.3: wildcards are valid in DNS-IDs or CN-
first label of the identifier (that is, "*.example.com", not IDs, but must be the entire first label of the identifier (that is,
"mail*.example.com"). Senders who are comparing a "suffix" MX "*.example.com", not "mail*.example.com"). Senders who are comparing
pattern with a wildcard identifier should thus strip the wildcard and a "suffix" MX pattern with a wildcard identifier should thus strip
ensure that the two sides match label-by-label, until all labels of the wildcard and ensure that the two sides match label-by-label,
the shorter side (if unequal length) are consumed. until all labels of the shorter side (if unequal length) are
consumed.
A simple pseudocode implementation of this algorithm is presented in A simple pseudocode implementation of this algorithm is presented in
the Appendix. the Appendix.
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 one of two ways, depending
on the value of the policy "mode" field: on the value of the policy "mode" field:
skipping to change at page 9, line 7 skipping to change at page 9, line 48
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, enforcing STARTTLS and, assuming a policy is deliver the message, enforcing STARTTLS and, assuming a policy is
present, PKIX certificate validation, and certificate validation present, PKIX certificate validation as described in Section 4.1,
as described in "MX Certificate Validation." "MX Certificate Validation."
3. Upon message retries, a message MAY be permanently failed 3. A message delivery MUST NOT be permanently failed until the
following first checking for the presence of a new policy (as sender has first checked for the presence of a new policy (as
indicated by the "id" field in the "_mta-sts" TXT record). indicated by the "id" field in the "_mta-sts" TXT record). If a
new policy is not found, senders SHOULD apply existing rules for
the case of temporary message delivery failures (as discussed in
[RFC5321] section 4.5.4.1).
6. Operational Considerations 6. Operational Considerations
6.1. Policy Updates 6.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
thus expect a policy will continue to be used by senders until both thus expect a policy will continue to be used by senders until both
the 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
skipping to change at page 13, line 19 skipping to change at page 14, line 15
present. 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) { func isNonExpired(policy) {
// Return true if the policy is not expired. // Return true if the policy is not expired.
} }
func tryStartTls(mx) { func tryStartTls(connection) {
// Attempt to open an SMTP connection with STARTTLS with the MX. // Attempt to open an SMTP connection with STARTTLS with the MX.
} }
func certMatches(connection, mx) { func certMatches(connection, policy) {
// For simplicity, we are not checking CNs here. // Assume a handy function to return CN and DNS-ID SANs.
for san in getSansFromCert(connection) { for san in getDnsIdSansAndCnFromCert(connection) {
// Return if the server certificate from "connection" matches the "mx" host. for mx in policy.mx {
if san[0] == '*' { // Return if the server certificate from "connection" matches the "mx" host.
// Invalid wildcard! if san[0] == '*' {
if san[1] != '.' return false // Invalid wildcard!
san = san[1:] if san[1] != '.' return false
} san = san[1:]
if san[0] == '.' && HasSuffix(mx, san) { }
return true if san[0] == '.' && HasSuffix(mx, san) {
} return true
if mx[0] == '.' && HasSuffix(san, mx) { }
return true if mx[0] == '.' && HasSuffix(san, mx) {
} return true
if mx == san { }
return true if mx == san {
return true
}
} }
} }
return false return false
} }
func tryDeliverMail(connection, message) { func tryDeliverMail(connection, message) {
// Attempt to deliver "message" via "connection". // Attempt to deliver "message" via "connection".
} }
func tryGetNewPolicy(domain) { func tryGetNewPolicy(domain) {
skipping to change at page 14, line 25 skipping to change at page 15, line 22
func reportError(error) { func reportError(error) {
// Report an error via TLSRPT. // Report an error via TLSRPT.
} }
func tryMxAccordingTo(message, mx, policy) { func tryMxAccordingTo(message, mx, policy) {
connection := connect(mx) connection := connect(mx)
if !connection { if !connection {
return false // Can't connect to the MX so it's not an MTA-STS error. return false // Can't connect to the MX so it's not an MTA-STS error.
} }
secure := true secure := true
if !tryStartTls(mx, &connection) { if !tryStartTls(connection) {
secure = false secure = false
reportError(E_NO_VALID_TLS) reportError(E_NO_VALID_TLS)
} else if !certMatches(connection, mx) { } else if !certMatches(connection, policy) {
secure = false secure = false
reportError(E_CERT_MISMATCH) reportError(E_CERT_MISMATCH)
} }
if secure || !isEnforce(policy) { if secure || !isEnforce(policy) {
return tryDeliverMail(connection, message) return tryDeliverMail(connection, message)
} }
return false return false
} }
func tryWithPolicy(message, domain, policy) { func tryWithPolicy(message, domain, policy) {
mxes := getMxForDomain(domain)
for mx in mxes { for mx in mxes {
if tryMxAccordingTo(message, mx, policy) { if tryMxAccordingTo(message, mx, policy) {
return true return true
} }
} }
return false return false
} }
func handleMessage(message) { func handleMessage(message) {
domain := ... // domain part after '@' from recipient domain := ... // domain part after '@' from recipient
skipping to change at page 15, line 5 skipping to change at page 16, line 4
return false return false
} }
func handleMessage(message) { func handleMessage(message) {
domain := ... // domain part after '@' from recipient domain := ... // domain part after '@' from recipient
policy := tryGetNewPolicy(domain) policy := tryGetNewPolicy(domain)
if policy { if policy {
cachePolicy(domain, policy) cachePolicy(domain, policy)
} else { } else {
policy = tryGetCachedPolicy(domain) policy = tryGetCachedPolicy(domain)
} }
if policy { if policy {
return tryWithPolicy(message, policy) return tryWithPolicy(message, domain, policy)
} }
// Try to deliver the message normally (i.e. without MTA-STS). // Try to deliver the message normally (i.e. without MTA-STS).
} }
12. References 12. References
12.1. Normative References 12.1. Normative References
[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, DOI 10.17487/ Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/
RFC2119, March 1997, RFC2119, March 1997,
<http://www.rfc-editor.org/info/rfc2119>. <http://www.rfc-editor.org/info/rfc2119>.
[RFC2560] Myers, M., Ankney, R., Malpani, A., Galperin, S., and C.
Adams, "X.509 Internet Public Key Infrastructure Online
Certificate Status Protocol - OCSP", RFC 2560, DOI 10
.17487/RFC2560, June 1999,
<http://www.rfc-editor.org/info/rfc2560>.
[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, <http://www.rfc-editor.org/info/rfc3207>. February 2002, <http://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,
<http://www.rfc-editor.org/info/rfc3492>. <http://www.rfc-editor.org/info/rfc3492>.
[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", RFC Rose, "DNS Security Introduction and Requirements", RFC
4033, DOI 10.17487/RFC4033, March 2005, 4033, DOI 10.17487/RFC4033, March 2005,
<http://www.rfc-editor.org/info/rfc4033>. <http://www.rfc-editor.org/info/rfc4033>.
[RFC4627] Crockford, D., "The application/json Media Type for
JavaScript Object Notation (JSON)", RFC 4627, DOI 10
.17487/RFC4627, July 2006,
<http://www.rfc-editor.org/info/rfc4627>.
[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, DOI 10.17487/ Specifications: ABNF", STD 68, RFC 5234, DOI 10.17487/
RFC5234, January 2008, RFC5234, January 2008,
<http://www.rfc-editor.org/info/rfc5234>. <http://www.rfc-editor.org/info/rfc5234>.
[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,
<http://www.rfc-editor.org/info/rfc5280>. <http://www.rfc-editor.org/info/rfc5280>.
[RFC5321] Klensin, J., "Simple Mail Transfer Protocol", RFC 5321,
DOI 10.17487/RFC5321, October 2008,
<http://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, DOI 10 Uniform Resource Identifiers (URIs)", RFC 5785, DOI 10
.17487/RFC5785, April 2010, .17487/RFC5785, April 2010,
<http://www.rfc-editor.org/info/rfc5785>. <http://www.rfc-editor.org/info/rfc5785>.
[RFC5891] Klensin, J., "Internationalized Domain Names in [RFC5891] Klensin, J., "Internationalized Domain Names in
Applications (IDNA): Protocol", RFC 5891, DOI 10.17487/ Applications (IDNA): Protocol", RFC 5891, DOI 10.17487/
RFC5891, August 2010, RFC5891, August 2010,
<http://www.rfc-editor.org/info/rfc5891>. <http://www.rfc-editor.org/info/rfc5891>.
[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, <http://www.rfc-editor.org/info/rfc6125>. 2011, <http://www.rfc-editor.org/info/rfc6125>.
[RFC7159] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data
Interchange Format", RFC 7159, DOI 10.17487/RFC7159, March
2014, <http://www.rfc-editor.org/info/rfc7159>.
[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, DOI 10 (DANE) Transport Layer Security (TLS)", RFC 7672, DOI 10
.17487/RFC7672, October 2015, .17487/RFC7672, October 2015,
<http://www.rfc-editor.org/info/rfc7672>. <http://www.rfc-editor.org/info/rfc7672>.
12.2. URIs 12.2. URIs
[1] https://mta-sts.example.com/.well-known/mta-sts.json: [1] https://mta-sts.example.com/.well-known/mta-sts.json:
 End of changes. 35 change blocks. 
87 lines changed or deleted 144 lines changed or added

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