Internet Engineering Task Force (IETF) D. Margolis Request for Comments: 8460 Google, Inc. Category: Standards Track A. Brotman ISSN: 2070-1721 Comcast, Inc. B. Ramakrishnan Oath, Inc. J. Jones Microsoft, Inc. M. Risher Google, Inc. September 2018 SMTP TLS ReportingAbstract
A number of protocols exist for establishing encrypted channels between SMTP Mail Transfer Agents (MTAs), including STARTTLS, DNS- Based Authentication of Named Entities (DANE) TLSA, and MTA Strict Transport Security (MTA-STS). These protocols can fail due to misconfiguration or active attack, leading to undelivered messages or delivery over unencrypted or unauthenticated channels. This document describes a reporting mechanism and format by which sending systems can share statistics and specific information about potential failures with recipient domains. Recipient domains can then use this information to both detect potential attacks and diagnose unintentional misconfigurations. Status of This Memo This is an Internet Standards Track document. This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 7841. 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/rfc8460.
Copyright Notice Copyright (c) 2018 IETF Trust and the persons identified as the document authors. All rights reserved. This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 1.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . 4 2. Related Technologies . . . . . . . . . . . . . . . . . . . . 5 3. Reporting Policy . . . . . . . . . . . . . . . . . . . . . . 6 3.1. Example Reporting Policy . . . . . . . . . . . . . . . . 8 3.1.1. Report Using MAILTO . . . . . . . . . . . . . . . . . 8 3.1.2. Report Using HTTPS . . . . . . . . . . . . . . . . . 8 4. Reporting Schema . . . . . . . . . . . . . . . . . . . . . . 8 4.1. Report Time Frame . . . . . . . . . . . . . . . . . . . . 9 4.2. Delivery Summary . . . . . . . . . . . . . . . . . . . . 10 4.2.1. Success Count . . . . . . . . . . . . . . . . . . . . 10 4.2.2. Failure Count . . . . . . . . . . . . . . . . . . . . 10 4.3. Result Types . . . . . . . . . . . . . . . . . . . . . . 10 4.3.1. Negotiation Failures . . . . . . . . . . . . . . . . 10 4.3.2. Policy Failures . . . . . . . . . . . . . . . . . . . 11 4.3.3. General Failures . . . . . . . . . . . . . . . . . . 11 4.3.4. Transient Failures . . . . . . . . . . . . . . . . . 12 4.4. JSON Report Schema . . . . . . . . . . . . . . . . . . . 12 4.5. Policy Samples . . . . . . . . . . . . . . . . . . . . . 15 5. Report Delivery . . . . . . . . . . . . . . . . . . . . . . . 15 5.1. Report Filename . . . . . . . . . . . . . . . . . . . . . 16 5.2. Compression . . . . . . . . . . . . . . . . . . . . . . . 17 5.3. Email Transport . . . . . . . . . . . . . . . . . . . . . 17 5.3.1. Example Report . . . . . . . . . . . . . . . . . . . 19 5.4. HTTPS Transport . . . . . . . . . . . . . . . . . . . . . 19 5.5. Delivery Retry . . . . . . . . . . . . . . . . . . . . . 20 5.6. Metadata Variances . . . . . . . . . . . . . . . . . . . 20 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 20 6.1. Message Headers . . . . . . . . . . . . . . . . . . . . . 20 6.2. Report Type . . . . . . . . . . . . . . . . . . . . . . . 21 6.3. +gzip Media Type Suffix . . . . . . . . . . . . . . . . . 22 6.4. application/tlsrpt+json Media Type . . . . . . . . . . . 23 6.5. application/tlsrpt+gzip Media Type . . . . . . . . . . . 24 6.6. STARTTLS Validation Result Types . . . . . . . . . . . . 25 7. Security Considerations . . . . . . . . . . . . . . . . . . . 26 8. Privacy Considerations . . . . . . . . . . . . . . . . . . . 27 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 28 9.1. Normative References . . . . . . . . . . . . . . . . . . 28 9.2. Informative References . . . . . . . . . . . . . . . . . 30 Appendix A. Example Reporting Policy . . . . . . . . . . . . . . 32 A.1. Report Using MAILTO . . . . . . . . . . . . . . . . . . . 32 A.2. Report Using HTTPS . . . . . . . . . . . . . . . . . . . 32 Appendix B. Example JSON Report . . . . . . . . . . . . . . . . 32 Contributors . . . . . . . . . . . . . . . . . . . . . . . . . . 34 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 34
1. Introduction
The STARTTLS extension to SMTP [RFC3207] allows SMTP clients and hosts to establish secure SMTP sessions over TLS. The protocol design uses an approach that has come to be known as "Opportunistic Security" (OS) [RFC7435]. This method maintains interoperability with clients that do not support STARTTLS, but it means that any attacker could potentially eavesdrop on a session. An attacker could perform a downgrade or interception attack by deleting parts of the SMTP session (such as the "250 STARTTLS" response) or redirect the entire SMTP session (perhaps by overwriting the resolved MX record of the delivery domain). Because such "downgrade attacks" are not necessarily apparent to the receiving MTA, this document defines a mechanism for sending domains to report on failures at multiple stages of the MTA-to-MTA conversation. Recipient domains may also use the mechanisms defined by MTA-STS [RFC8461] or DANE [RFC6698] to publish additional encryption and authentication requirements; this document defines a mechanism for sending domains that are compatible with MTA-STS or DANE to share success and failure statistics with recipient domains. Specifically, this document defines a reporting schema that covers failures in routing, DNS resolution, and STARTTLS negotiation; policy validation errors for both DANE [RFC6698] and MTA-STS [RFC8461]; and a standard TXT record that recipient domains can use to indicate where reports in this format should be sent. The report can also serve as a heartbeat to indicate that systems are successfully negotiating TLS during sessions as expected. This document is intended as a companion to the specification for SMTP MTA-STS [RFC8461] and adds reporting abilities for those implementing DANE [RFC7672].1.1. Terminology
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.
We also define the following terms for further use in this document: o MTA-STS Policy: A mechanism by which administrators can specify the expected TLS availability, presented identity, and desired actions for a given email recipient domain. MTA-STS is defined in [RFC8461]. o DANE Policy: A mechanism by which administrators can use DNSSEC to commit an MTA to support STARTTLS and to publish criteria to be used to validate its presented certificates. DANE for SMTP is defined in [RFC7672], with the base specification defined in [RFC6698] (and updated by [RFC7671]). o TLSRPT (TLS Reporting) Policy: A policy specifying the endpoint to which Sending MTAs should deliver reports. o Policy Domain: The domain against which a TLSRPT, an MTA-STS, or a DANE policy is defined. For TLSRPT and MTA-STS, this is typically the same as the envelope recipient domain [RFC5321], but when mail is routed to a "smarthost" gateway by local policy, the "smarthost" domain name is used instead. For DANE, the Policy Domain is the "TLSA base domain" of the receiving SMTP server as described in Section 2.2.3 of RFC 7672 and Section 3 of RFC 6698. o Sending MTA: The MTA initiating the relay of an email message. o Aggregate Report URI (rua): A comma-separated list of locations where the report is to be submitted. o ABNF: Augmented Backus-Naur Form, a syntax for formally specifying syntax, defined in [RFC5234] and [RFC7405].2. Related Technologies
o This document is intended as a companion to the specification for SMTP MTA-STS [RFC8461]. o SMTP TLSRPT defines a mechanism for sending domains that are compatible with MTA-STS or DANE to share success and failure statistics with recipient domains. DANE is defined in [RFC6698], and MTA-STS is defined in [RFC8461].
3. Reporting Policy
A domain publishes a record to its DNS indicating that it wishes to receive reports. These SMTP TLSRPT policies are distributed via DNS from the Policy Domain's zone as TXT records (similar to Domain-based Message Authentication, Reporting, and Conformance (DMARC) policies) under the name "_smtp._tls". For example, for the Policy Domain "example.com", the recipient's TLSRPT policy can be retrieved from "_smtp._tls.example.com". Policies consist of the following directives: o "v": This document defines version 1 of TLSRPT, for which this value MUST be equal to "TLSRPTv1". Other versions may be defined in later documents. o "rua": A URI specifying the endpoint to which aggregate information about policy validation results should be sent (see Section 4, "Reporting Schema", for more information). Two URI schemes are supported: "mailto" and "https". As with DMARC [RFC7489], the Policy Domain can specify a comma-separated list of URIs. o In the case of "https", reports should be submitted via POST [RFC7231] to the specified URI. Report submitters MAY ignore certificate validation errors when submitting reports via HTTPS POST. o In the case of "mailto", reports should be submitted to the specified email address [RFC6068]. When sending failure reports via SMTP, Sending MTAs MUST deliver reports despite any TLS- related failures and SHOULD NOT include this SMTP session in the next report. This may mean that the reports are delivered unencrypted. Reports sent via SMTP MUST contain a valid DomainKeys Identified Mail (DKIM) [RFC6376] signature by the reporting domain. Reports lacking such a signature MUST be ignored by the recipient. DKIM signatures MUST NOT use the "l=" attribute to limit the body length used in the signature. This ensures attackers cannot append extraneous or misleading data to a report without breaking the signature. The DKIM TXT record SHOULD contain the appropriate service type declaration, "s=tlsrpt". If not present, the receiving system MAY ignore reports lacking that service type. Sample DKIM record: dkim_selector._domainkey.example.com TXT "v=DKIM1;k=rsa;s=tlsrpt;p=Mlf4qwSZfase4fa=="
The formal definition of the "_smtp._tls" TXT record, defined using [RFC5234] and [RFC7405], is as follows: tlsrpt-record = tlsrpt-version 1*(field-delim tlsrpt-field) [field-delim] field-delim = *WSP ";" *WSP tlsrpt-field = tlsrpt-rua / ; Note that the tlsrpt-extension ; tlsrpt-rua record is ; required. tlsrpt-version = %s"v=TLSRPTv1" tlsrpt-rua = %s"rua=" tlsrpt-uri *(*WSP "," *WSP tlsrpt-uri) tlsrpt-uri = URI ; "URI" is imported from [RFC3986]; ; commas (ASCII 0x2C), exclamation ; points (ASCII 0x21), and semicolons ; (ASCII 0x3B) MUST be encoded tlsrpt-extension = tlsrpt-ext-name "=" tlsrpt-ext-value tlsrpt-ext-name = (ALPHA / DIGIT) *31(ALPHA / DIGIT / "_" / "-" / ".") tlsrpt-ext-value = 1*(%x21-3A / %x3C / %x3E-7E) ; chars excluding "=", ";", SP, and control ; chars If multiple TXT records for "_smtp._tls" are returned by the resolver, records that do not begin with "v=TLSRPTv1;" are discarded. If the number of resulting records is not one, senders MUST assume the recipient domain does not implement TLSRPT. If the resulting TXT record contains multiple strings (as described in Section 3.3 of [RFC7208]), then the record MUST be treated as if those strings are concatenated without adding spaces. The record supports the ability to declare more than one rua, and if there exists more than one, the reporter MAY attempt to deliver to each of the supported rua destinations. A receiver MAY opt to only attempt delivery to one of the endpoints; however, the report SHOULD NOT be considered successfully delivered until one of the endpoints accepts delivery of the report.
Parsers MUST accept TXT records that are syntactically valid (i.e., valid key/value pairs separated by semicolons) and implement a superset of this specification, in which case unknown fields SHALL be ignored.3.1. Example Reporting Policy
3.1.1. Report Using MAILTO
_smtp._tls.example.com. IN TXT \ "v=TLSRPTv1;rua=mailto:reports@example.com"3.1.2. Report Using HTTPS
_smtp._tls.example.com. IN TXT \ "v=TLSRPTv1; \ rua=https://reporting.example.com/v1/tlsrpt"4. Reporting Schema
The report is composed as a plaintext file encoded in the Internet JSON (I-JSON) format [RFC7493]. Aggregate reports contain the following fields: o Report metadata: * The organization responsible for the report * Contact information for one or more responsible parties for the contents of the report * A unique identifier for the report * The reporting date range for the report o Policy, consisting of: * One of the following policy types: (1) the MTA-STS Policy applied (as a string), (2) the DANE TLSA record applied (as a string, with each RR entry of the RRset listed and separated by a semicolon), and (3) the literal string "no-policy-found", if neither a DANE nor MTA-STS Policy could be found. * The domain for which the policy is applied * The MX host
o Aggregate counts, comprising result type, Sending MTA IP, receiving MTA hostname, session count, and an optional additional information field containing a URI for recipients to review further information on a failure type. Note that the failure types are non-exclusive; an aggregate report may contain overlapping "counts" of failure types when a single send attempt encountered multiple errors. Reporters may report multiple applied policies (for example, an MTA-STS Policy and a DANE TLSA record for the same domain and MX). Because of this, even in the case where only a single policy was applied, the "policies" field of the report body MUST be an array and not a singular value. In the case of multiple failure types, the "failure-details" array would contain multiple entries. Each entry would have its own set of information pertaining to that failure type.4.1. Report Time Frame
The report SHOULD cover a full day, from 00:00-24:00 UTC. This should allow for easier correlation of failure events. To avoid unintentionally overloading the system processing the reports, the reports should be delivered after some delay, perhaps several hours. As an example, a sending site might want to introduce a random delay of up to four hours: func generate_sleep_delay() { min_delay = 1 max_delay = 14400 rand = random(min_delay, max_delay) return rand } func generate_report(policy_domain) { do_rpt_work(policy_domain) send_rpt(policy_domain) } func generate_tlsrpt() { sleep(generate_sleep_delay()) for policy_domain in list_of_tlsrpt_enabled_domains { generate_report(policy_domain) } }
4.2. Delivery Summary
4.2.1. Success Count
o "total-successful-session-count": This indicates that the Sending MTA was able to successfully negotiate a policy-compliant TLS connection and serves to provide a "heartbeat" to receiving domains that signifies reporting is functional and tabulating correctly. This field contains an aggregate count of successful connections for the reporting system.4.2.2. Failure Count
o "total-failure-session-count": This indicates that the Sending MTA was unable to successfully establish a connection with the receiving platform. Section 4.3, "Result Types", will elaborate on the failed negotiation attempts. This field contains an aggregate count of failed connections.4.3. Result Types
The list of result types will start with the minimal set below and is expected to grow over time based on real-world experience. The initial set is outlined in Sections 4.3.1 to 4.3.4:4.3.1. Negotiation Failures
o "starttls-not-supported": This indicates that the recipient MX did not support STARTTLS. o "certificate-host-mismatch": This indicates that the certificate presented did not adhere to the constraints specified in the MTA- STS or DANE policy, e.g., if the MX hostname does not match any identities listed in the subject alternative name (SAN) [RFC5280]. o "certificate-expired": This indicates that the certificate has expired. o "certificate-not-trusted": This is a label that covers multiple certificate-related failures that include, but are not limited to, errors such as untrusted/unknown certification authorities (CAs), certificate name constraints, certificate chain errors, etc. When using this declaration, the reporting MTA SHOULD utilize the "failure-reason-code" to provide more information to the receiving entity.
o "validation-failure": This indicates a general failure for a reason not matching a category above. When using this declaration, the reporting MTA SHOULD utilize the "failure-reason- code" to provide more information to the receiving entity.4.3.2. Policy Failures
4.3.2.1. DANE-Specific Policy Failures
o "tlsa-invalid": This indicates a validation error in the TLSA record associated with a DANE policy. None of the records in the RRset were found to be valid. o "dnssec-invalid": This indicates that no valid records were returned from the recursive resolver. o "dane-required": This indicates that the sending system is configured to require DANE TLSA records for all the MX hosts of the destination domain, but no DNSSEC-validated TLSA records were present for the MX host that is the subject of the report. Mandatory DANE for SMTP is described in Section 6 of [RFC7672]. Such policies may be created by mutual agreement between two organizations that frequently exchange sensitive content via email.4.3.2.2. MTA-STS-specific Policy Failures
o "sts-policy-fetch-error": This indicates a failure to retrieve an MTA-STS policy, for example, because the policy host is unreachable. o "sts-policy-invalid": This indicates a validation error for the overall MTA-STS Policy. o "sts-webpki-invalid": This indicates that the MTA-STS Policy could not be authenticated using PKIX validation.4.3.3. General Failures
When a negotiation failure cannot be categorized into one of the "Negotiation Failures" stated above, the reporter SHOULD use the "validation-failure" category. As TLS grows and becomes more complex, new mechanisms may not be easily categorized. This allows for a generic feedback category. When this category is used, the reporter SHOULD also use "failure-reason-code" to give some feedback to the receiving entity. This is intended to be a short text field, and the contents of the field should be an error code or error text, such as "X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION".
4.3.4. Transient Failures
Transient errors due to too-busy networks, TCP timeouts, etc., are not required to be reported.4.4. JSON Report Schema
The JSON schema is derived from the HTTP Public Key Pinning (HPKP) JSON schema; see Section 3 of [RFC7469]. { "organization-name": organization-name, "date-range": { "start-datetime": date-time, "end-datetime": date-time }, "contact-info": email-address, "report-id": report-id, "policies": [{ "policy": { "policy-type": policy-type, "policy-string": policy-string, "policy-domain": domain, "mx-host": mx-host-pattern }, "summary": { "total-successful-session-count": total-successful-session-count, "total-failure-session-count": total-failure-session-count }, "failure-details": [ { "result-type": result-type, "sending-mta-ip": ip-address, "receiving-mx-hostname": receiving-mx-hostname, "receiving-mx-helo": receiving-mx-helo, "receiving-ip": receiving-ip, "failed-session-count": failed-session-count, "additional-information": additional-info-uri, "failure-reason-code": failure-reason-code } ] } ] } JSON Report Format
o "organization-name": The name of the organization responsible for the report. It is provided as a string. o "date-time": The date-time indicates the start and end times for the report range. It is provided as a string formatted according to "Internet Date/Time Format", Section 5.6 of [RFC3339]. The report should be for a full UTC day, 00:00-24:00. o "email-address": The contact information for the party responsible for the report. It is provided as a string formatted according to "Addr-Spec Specification", Section 3.4.1 of [RFC5322]. o "report-id": A unique identifier for the report. Report authors may use whatever scheme they prefer to generate a unique identifier. It is provided as a string. o "policy-type": The type of policy that was applied by the sending domain. Presently, the only three valid choices are "tlsa", "sts", and the literal string "no-policy-found". It is provided as a string. o "policy-string": An encoding of the applied policy as a JSON array of strings, whether it's a TLSA record ([RFC6698], Section 2.3) or an MTA-STS Policy. Examples follow in the next section. o "domain": The Policy Domain against which the MTA-STS or DANE policy is defined. In the case of Internationalized Domain Names [RFC5891], the domain MUST consist of the Punycode-encoded A-labels [RFC3492] and not the U-labels. o "mx-host-pattern": In the case where "policy-type" is "sts", it's the pattern of MX hostnames from the applied policy. It is provided as a JSON array of strings and is interpreted in the same manner as the rules in "MX Host Validation"; see Section 4.1 of [RFC8461]. In the case of Internationalized Domain Names [RFC5891], the domain MUST consist of the Punycode-encoded A-labels [RFC3492] and not the U-labels. o "result-type": A value from Section 4.3, "Result Types", above. o "ip-address": The IP address of the Sending MTA that attempted the STARTTLS connection. It is provided as a string representation of an IPv4 (see below) or IPv6 [RFC5952] address in dot-decimal or colon-hexadecimal notation. o "receiving-mx-hostname": The hostname of the receiving MTA MX record with which the Sending MTA attempted to negotiate a STARTTLS connection.
o "receiving-mx-helo" (optional): The HELLO (HELO) or Extended HELLO (EHLO) string from the banner announced during the reported session. o "receiving-ip": The destination IP address that was used when creating the outbound session. It is provided as a string representation of an IPv4 (see below) or IPv6 [RFC5952] address in dot-decimal or colon-hexadecimal notation. o "total-successful-session-count": The aggregate count (an integer, encoded as a JSON number) of successfully negotiated TLS-enabled connections to the receiving site. o "total-failure-session-count": The aggregate count (an integer, encoded as a JSON number) of failures to negotiate a TLS-enabled connection to the receiving site. o "failed-session-count": The number of (attempted) sessions that match the relevant "result-type" for this section (an integer, encoded as a JSON number). o "additional-info-uri" (optional): A URI [RFC3986] that points to additional information around the relevant "result-type". For example, this URI might host the complete certificate chain presented during an attempted STARTTLS session. o "failure-reason-code": A text field to include a TLS-related error code or error message. For report purposes, an IPv4 address is defined via the following ABNF: IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet dec-octet = DIGIT ; 0-9 / %x31-39 DIGIT ; 10-99 / "1" 2DIGIT ; 100-199 / "2" %x30-34 DIGIT ; 200-249 / "25" %x30-35 ; 250-255 And an IPv6 address is defined via the following ABNF: IPv6address = <as defined in [RFC5954]>
4.5. Policy Samples
Part of the report body includes the policy that is applied when attempting relay to the destination. For DANE TLSA policies, this is a JSON array of strings each representing the RDATA of a single TLSA resource record as a space- separated list of its four TLSA fields; the fields are in presentation format (defined in [RFC6698], Section 2.2) with no internal spaces or grouping parentheses: [ "3 0 1 1F850A337E6DB9C609C522D136A475638CC43E1ED424F8EEC8513 D747D1D085D", "3 0 1 12350A337E6DB9C6123522D136A475638CC43E1ED424F8EEC8513 D747D1D1234" ] For MTA-STS policies, this is an array of JSON strings that represents the policy that is declared by the receiving site, including any errors that may be present. Note that where there are multiple "mx" values, they must be listed as separate "mx" elements in the policy array rather than as a single nested "mx" sub-array. [ "version: STSv1", "mode: testing", "mx: mx1.example.com", "mx: mx2.example.com", "mx: mx.backup-example.com", "max_age: 604800" ]