<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rfc SYSTEM 'rfc2629.dtd' []>
<rfc ipr="trust200902" category="std" docName="draft-ietf-uta-smtp-tlsrpt-01">
<?rfc toc="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<?rfc private=""?>
<?rfc topblock="yes"?>
<?rfc comments="no"?>
<front>
<title abbrev="SMTP-TLSRPT">SMTP TLS Reporting</title>

<author initials="D." surname="Margolis" fullname="Daniel Margolis">
<organization>Google, Inc</organization>
<address>
<postal>
<street></street>
<city></city>
<code></code>
<country></country>
<region></region>
</postal>
<phone></phone>
<email>dmargolis (at) google.com</email>
<uri></uri>
</address>
</author>
<author initials="A." surname="Brotman" fullname="Alexander Brotman">
<organization>Comcast, Inc</organization>
<address>
<postal>
<street></street>
<city></city>
<code></code>
<country></country>
<region></region>
</postal>
<phone></phone>
<email>alexander_brotman (at) cable.comcast (dot com)</email>
<uri></uri>
</address>
</author>
<author initials="B." surname="Ramakrishnan" fullname="Binu Ramakrishnan">
<organization>Yahoo!, Inc</organization>
<address>
<postal>
<street></street>
<city></city>
<code></code>
<country></country>
<region></region>
</postal>
<phone></phone>
<email>rbinu (at) yahoo-inc (dot com)</email>
<uri></uri>
</address>
</author>
<author initials="J." surname="Jones" fullname="Janet Jones">
<organization>Microsoft, Inc</organization>
<address>
<postal>
<street></street>
<city></city>
<code></code>
<country></country>
<region></region>
</postal>
<phone></phone>
<email>janet.jones (at) microsoft (dot com)</email>
<uri></uri>
</address>
</author>
<author initials="M." surname="Risher" fullname="Mark Risher">
<organization>Google, Inc</organization>
<address>
<postal>
<street></street>
<city></city>
<code></code>
<country></country>
<region></region>
</postal>
<phone></phone>
<email>risher (at) google (dot com)</email>
<uri></uri>
</address>
</author>
<date year="2016" month="July" day="8"/>

<area>Applications</area>
<workgroup>Using TLS in Applications</workgroup>
<keyword></keyword>


<abstract>
<t>A number of protocols exist for establishing encrypted channels between SMTP
Mail Transfer Agents, including STARTTLS <xref target="RFC3207"/>, DANE <xref target="RFC6698"/>, and SMTP
MTA STS (TODO: Add ref). 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 attackers and diagnose unintentional
misconfigurations.
</t>
</abstract>


</front>

<middle>

<section anchor="introduction" title="Introduction">
<t>The STARTTLS extension to SMTP <xref target="RFC3207"/> allows SMTP clients and hosts to
establish secure SMTP sessions over TLS. The protocol design is based on
&quot;Opportunistic Security&quot; (OS) <xref target="RFC7435"/>, which provides interoperability for
clients that do not support STARTTLS but means that any attacker who can delete
parts of the SMTP session (such as the &quot;250 STARTTLS&quot; response) or redirect the
entire SMTP session (perhaps by overwriting the resolved MX record of the
delivery domain) can perform a downgrade or interception attack.
</t>
<t>Because such &quot;downgrade attacks&quot; are not necessarily apparent to the receiving
MTA, this document defines a mechanism for sending domains to report on failures
at multiple parts of the MTA-to-MTA conversation.
</t>
<t>Recipient domains may also use the mechanisms defined by MTA-STS (TODO: Add ref)
or DANE <xref target="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.
</t>
<t>Specifically, this document defines a reporting schema that covers failures in
routing, STARTTLS negotiation, and both DANE <xref target="RFC6698"/> and MTA-STS (TODO: Add
ref) policy validation errors, and standard TXT record that recipient domains
can use to indicate where reports in this format should be sent.
</t>
<t>This document is intended as a companion to the specification for SMTP MTA
Strict Transport Security (MTA-STS, TODO: Add ref).
</t>

