Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mailto notifications "should" be sent with a custom TLS override #7

Open
wietse-postfix opened this issue Jul 17, 2024 · 11 comments
Open

Comments

@wietse-postfix
Copy link
Collaborator

wietse-postfix commented Jul 17, 2024

RFC 8460 has specific requirements for sending TLSRPT notifications via email. The quote below is from https://datatracker.ietf.org/doc/html/rfc8460#section-3

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.

Consequences:

  • If we use the same Postfix MTA to send TLSRPT notifications, then there needs a way to signal that TLS must be optional, and that the SMTP session should not be logged to the TLSRPT library.

Different MTAs my need different solutions for this, and the TLSRPT reporter would need to be configurable to support all of them.

@wietse-postfix wietse-postfix changed the title mailto notifications "should" be sent with a custom DKIM selector mailto notifications "should" be sent with a custom TLS override and custom service type in DKIM TXT record Jul 17, 2024
@wietse-postfix wietse-postfix changed the title mailto notifications "should" be sent with a custom TLS override and custom service type in DKIM TXT record mailto notifications "should" be sent with a custom TLS override and may need custom service type in DKIM TXT record Jul 17, 2024
@wietse-postfix wietse-postfix changed the title mailto notifications "should" be sent with a custom TLS override and may need custom service type in DKIM TXT record mailto notifications "should" be sent with a custom TLS override Jul 19, 2024
@patrickbenkoetter
Copy link
Collaborator

patrickbenkoetter commented Jul 19, 2024 via email

@BLohner
Copy link
Collaborator

BLohner commented Jul 22, 2024

My proposal rearding https://datatracker.ietf.org/doc/html/rfc8460#section-3: "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."
would be to have a separate entry in master.cf to setup tolerance against TLS-related failures.

That way one could also configure that special channel to NOT report errors.
Postfix will need a configuration option to set the TLSRPT-Receiver socket name.
The special channel would not only ignore TLS-related errors and deliver the ail unencrypted if necessary, but should also be configured to use no TLSRPT-Receiver socket by specifyng something like "-o tlsrpt-socket=none" along the other options.

Of course the TLSRPT-Reporter needs to be configured to use that special service to deliver the TLSRPT reports.

@wietse-postfix
Copy link
Collaborator Author

If that 'special service' is a Postfix SMTP client, how would we route the message to that client?

If we use the same Postfix instance for sending TLSRPT notifications, then the routing must be based on a signal in a Postfix queue file. What would the signal look like? If the signal is controlled by the sender, such as a message header, body line, or envelope address, how would we prevent misuse?

@BLohner
Copy link
Collaborator

BLohner commented Jul 22, 2024

Something controlled by the sender within the mail (header, body line, envelope address,...) does not seem the right way because of the misuse you mention.

Can such a signal be set from within Postfix?
I think of passing some options along to the smtp client that could be set in master.cf for our special mail delivery.
My test of setting "smtp_tcp_port" within master.cf for an smtpd on a special port was not successful, it just gave me "unused parameter: smtp_tcp_port=26", but if a similar parameter could be passed along through the Postfix queue file, I think that would work, woiuldn´t it?

That way it would not be under control of an arbitrary sender form the outside but only be under control of the local sender who chooses between the normal mail delivery and the special mail delivery for TLSRPT reports.

But I have no clue if something similar exists already or how hard it would be to implement on the postfix side.

@patrickbenkoetter
Copy link
Collaborator

patrickbenkoetter commented Jul 22, 2024 via email

@wietse-postfix
Copy link
Collaborator Author

wietse-postfix commented Jul 22, 2024

There are many options in the form of sender-specified information.

sender-dependent routing, a special message header, or other "reserved" information requires that such information cannot be specified by a malicious client.

That said, sender-dependent routing is a relatively robust option. In the special Postfix SMTP client we'd set "smtp_tls_security_level = may", and we'd disable smtp_tls_policy_maps and tlsrpt support.

The "reserved" sender address could also signal what domain to sign with DKIM for. We need a way to prevent spoofing of that header.

@patrickbenkoetter
Copy link
Collaborator

There are many options in the form of sender-specified information.

sender-dependent routing, a special message header, or other "reserved" information requires that such information cannot be specified by a malicious client.

It's quite complicated to keep someone from spoofing a message header.

That said, sender-dependent routing is a relatively robust option. In the special Postfix SMTP client we'd set "smtp_tls_security_level = may", and we'd disable smtp_tls_policy_maps and tlsrpt support.

ACK

The "reserved" sender address could also signal what domain to sign with DKIM for. We need a way to prevent spoofing of that header.

If the TLSRPT report message enters the Postfix System via SUBMISSION we could enforce the identity using smtpd_sasl_login_maps and all the relevant filters that are associated with login / envelope sender checks. Also we could use a TLS client certificate and permit only that identity to use the report sending envelope sender address.

I like both approaches, because they give us good control and because I consider them to be fairly secure, but something more simple would probably be better to foster adoption of what we do.

How about a new capability, like XCLIENT or XFORWARD to let a client signal it wants to submit a report? The smtp client could send a token and the token would be the anchor to a) verify the token owner is authorized to use the report envelope sender address and b) trigger the correct routing with all the special options we discussed above?

Not that I am keen to come up with a new capability. The benefit over a message header is that verifying the token takes place before the message is accepted and queued. Once the MTA has accepted the message things become complicated (deleting, logging...) from an operational point of view.

Of course we could also do all this before queue in a MILTER. A policy service? Both require to run an additional service and they kind of fix the problem out of the MTA. I'd prefer a solution that fixes it all within the MTA (batteries included...)

All we need - sender dependent routing, a dedicated service, smtp client transport options - is there. What we miss is a simple way to tie an envelope sender address to a specific identity and not let other identities use this particular envelope sender address. We have SMTP AUTH and TLS client certificates at hand to map an identity to an envelope sender address and existing Postfix filters like reject_sender_login_mismatch to reject identity abuse. Stick with that? Come up with something simpler?

@wietse-postfix
Copy link
Collaborator Author

RFC 8689 defines a message header "TLS-Required: no" that disables TLS policy enforcement on request:

If the ... TLS-Required message header field is used when sending a message, it asserts a request on the part of the message sender to override the default negotiation of TLS, ... by requesting that recipient-side policy mechanisms such as MTA-STS and DNS-Based Authentication of Named Entities (DANE) be ignored when relaying a message for which security is unimportant.

The RFC does not mention TLSRPT but it seems a good fit for TLSRPT summary reports. I'm in the process of adding support for this header.

(In the quote above, the ... are about an ESMTP option to require DANE or STS while sending mail; I'm not implementing that option at this time.)

@BLohner
Copy link
Collaborator

BLohner commented Nov 16, 2024

That´s great news!
I will add that "TLS-Required: No" header to the report emails.

@BLohner
Copy link
Collaborator

BLohner commented Nov 25, 2024

The RFC 8689 header got added with commit 48bc80e.

@wietse-postfix
Copy link
Collaborator Author

I'll finish the code that adds the header. This required some code refactoring that will make adding other headers easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants