Recommended SPF configuration does not play nicely with mailing lists and the current "receiver architecture"
I've configured 3 simple-nixos-mailservers with the default settings recommended on https://nixos-mailserver.readthedocs.io/en/latest/setup-guide.html:
-
sender.example.org: A mailserver I'm sending emails from. It has the recommendedSPFrecord with a-allrule. -
lists.example.org: A mailserver that hosts a mailing list:cool-people@lists.example.org, with one member:me@receiver.example.org. -
receiver.example.org: I expect to see emails show up here.
If I send an email from me@sender.example.org to cool-people@lists.example.org, it'll get forwarded to me@receiver.example.org, but the receiving mailserver will immediately bounce the email due to it failing SPF (because the IP address of lists.example.org isn't allowed by sender.example.org's SPF record).
I know of 2 3 ways to fix this:
- On
receiver.example.org: rework simple-nixos-mailserver's "receiver architecture" to only bounce emails if they fail DMARC, not SPF. I've asked for this feature in: #301 (closed). - On
sender.example.org: Change theSPFrecord to use~allrather than-all. That's whatwiki.nixos.orgcurrently does: https://github.com/NixOS/infra/blob/8edb8de2ce9259224cc17a95094b913ad27069e0/terraform/dns.tf#L315-L318. - On
lists.example.org: Implement Sender Rewriting Scheme (SRS). SRS is a mechanism to rewrite the envelope of mails a MTA forwards so that they don't fail SPF. You can implement this withpostfixusingpostsrsd, see https://github.com/jfly/snow/commit/ec179dccb83291022ba0aba906b931d2de691792.
Edited by Jeremy Fleischman