<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
<!-- generated by https://github.com/cabo/kramdown-rfc version 1.7.14 (Ruby 3.1.2) -->
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-robinson-dkim2-bounce-processing-01" category="std" consensus="true" submissionType="IETF" tocInclude="true" sortRefs="true" symRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 3.29.0 -->
  <front>
    <title abbrev="DKIM2 Bounce processing">DKIM2 Procedures for bounce processing</title>
    <seriesInfo name="Internet-Draft" value="draft-robinson-dkim2-bounce-processing-01"/>
    <author initials="A." surname="Robinson" fullname="Allen Robinson">
      <organization>Google Inc.</organization>
      <address>
        <email>arobins@google.com</email>
      </address>
    </author>
    <date year="2025" month="July" day="07"/>
    <keyword>Internet-Draft</keyword>
    <abstract>
      <?line 27?>

<t>This memo provides a description of the procedures for bounce processing that should be performed by any mail system that implements DKIM2, as part of the overall DKIM2 protcol definition.</t>
    </abstract>
  </front>
  <middle>
    <?line 31?>

<section anchor="introduction">
      <name>Introduction</name>
      <t>As part of the DKIM2 protocol, handling for Delivery Status Notifications (DSNs, defined in <xref target="RFC3461"/>) is necessary to ensure that systems receiving these notifications have a mechanism to both authenticate the contents of the DSN, and to determine if the system generating the DSN is authorized to do so for the message being returned.</t>
    </section>
    <section anchor="bounce-processing">
      <name>Bounce processing</name>
      <section anchor="forward-path">
        <name>Forward path</name>
        <t>At a high level, the forward path in DKIM2 involves the addition of a new DKIM2 header field by each system that handles a message. This header field declares that the message was originated by a system that has the right to do so, either because that system is the origin of the message, or because the system received the message from somewhere else and has decided to forward it to another system. In order to support injection-resistant bounce handling, each system must record in the DKIM2 header field's <tt>mf=</tt> tag the <xref target="RFC5321"/> return-path mailbox for the message, along with all other values as required by the DKIM2 protocol.</t>
        <t>The return-path mailbox for an incoming message should be the address included in the <xref target="RFC5321"/> transaction's <tt>MAIL FROM</tt> command. This identity will be related to the last (highest <tt>i=</tt> value) DKIM2 signature in the message, so this address represents an authenticated destination for future bounce notifications related to the message.</t>
      </section>
      <section anchor="return-path">
        <name>Return path</name>
        <section anchor="bounce-origination">
          <name>Bounce origination</name>
          <t>Once a system decides that a bounce notification needs to be generated in response to a message that it previously accepted for delivery, a new message must be formed to notify the sender that the message was not delivered successfully. Per <xref target="RFC3461"/>, the bounce notification message has a top-level MIME part of type <tt>multipart/report</tt>. Among other things, that MIME part must contain a MIME part of type <tt>message/rfc822</tt> that holds either the original message exactly as it was submitted by the sending system or just the header for that message, so that the receiver of the bounce notification can authenticate the signatures associated with the original message before processing the bounce notification.</t>
        </section>
        <section anchor="bounce-propagation">
          <name>Bounce propagation</name>
          <t>A system that acts as an intermediary step for the handling of a message in the forward path may decide to propagate bounce notifications through the return path of the message in response to receiving a bounce notification.</t>
          <t>Same as the initial DSN, the intermediary system's generated bounce notification message must contain a MIME part of type <tt>message/report</tt> with a sub-part of type <tt>message/rfc822</tt> that holds the original message or its header.</t>
          <t>The bounce notification must be sent to the return-path mailbox listed in the previous system's DKIM2 header field.</t>
          <t>An intermediary system must be able to recover at least the originally-submitted header for a forwarded message, for the purposes of generating bounce notifications. These systems may choose to use the DKIM2 modifications they declared as part of the forward path to reconstruct the original message based on the inbound bounce notification, if it is desirable to return the full message and the inbound bounce notification also includes the full message. Forwarding systems that want to return the full message in all cases should retain the content required to do that as it is not guaranteed to be present in a received DSN.</t>
        </section>
        <section anchor="authentication-of-inbound-bounce-notifications">
          <name>Authentication of inbound bounce notifications</name>
          <t>When a system receives a DKIM2 signed bounce notification, and the included original message is also DKIM2 signed, the bounce receiver should verify that the original message was not altered. This means:</t>
          <t>1) The DSN's DKIM2 signature must have a signing domain that is aligned with the recipient of the message that is being returned. The recipient's address is located in the rt= tag of the last (highest i= tag) DKIM2-Signature in the returned message.