<section anchor="terminology" title="Terminology">
<t>The keywords MUST, MUST NOT, REQUIRED, SHALL, SHALL NOT,
SHOULD, SHOULD NOT, RECOMMENDED, MAY, and OPTIONAL, when
they appear in this document, are to be interpreted as described in <xref target="RFC2119"/>.
</t>
<t>We also define the following terms for further use in this document:
</t>
<t>
<list style="symbols">
<t>STS Policy: A definition of the expected TLS availability and behavior, as
well as the desired actions for a given domain when a sending MTA encounters
different results.</t>
<t>TLSRPT Policy: A policy detailing the endpoint to which sending MTAs should
deliver reports.</t>
<t>Policy Domain: The domain against which an STS Policy is defined.</t>
<t>Sending MTA: The MTA initiating the delivery of an email message.</t>
</list>
</t>
</section>
</section>

<section anchor="related-technologies" title="Related Technologies">
<t>
<list style="symbols">
<t>This document is intended as a companion to the specification for SMTP MTA
Strict Transport Security (MTA-STS, TODO: Add ref).</t>
<t>The Public Key Pinning Extension for HTTP <xref target="RFC7469"/> contains a JSON-based
definition for reporting individual pin validation failures.</t>
<t>The Domain-based Message Authentication, Reporting, and Conformance (DMARC)
<xref target="RFC7489"/> contains an XML-based reporting format for aggregate and
detailed email delivery errors.</t>
</list>
</t>
</section>

<section anchor="reporting-policy" title="Reporting Policy">
<t>SMTP TLSRPT policies are distributed via DNS from the Policy Domain's zone, as
TXT records (similar to DMARC policies) under the name <spanx style="verb">_smtp_tlsrpt</spanx>. For
example, for the Policy Domain <spanx style="verb">example.com</spanx>, the recipient's SMTP STS policy
can be retrieved from <spanx style="verb">_smtp_tlsrpt.example.com</spanx>.
</t>
<t>(Future implementations may move to alternate methods of policy discovery or
distribution. See the section <spanx style="emph">Future</spanx> <spanx style="emph">Work</spanx> for more discussion.)
</t>
<t>Policies consist of the following directives:
</t>
<t>
<list style="symbols">
<t><spanx style="verb">v</spanx>: This value MUST be equal to <spanx style="verb">TLSRPTv1</spanx>.</t>
<t><spanx style="verb">rua</spanx>: A URI specifying the endpoint to which aggregate information about
 policy failures should be sent (see the section <spanx style="emph">Reporting</spanx> <spanx style="emph">Schema</spanx> for
 more information). Two URI schemes are supported: <spanx style="verb">mailto</spanx> and <spanx style="verb">https</spanx>.

<figure align="center"><artwork align="center">
 * In the case of `https`, reports should be submitted via POST
   ([@!RFC2818]) to the specified URI.
 * In the case of `mailto`, reports should be submitted to the specified
   email address. When sending failure reports via SMTP, sending MTAs
   MUST NOT honor SMTP STS or DANE TLSA failures.
</artwork></figure></t>
<t><spanx style="verb">ruf</spanx>: Future use. (There may also be a need for enabling more detailed
 &quot;forensic&quot; reporting during initial stages of a deployment. To address
 this, the authors consider the possibility of an optional additional
 &quot;forensic reporting mode&quot; in which more details--such as certificate chains
 and MTA banners--may be reported. See the section <spanx style="emph">Future</spanx> <spanx style="emph">Work</spanx> for more
 details.)</t>
</list>
</t>
<t>The formal definition of the <spanx style="verb">_mta_sts</spanx> TXT record, defined using <xref target="RFC5234"/>,
is as follows:
</t>

<figure align="center"><artwork align="center">
sts-text-record = sts-version *WSP %x3B *WSP sts-id

sts-version     = "v" *WSP "=" *WSP %x54 %x4C %x53 
                  %x52 %x50 %x54 %x76 %x31

sts-id          = "id" *WSP "=" *WSP 1*32(ALPHA / DIGIT)
</artwork></figure>

