[Uta] SMTP TLS reporting (RFC 8460), policy domains and DANE

Mechiel Lukkien <mechiel@ueber.net> Tue, 14 November 2023 14:39 UTC

Return-Path: <mechiel@ueber.net>
X-Original-To: uta@ietfa.amsl.com
Delivered-To: uta@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 016AFC14CE25 for <uta@ietfa.amsl.com>; Tue, 14 Nov 2023 06:39:32 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -7.106
X-Spam-Level:
X-Spam-Status: No, score=-7.106 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, UNPARSEABLE_RELAY=0.001, URIBL_BLOCKED=0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=neutral reason="invalid (unsupported algorithm ed25519-sha256)" header.d=ueber.net header.b="qOKz2S0R"; dkim=pass (2048-bit key) header.d=ueber.net header.b="upEB49UP"
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id L-WCaz25HPiN for <uta@ietfa.amsl.com>; Tue, 14 Nov 2023 06:39:26 -0800 (PST)
Received: from mail.axillis.nl (mail.axillis.nl [IPv6:2a02:2770:12:0:21a:4aff:fee0:fa47]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 2AEFBC14CE2B for <uta@ietf.org>; Tue, 14 Nov 2023 06:39:25 -0800 (PST)
Received: from mail.axillis.nl by mail.axillis.nl id MiYYbw14EHFIquo3-NhAPg for <uta@ietf.org>; 14 Nov 2023 15:39:21 +0100
DKIM-Signature: v=1; d=ueber.net; s=2023a; i=mechiel@ueber.net; a=ed25519-sha256; t=1699972761; h=From:To:Cc:Bcc:Reply-To:References: In-Reply-To:Subject:Date:Message-Id:Content-Type:From:To:Subject:Date: Message-Id:Content-Type; bh=jhI8LZfzLGPFkIA9X1j0FRQ/nXtIufWWFswG4sJOim8=; b=q OKz2S0RjZZLil0Tudyc1bUvq7DY2oFod+UQX+jBORcrgYhygq5CdBjOvv10IbktescQq+wZ2aYWeX B8bDz/CQ==
DKIM-Signature: v=1; d=ueber.net; s=2023b; i=mechiel@ueber.net; a=rsa-sha256; t=1699972761; h=From:To:Cc:Bcc:Reply-To:References:In-Reply-To:Subject:Date: Message-Id:Content-Type:From:To:Subject:Date:Message-Id:Content-Type; bh=jhI8LZfzLGPFkIA9X1j0FRQ/nXtIufWWFswG4sJOim8=; b=upEB49UPF+Ix1ftbPPThRJ9VsR C4tuYqR6omBVELy7m9ZJlFuYEWezyiCuNI4tfB/FrNd7lhE8oSi10ItCz2PGLkRx7cvOC9EI0KAaR JObYgc+nf6L5S2C2wxVRPGWygqnWzuK3gPRpULysTBzvSHfMslYpWU+N4xr/o9zfArQgq2fWUx3VM 5tcaYGJXh8X4gzenhamvI1pbcIDc+Ry7I3KnnbTZT6D8w+KWqfpIgilcon/bZ8OtGD0RXKpColmgm DGaoTdE4g+3VcNpcwyxTcLQBKLZk4hm/G5wVXumr6YKjr/skIVXZIOPxDPcIhxsLstX+hqhbdf7dm +Cq6zycg==
From: Mechiel Lukkien <mechiel@ueber.net>
To: uta@ietf.org
Message-Id: <f4uAUqwma6dZnvvieVptWA@mail.axillis.nl>
Date: Tue, 14 Nov 2023 15:39:21 +0100
User-Agent: moxwebmail/51e314f65a94f01f5f4e620455b4a2202e578147+modifications
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/uta/F7m4BAnILJB6HmmAPs6rAtvcD-w>
Subject: [Uta] SMTP TLS reporting (RFC 8460), policy domains and DANE
X-BeenThere: uta@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: UTA working group mailing list <uta.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/uta>, <mailto:uta-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/uta/>
List-Post: <mailto:uta@ietf.org>
List-Help: <mailto:uta-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/uta>, <mailto:uta-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 14 Nov 2023 14:39:32 -0000

Hi all,

I'm implementing (outgoing) SMTP TLS reporting (RFC 8460) in my mail server (https://github.com/mjl-/mox) and am getting confused by TLSRPT's use of "domain"/"recipient domain"/"policy domain", especially related to DANE. It seems to me these concepts are getting mixed up.

Since TLSRPT is a companion document to MTA-STS, targeting MTA-STS has probably been its focus. MTA-STS specifies a policy for a recipient domain. But DANE policies are specified per mail hosts (typically MX target), not recipient domains. The terminology section about "policy domain" says:

   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.

Consider delivering a message to "user@recipientdomain.example". The recipient domain is "recipientdomain.example" (with an MTA-STS policy), an MX target could be "mx.recipientdomain.example" (the TLSA base domain with a DANE policy). Given the terminology section, I would think this would find a policy-typ "sts" at policy-domain "recipientdomain.example", and a policy-type "tlsa" at policy-domain "mx.recipientdomain.example". Since the terminology section for Policy Domain (above) says TLSRPT is defined against a policy domain, that means the operator of mx.recipientdomain.example should create a TLSRPT record at _smtp._tls.mx.recipientdomain.example to receive DANE-related TLS reports (along with one at _smtp._tls.recipientdomain.example for sts). That approach seems reasonable to me, but most of the RFC seems written with the idea that only a recipient domain would have a TLSRPT record/policy. And that's also how my initial prototype implemented it, with TLSA results gathered into a report for the recipient domain. When I thought I was done implementing (after struggling with merging the various "sts", "tlsa" and "no-policy-found" results), and reading the RFC again, I found the terminology of "policy domain" (which feels like the correct approach to me) and changed the implementation to match its conceptual explanation. I haven't had a per-mailhost TLSRPT DNS record for long on my mail host, but haven't received a TLS report for it. I've only received 1 TLSRPT with a "tlsa" policy so far (along with the specified "sts" policy), from Microsoft, and it lists my recipient domain as the tlsa "policy-domain" (not the mx target which has the policy), so it seems they have an interpretation similar to what I initially had.

I'm left wondering what the correct and/or intended interpration is for recipient/policy domain, whether mail hosts should have their own TLSRPT policy DNS record, and what the expected "policy-domain" values are in TLS reports.

Below are some references to specific lines in the RFC related to policy/recipient domains. The RFC  is cross-referenced with the implementation, sometimes with todo-annotations. Aside: Is there a way to link to specific lines of an RFC at the datatracker or rfc-editor.org? I haven't found it yet.

Mentioning recipient domains in "Abstract": https://www.xmox.nl/xr/dev/rfc/8460.html#L29

   This document
   describes a reporting mechanism and format by which sending systems
   can share statistics and specific information about potential
   failures with recipient domains.

This says the recipient domain "uses" DANE in "Introduction": https://www.xmox.nl/xr/dev/rfc/8460.html#L193

   Recipient domains may also use the mechanisms defined by MTA-STS
   [RFC8461] or DANE [RFC6698] to publish additional encryption and
   authentication requirements;

SMTP TLSRPT describes itself as sending reports to recipient domains, in "Related Technologies": https://www.xmox.nl/xr/dev/rfc/8460.html#L268

   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.

Domain and policy domain in "Reporting policy", not recipient domain: https://www.xmox.nl/xr/dev/rfc/8460.html#L289

   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 [...]

Talking about recipient domain instead of policy domain in "Reporting policy": https://www.xmox.nl/xr/dev/rfc/8460.html#L378

   If the number of resulting records is not one, senders MUST assume
   the recipient domain does not implement TLSRPT.

The following may be talking about a recipient domain with an MX target equal to the recipient domain (or no MX record at all), in "Reporting schema": https://www.xmox.nl/xr/dev/rfc/8460.html#L462

   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.

The "policy-domain" field should be the domain the policy is defined against. I would say that's the MX target with the TLSA record for DANE. In "JSON Report Schema": https://www.xmox.nl/xr/dev/rfc/8460.html#L704

   o  "domain": The Policy Domain against which the MTA-STS or DANE
      policy is defined.

Some more notes/feedback I wrote down while implementing:

- Implementors need to carefully handle combinations of sts vs no-sts and tlsa vs no-tlsa, and possibly combine those into a no-policy-found result. MTA-STS and DANE aren't mutually exclusive. What about just having policy results "no-sts" and "no-tlsa"? Seems more explicit to me and is easier to implement. There can also be cases where only some MX targets of a recipient domain have a DANE policy.
- Since detecting injected MX targets is one of the goals of MTA-STS, I would expect a specific result type for when an MX target does not match the policy, but it seems missing. I think "certificate-host-mismatch" (https://www.xmox.nl/xr/dev/rfc/8460.html#L541) is about the TLS connection and certificate (a TLS connection will not be made when a MX target doesn't match the policy). Similarly, a result type for "none of the TLSA records match" seem like a relatively likely failure case and could have its own result type.
- I think more fields in the failure details should be optional. SMTP IPs and/or MX hostnames aren't always in play, e.g. when reporting on MTA-STS policy fetch/parse or TLSA lookup failures. While the RFC is called "SMTP TLS reporting", it is also reporting about MTA-STS and DANE policies without TLS involved yet.
- A "TLS-Required: No" header from the Require TLS RFC can cause a verification failure to be ignored. I think it's still useful to report failure details, but the connection would succeed. How this case should be reported could be up for discussion.
- I don't submit TLS reports to HTTPS reporting addresses because I don't see a way the receiver can authenticate and use them. Report messages must have a DKIM signature (I'm sending it with d= exact/strict host name, but accept domains up to the public suffix domain for incoming reports, I think the RFC requires the exact match). But reports submitted over HTTPS seem to be just the JSON (optionally with gzip). Submitting a report _message_ over HTTPS, with DKIM signature, could solve the problem. I think the RFC could be stricter with its use of "report" (the JSON document) vs "report message" (email message with a report as attachment).

Cheers,
Mechiel