Conversation
Add optional localDelivery configuration to override MX routing for addresses that exist in WildDuck. This prevents potential delivery issues when using a hybrid mail setup (e.g., Google Workspace + local WildDuck) where the MX points to an external service that forwards unknown addresses back. When enabled, ZoneMTA checks if a recipient exists in WildDuck before performing the MX lookup. If found, it sets routing.mxData to override the MX destination, causing delivery to go directly to the configured internal server instead of using the external MX. Configuration options: - enabled: enable/disable the feature (default: false) - domains: list of domains to check for local recipients - targetHost: internal SMTP server to use instead of MX lookup (default: 127.0.0.1)
Add info-level log message during plugin initialization that summarizes the WildDuck plugin configuration. This helps verify that settings like localDelivery are being loaded correctly without exposing secrets. Logs: hostname, interfaces, localDelivery status + domains, SRS, DKIM, ACME, MX routes count, maxRecipients, and upload settings.
|
Also, this code has been tested as is being used in production on my systems, FWIW |
|
Hello! Thank you for your PR! This seems like a good change! Findings
Looking at the code and at the findings I suppose they really do need fixing. Best regards |
|
Here we hit some of the limits of my understanding; I don't fully understand STS so I'll have to see if AI can help with that. targetPort was intentionally removed from an initial implementation and the documentation updated; my thought was that this is overriding MX and MX doesn't allow overriding port, so it should just use whatever is default. Thoughts? Is this something I need to handle, or just fix the documentation to not mention targetPort? domain matching - agreed, just didn't think about it. should be an easy fix. |
|
I think that targetPort can stay, as mxconnect and zoneMta allow rewriting MX port. This is especially nice to have during local testing where you set up mx at, let's say, port 2525 instead of port 25. Regarding MTA-STS, imo, on first glance, it seems you just have to add SkipSTS setting to the delivery in case of using local delivery. Cheers |
|
I have this mostly figured out, I think, I just keep having things come up before I have time to fully test and button things up. |
Adds optional localDelivery configuration to prevent mail loops when using a hybrid mail setup with external MX services like Google Workspace.
I also added an init log message to make it easier to be sure if the wildduck plugin was loading and if it was picking up the configuration correctly.
Problem: Mail Loops with Catch-All Forwarding
Some organizations (like mine) use Google Workspace as their primary MX but want to host some addresses locally in WildDuck (to save on per-user costs or for internal services). The typical setup:
The Loop:
When ZoneMTA sends to a local address like [email protected]:
This happens because ZoneMTA has no way to know that [email protected] exists locally—it just follows the MX like any other email.
The Solution
The localDelivery feature tells ZoneMTA to check WildDuck before looking up the MX. If the recipient exists locally, it bypasses the external MX entirely and delivers directly to your internal server.
Since this could be a Bad Thing™ if used incorrectly, defaults to off and must be enabled on a per-domain basis.
Configuration Requirements
["modules/@zone-eu/zonemta-wildduck"]
enabled=["receiver", "sender", "main"]
Changes