<section anchor="example-reporting-policy" title="Example Reporting Policy">

<section anchor="report-using-mailto" title="Report using MAILTO">

<figure align="center"><artwork align="center">
_smtp_tlsrpt.mail.example.com. IN TXT \
	"v=TLSRPTv1;rua=mailto:reports@example.com"
</artwork></figure>
</section>

<section anchor="report-using-https" title="Report using HTTPS">

<figure align="center"><artwork align="center">
_smtp_tlsrpt.mail.example.com. IN TXT \
	"v=TLSRPTv1; \
	rua=https://reporting.example.com/v1/tlsrpt"
</artwork></figure>
</section>
</section>
</section>

<section anchor="reporting-schema" title="Reporting Schema">
<t>Aggregate reports contain the following fields:
</t>
<t>
<list style="symbols">
<t>Report metadata:
<list style="symbols">
<t>The organization responsible for the report
<list style="symbols">
<t>Contact information for one or more responsible parties for the
contents of the report</t>
</list></t>
<t>A unique identifier for the report</t>
<t>The reporting date range for the report</t>
</list></t>
<t>Policy, consisting of:
<list style="symbols">
<t>One of the following policy types:
<list style="symbols">
<t>The SMTP MTA STS policy applied (as a string)</t>
<t>The DANE TLSA record applied (as a string)
    * The literal string <spanx style="verb">no-policy-found</spanx>, if neither a TLSA nor

<figure align="center"><artwork align="center">
  MTA-STS policy could be found.
</artwork></figure></t>
</list></t>
<t>The domain for which the policy is applied</t>
<t>The MX host</t>
<t>An identifier for the policy (where applicable)</t>
</list></t>
<t>Aggregate counts, comprising result type, sending MTA IP, receiving MTA
hostname, message count, and an optional additional information field
containing a URI for recipients to review further information on a failure
type.</t>
</list>
</t>
<t>Note that the failure types are non-exclusive; an aggregate report MAY contain
overlapping <spanx style="verb">counts</spanx> of failure types where a single send attempt encountered
multiple errors.
</t>

<section anchor="result-types" title="Result Types">
<t>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:
</t>

<section anchor="success-type" title="Success Type">
<t>
<list style="symbols">
<t><spanx style="verb">success</spanx>: This indicates that the sending MTA was able to successfully
negotiate a policy-compliant TLS connection, and serves to provide a
&quot;heartbeat&quot; to receiving domains that reporting is functional and tabulating
correctly.


<vspace/></t>
</list>
</t>
</section>

<section anchor="routing-failures" title="Routing Failures">
<t>
<list style="symbols">
<t><spanx style="verb">mx-mismatch</spanx>: This indicates that the MX resolved for the recipient domain
did not match the MX constraint specified in the policy.</t>
<t><spanx style="verb">certificate-host-mismatch</spanx>: This indicates that the certificate presented
by the receiving MX did not match the MX hostname.</t>
</list>
</t>
</section>

<section anchor="negotiation-failures" title="Negotiation Failures">
<t>
<list style="symbols">
<t><spanx style="verb">starttls-not-supported</spanx>: This indicates that the recipient MX did not
support STARTTLS.</t>
<t><spanx style="verb">invalid-certificate</spanx>: This indicates that the certificate presented by the
receiving MX did not validate.</t>
<t><spanx style="verb">certificate-host-mismatch</spanx>: This indicates that the certificate presented
did not adhere to the constraints specified in the STS or DANE policy, e.g.
if the CN field did not match the hostname of the MX.</t>
<t><spanx style="verb">certificate-name-constraints-not-permitted</spanx>: The certificate request
contains a name that is not listed as permitted in the name constraints
extension of the cert issuer.</t>
<t><spanx style="verb">certificate-name-constraints-excluded</spanx>: The certificate request contains a
name that is listed as excluded in the name constraints extension of the
issuer.</t>
<t><spanx style="verb">expired-certificate</spanx>: This indicates that the certificate has expired.</t>
</list>
</t>
</section>