1) The last (highest <tt>i=</tt> tag) DKIM2 header field of the returned message must be one that was generated by the system receiving the bounce notification, determined by examining the d= and mf= tags of that signature header field.
1) The signature in that DKIM2 header field must match the contents of the returned message. Verifiers must handle truncated or missing original message bodies gracefully, by using the body hash value included in the signature header field without comparing it to the body contents.</t>
          <t>The exact details of how to perform DKIM2 signature validation are out of scope for this draft.</t>
          <t>In the event that the bounce notification contains unauthenticated content, the bounce receiver may decide to deem the bounce message itself as malicious and not propagate it through the return path declared in that message.</t>
        </section>
        <section anchor="dkim2-signing-of-bounce-notifications">
          <name>DKIM2 signing of bounce notifications</name>
          <t>Bounce notifications should be DKIM2 signed in exactly the same way as a newly-originated message. This signature must use <tt>i=1</tt> since the system generating the notification is the originator of that message, and include an empty mf= tag to align with the SMTP transaction delivering the DSN.</t>
        </section>
      </section>
      <section anchor="example">
        <name>Example</name>
        <t>The following is a very simplified description of the SMTP transactions involved in the forward and return paths for a message. Only the SMTP commands and header fields related to DKIM2 bounce processing are mentioned.</t>
        <t>Message origination from example.com to foo.com:</t>
        <t>```
MAIL FROM: <eref target="mailto:original@example.com">original@example.com</eref>
RCPT TO: <eref target="mailto:dest@foo.com">dest@foo.com</eref>
DATA
DKIM2: i=1; d=example.com; mf=original@example.com; rt=dest@foo.com
From: Sender <eref target="mailto:original@example.com">original@example.com</eref>
To: dest@foo.com</t>
        <t>I hope this email reaches its destination
.
```</t>
        <t>Forwarding of the message from foo.com to bar.com:</t>
        <t>```
MAIL FROM: <eref target="mailto:something@foo.com">something@foo.com</eref>
RCPT TO: <eref target="mailto:dest@bar.com">dest@bar.com</eref>
DATA
DKIM2: i=2; d=foo.com; mf=something@foo.com; rt=newdest@bar.com
DKIM2: i=1; d=example.com; mf=original@example.com; rt=dest@foo.com
From: Sender <eref target="mailto:original@example.com">original@example.com</eref>
To: dest@foo.com</t>
        <t>I hope this email reaches its destination
.
```</t>
        <t>Bounce notification from bar.com to foo.com:</t>
        <t>```
MAIL FROM: &lt;&gt;
RCPT TO: <eref target="mailto:something@foo.com">something@foo.com</eref>
DATA
DKIM2: i=1; d=bar.com; rt=something@foo.com
From: <eref target="mailto:postmaster@bar.com">postmaster@bar.com</eref>
To: <eref target="mailto:something@foo.com">something@foo.com</eref>
Subject: DSN for ...
Content-Type: multipart/report; boundary="divider43541325151"</t>
        <t>--divider43541325151
Content-Type: text/plain</t>
        <t>This message is being returned.</t>
        <t>--divider43541325151
Content-Type: message/delivery-status</t>
        <t>--divider43541325151
Content-Type: message/rfc822
DKIM2: i=2; d=foo.com; mf=something@foo.com; rt=newdest@bar.com
DKIM2: i=1; d=example.com; mf=original@example.com; rt=dest@foo.com
From: Sender <eref target="mailto:original@example.com">original@example.com</eref>
To: dest@foo.com</t>
        <t>I hope this email reaches its destination
--divider43541325151--
.
```</t>
        <t>Propagated bounce notification from foo.com to example.com:</t>
        <t>```
MAIL FROM: &lt;&gt;
RCPT TO: <eref target="mailto:original@example.com">original@example.com</eref>
DATA
DKIM2: i=1; d=foo.com; rt=original@example.com
From: <eref target="mailto:postmaster@foo.com">postmaster@foo.com</eref>
To: <eref target="mailto:original@example.com">original@example.com</eref>
Subject: DSN for ...
From: Sender <eref target="mailto:original@example.com">original@example.com</eref>
To: dest@foo.com
Content-Type: multipart/report; boundary="divider89869878"</t>
        <t>--divider89869878
Content-Type: text/plain</t>
        <t>This message is being returned.</t>
        <t>--divider89869878
Content-Type: message/delivery-status</t>
        <t>--divider43541325151
Content-Type: message/rfc822
DKIM2: i=1; d=example.com; mf=original@example.com; rt=dest@foo.com
From: Sender <eref target="mailto:original@example.com">original@example.com</eref>
To: dest@foo.com</t>
        <t>I hope this email reaches its destination
--divider89869878--
.
```</t>
      </section>
      <section anchor="security-considerations">
        <name>Security considerations</name>
        <t>To be covered in primary DKIM2 document.</t>
      </section>
      <section anchor="iana-considerations">
        <name>IANA considerations</name>
        <t>To be covered in primary DKIM2 document.</t>
      </section>
    </section>
  </middle>
  <back>
    <references anchor="sec-normative-references">
      <name>Normative References</name>
      <reference anchor="RFC3461">
        <front>
          <title>Simple Mail Transfer Protocol (SMTP) Service Extension for Delivery Status Notifications (DSNs)</title>
          <author fullname="K. Moore" initials="K." surname="Moore"/>
          <date month="January" year="2003"/>
          <abstract>
            <t>This memo defines an extension to the Simple Mail Transfer Protocol (SMTP) service, which allows an SMTP client to specify (a) that Delivery Status Notifications (DSNs) should be generated under certain conditions, (b) whether such notifications should return the contents of the message, and (c) additional information, to be returned with a DSN, that allows the sender to identify both the recipient(s) for which the DSN was issued, and the transaction in which the original message was sent. [STANDARDS-TRACK]</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="3461"/>
        <seriesInfo name="DOI" value="10.17487/RFC3461"/>
      </reference>
      <reference anchor="RFC5321">
        <front>
          <title>Simple Mail Transfer Protocol</title>
          <author fullname="J. Klensin" initials="J." surname="Klensin"/>
          <date month="October" year="2008"/>
          <abstract>
            <t>This document is a specification of the basic protocol for Internet electronic mail transport. It consolidates, updates, and clarifies several previous documents, making all or parts of most of them obsolete. It covers the SMTP extension mechanisms and best practices for the contemporary Internet, but does not provide details about particular extensions. Although SMTP was designed as a mail transport and delivery protocol, this specification also contains information that is important to its use as a "mail submission" protocol for "split-UA" (User Agent) mail reading systems and mobile environments. [STANDARDS-TRACK]</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="5321"/>
        <seriesInfo name="DOI" value="10.17487/RFC5321"/>
      </reference>
    </references>
    <?line 183?>

<section anchor="changes-from-earlier-versions">
      <name>Changes from Earlier Versions</name>
      <t>v01:</t>
      <ul spacing="normal">
        <li>
          <t>updated example syntax to match dkim2-headers document</t>
        </li>
      </ul>
      <t>[[This section to be removed by RFC Editor]]</t>
    </section>
  </back>
  <!-- ##markdown-source:
H4sIAAAAAAAAA+VZW3PcthV+56/ARA+JO8u1JdupvY4z3thWR9PK9kia9sH2
VFgSu4uYJBgAXHmb8X/vd3DhbSk17uUhUz8kKxI4OOc737mBaZomVtpCLNir
P5+dn7B3WmUib7Qwb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