Skip to content

Improvements to our bounce emails #649

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

Open
jfly opened this issue Apr 21, 2025 · 6 comments · May be fixed by #679
Open

Improvements to our bounce emails #649

jfly opened this issue Apr 21, 2025 · 6 comments · May be fixed by #679

Comments

@jfly
Copy link
Contributor

jfly commented Apr 21, 2025

We've experienced 2 problems with our bounce emails.

  1. They leak mailing list members's "final" email addresses.
  2. They confuse senders, who think that their email didn't get sent to anyone.

I'm not sure #2 is really solvable. I suspect that postfix's architecture involves enqueuing these forwards as completely isolated tasks that can independently fail and generate bound messages (I'd be happy to be told I'm wrong about this, though). One option would be to turn of bounces entirely, but I beleive that's even worse UX for senders.

Some detail on how emails get leaked

We've put some effort into hiding our mailing list member's email addresses by encrypting them (example).

However, if umbriel.nixos.org (our mailserver) fails to forward an email, we send a bounce back to the sender, and that leaks the bounced email addresses to the original sender. These emails look like this (sensitive and irrelevant information redacted):

<[OUR MAILING LIST MEMBER'S FINAL ADDRESS]> (expanded from <[LIST]@nixos.org>): host
[OUR MAILING LIST MEMBER'S MAILSERVER][OUR MAILING LIST MEMBER'S MAILSERVER IP] said: 550 Unauthenticated mail not allowed
from this range (in reply to RCPT TO command)

Reporting-MTA: dns; umbriel.nixos.org
X-Postfix-Queue-ID: [REDACTED]
X-Postfix-Sender: [REDACTED]
Arrival-Date: [REDACTED]

Final-Recipient: [OUR MAILING LIST MEMBER'S FINAL ADDRESS]
Original-Recipient: rfc822;[LIST]@nixos.org
Action: failed
Status: 5.0.0
Remote-MTA: dns; [OUR MAILING LIST MEMBER'S MAILSERVER]
Diagnostic-Code: smtp; 550 Unauthenticated mail not allowed from this range

What to do?

These bounces must be getting generated and sent by postfix. We should be able to configure postfix to still send a bounce, but with a different template that does not include the mailing list member's final email address. It's important that whatever we do does still include that X-Postfix-Queue-ID so we can debug reports from users.

@jfly
Copy link
Contributor Author

jfly commented Apr 21, 2025

I dug into this a bit, and I'm not seeing a great way to avoid leaking the member's final address. This report seems to be built in C code, not via a template:

I know enough about Postfix to know that it's a very flexible piece of software, though: perhaps it's possible to override some of these values, or apply some sort of filter/processing on the bounce email.

@ryantrinkle
Copy link

IMO if we are trying to keep list members secret, maybe bounces should go to a postmaster or list moderator rather than the sender? It is not really the sender's problem if they're sending to a valid mailing list.

@jfly
Copy link
Contributor Author

jfly commented Apr 21, 2025

That's an excellent point. This is definitely an "us" problem. I also don't know how to configure postgresql postfix that way. Hopefully it's possible! I'll investigate tomorrow if no one points me in the right direction before then.

@mweinelt
Copy link
Member

mweinelt commented May 1, 2025

One idea I proposed on matrix was to look at recipient_bcc_maps instead of virtual_alias_maps.

jfly added a commit to jfly/infra that referenced this issue May 9, 2025
…alias_maps`

This fixes NixOS#649. I've tested this,
and it works: mailing list members get emails, but if we get a bounce
when forwarding to a mailing list member, we do *not* send the bounce to
the original author of the email.

A downside of this change is that we all become a bit more blind to
bounce issues. Previously, the sender would recieve a bounce email, and
then notify us per the instructions in our bounce template. With this
change the bounce would instead end up ignored in logfiles on umbriel.
@jfly
Copy link
Contributor Author

jfly commented May 9, 2025

One idea I proposed on matrix was to look at recipient_bcc_maps instead of virtual_alias_maps.

This sees to work! I still had to have an empty entry in virtual_alias_maps for postfix to not complain. Mail gets forwarded, and bounces do not make it back to the original sender. However, I'm not sure I'm comfortable with the blindness this change introduces. See this draft PR for details: #679

@jfly
Copy link
Contributor Author

jfly commented May 9, 2025

Oooh, https://www.postfix.org/aliases.5.html seems to document @ryantrinkle's suggestion:

In addition, when an alias exists for owner-name, this will override
the envelope sender address, so that delivery diagnostics are directed
to owner-name, instead of the originator of the message (for details,
see owner_request_special, expand_owner_alias and reset_owner_alias).
This is typically used to direct delivery errors to the maintainer of a
mailing list, who is in a better position to deal with mailing list
delivery problems than the originator of the undelivered mail.

But I tried this, and I couldn't get it to work. I wondered if this is possibly related to us using virtual aliases, and then I found this example, which seems to forward virtual addresses to local aliases. I tried that as well and somehow introduced a mail loop.

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

Successfully merging a pull request may close this issue.

3 participants