<section anchor="policy-failures" title="Policy Failures">

<section anchor="danespecific-policy-failures" title="DANE-specific Policy Failures">
<t>
<list style="symbols">
<t><spanx style="verb">tlsa-invalid</spanx>: This indicates a validation error in the TLSA record
associated with a DANE policy.</t>
<t><spanx style="verb">dnssec-invalid</spanx>: This indicates a failure to authenticate DNS records for a
Policy Domain with a published TLSA record.</t>
</list>
</t>
</section>

<section anchor="stsspecific-policy-failures" title="STS-specific Policy Failures">
<t>
<list style="symbols">
<t><spanx style="verb">sts-invalid</spanx>: This indicates a validation error for the overall MTA-STS
policy.</t>
<t><spanx style="verb">webpki-invalid</spanx>: This indicates that the MTA-STS policy could not be
authenticated using PKIX validation.</t>
</list>
</t>
</section>
</section>
</section>
</section>

<section anchor="report-delivery" title="Report Delivery">
<t>Note that, when sending failure reports via SMTP, sending MTAs MUST NOT honor
SMTP STS or DANE TLSA failures.
</t>
</section>

<section anchor="iana-considerations" title="IANA Considerations">
<t>There are no IANA considerations at this time.
</t>
</section>

<section anchor="security-considerations" title="Security Considerations">
<t>SMTP TLS Reporting provides transparency into misconfigurations or attempts to
intercept or tamper with mail between hosts who support STARTTLS. There are
several security risks presented by the existence of this reporting channel:
</t>
<t>
<list style="symbols">
<t>Flooding of the Aggregate report URI (rua) endpoint: An attacker could
flood the endpoint and prevent the receiving domain from accepting
additional reports. This type of Denial-of-Service attack would limit
visibility into STARTTLS failures, leaving the receiving domain blind to an
ongoing attack.</t>
<t>Untrusted content: An attacker could inject malicious code into the
report, opening a vulnerability in the receiving domain. Implementers are
advised to take precautions against evaluating the contents of the report.</t>
<t>Report snooping: An attacker could create a bogus TLSRPT record to receive
statistics about a domain the attacker does not own. Since an attacker able
to poison DNS is already able to receive counts of SMTP connections (and,
absent DANE or MTA-STS policies, actual SMTP message payloads) today, this
does not present a significant new vulnerability.</t>
</list>
</t>
</section>

<section anchor="appendix-1-json-report-schema" title="Appendix 1: JSON Report Schema">
<t>The JSON schema is derived from the HPKP JSON schema <xref target="RFC7469"/> (cf. Section 3)
</t>

<figure align="center" title="JSON Report Format
"><artwork align="center">
{
  "organization-name": organization-name,
  "date-range": {
    "start-datetime": date-time,
    "end-datetime": date-time
  },
  "contact-info": email-address,
  "report-id": report-id,
  "policy": {
    "policy-type": policy-type,
    "policy-string": policy-string,
    "policy-domain": domain,
    "mx-host": mx-host-pattern
  },
  "report-items": [
    {
      "result-type": result-type,
      "sending-mta-ip": ip-address,
      "receiving-mx-hostname": receiving-mx-hostname,
      "message-count": message-count,
      "additional-information": additional-info-uri
    }
  ]
}
</artwork></figure>
<t>
<list style="symbols">
<t><spanx style="verb">organization-name</spanx>: The name of the organization responsible for the
report. It is provided as a string.</t>
<t><spanx style="verb">date-time</spanx>: The date-time indicates the start- and end-times for the report
range. It is provided as a string formatted according to Section 5.6,
&quot;Internet Date/Time Format&quot;, of <xref target="RFC3339"/>.</t>
<t><spanx style="verb">email-address</spanx>: The contact information for a responsible party of the
report. It is provided as a string formatted according to Section 3.4.1,
&quot;Addr-Spec&quot;, of <xref target="RFC5322"/>.</t>
<t><spanx style="verb">report-id</spanx>: 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.</t>
<t><spanx style="verb">policy-type</spanx>: The type of policy that was applied by the sending domain.
Presently, the only two valid choices are <spanx style="verb">tlsa</spanx> and <spanx style="verb">sts</spanx>. It is provided
as a string.</t>
<t><spanx style="verb">policy-string</spanx>: The string serialization of the policy, whether TLSA record
or STS policy. Any linefeeds from the original policy MUST be replaced with
[SP]. TODO: Help with specifics.</t>
<t><spanx style="verb">domain</spanx>: The Policy Domain upon which the policy was applied. For messages
sent to <spanx style="verb">user@example.com</spanx> this field would contain <spanx style="verb">example.com</spanx>. It is
provided as a string.</t>
<t><spanx style="verb">mx-host-pattern</spanx>: The pattern of MX hostnames from the applied policy. It
is provided as a string, and is interpreted in the same manner as the
&quot;Checking of Wildcard Certificates&quot; rules in Section 6.4.3 of <xref target="RFC6125"/>.</t>
<t><spanx style="verb">result-type</spanx>: A value from the <spanx style="emph">Result Types</spanx> section above.</t>
<t><spanx style="verb">ip-address</spanx>: The IP address of the sending MTA that attempted the STARTTLS
connection. It is provided as a string representation of an IPv4 or IPv6
address in dot-decimal or colon-hexadecimal notation.</t>
<t><spanx style="verb">receiving-mx-hostname</spanx>: The hostname of the receiving MTA MX record with
which the sending MTA attempted to negotiate a STARTTLS connection.</t>
<t><spanx style="verb">message-count</spanx>: The number of (attempted) messages that match the relevant
<spanx style="verb">result-type</spanx> for this section.</t>
<t><spanx style="verb">additional-info-uri</spanx>: An optional URI pointing to additional information
around the relevant <spanx style="verb">result-type</spanx>. For example, this URI might host the
complete certificate chain presented during an attempted STARTTLS session.</t>
</list>
</t>
</section>

<section anchor="appendix-2-example-json-report" title="Appendix 2: Example JSON Report">

<figure align="center" title="Example JSON report for a messages from Company-X to Company-Y, where
100 messages were attempted to Company Y servers with an expired certificate and
200 messages were attempted to Company Y servers that did not successfully
respond to the STARTTLS command.
"><artwork align="center">
{
	"organization-name": "Company-X",
	"date-range": {
		"start-datetime": "2016-04-01T00:00:00Z",
		"end-datetime": "2016-04-01T23:59:59Z"
	},
	"contact-info": "sts-reporting@company-x.com",
	"report-id": "5065427c-23d3-47ca-b6e0-946ea0e8c4be",
	"policy": {
		"policy-type": "sts",
		"policy-string": "TODO: Add me",
		"policy-domain": "company-y.com",
		"mx-host": "*.mail.company-y.com"
	},
	"report-items": [{
		"result-type": "ExpiredCertificate",
		"sending-mta-ip": "98.136.216.25",
		"receiving-mx-hostname": "mx1.mail.company-y.com",
		"message-count": 100
	}, {
		"result-type": "StarttlsNotSupported",
		"sending-mta-ip": "98.22.33.99",
		"receiving-mx-hostname": "mx2.mail.company-y.com",
		"message-count": 200,
		"additional-information": "hxxps://reports.company-x.com/
                  report_info?id=5065427c-23d3#StarttlsNotSupported"
	}]
}
</artwork></figure>
</section>

</middle>
<back>
<references title="Normative References">
<?rfc include="http://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"?>
<?rfc include="http://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.3207.xml"?>
<?rfc include="http://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.3339.xml"?>
<?rfc include="http://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5234.xml"?>
<?rfc include="http://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5322.xml"?>
<?rfc include="http://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6125.xml"?>
<?rfc include="http://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6698.xml"?>
<?rfc include="http://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7435.xml"?>
<?rfc include="http://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7469.xml"?>
<?rfc include="http://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7489.xml"?>
</references>

</back>
</rfc>
