On 06.05.21 10:37, Vytenis Adm wrote:
We have a postfix server, which forwards all customer's outbound
emails to a "relayhost". Our "relayhost" is somewhat costly, so
our goal is to minimize it's usage. MX is served by separate
Postfix instance.
Our goal is to deliver local emails to our MX directly, bypassing
"relayhost". Several clients are sharing the infrastructure, so
querying DB to see whether the domain is local is tricky: this may
lead to abuse when the domain changes ownership, or emails
delivered locally when MX is remote, as some customers have their
own NS.
"check_recipient_mx_access" option looked promising.
On 2021-05-06 12:42, Matus UHLAR - fantomas wrote:
this applies for incoming mail, not outgoing.
On 06.05.21 14:07, Vytenis Adm wrote:
Outbound (SMTP-AUTH) Postfix instance receives mail from our users, so
it's inbound email from Postfix perspective.
"check_recipient_mx_access" can override relay based on DNS MX record,
but it has issues I mentioned in my original posting. Looked promising
though.
check_recipient_mx_access will allow your server to accept mail for a domain
but has completele no effect on how mail for that domain is to be delivered.
That's what I mean it applies for incoming mail.
Unfortunately, some clients have our MX as a secondary, and
"check_recipient_mx_access" ignores the fact that primary MX is
remote. Also, it ignores the fact that emails contain remote
addresses in CC
Option we're considering is using a DNS response rewriting. If the
MX is not matching as a local one - rewrite it to "relayhost".
This sounds like a dirty hack however.
Maybe there are other options or ideas?
tried looking at transport_maps ?
http://www.postfix.org/postconf.5.html#transport_maps
you should be able to configure where to send mail to different
domains, and
"relayhost" would only be applied for default mail
Yes, we did look into it, and it's not an option. "transport_maps"
looks into a DB, and we can't rely on it. Clients can point MX to
their own servers, and "transport_maps" will route to our MX
regardless of what is set in customer's DNS.
the "DB" can be local file or even inline in postfix configuration.
you can configure domain to go through its MX server, see:
http://www.postfix.org/transport.5.html
--
Matus UHLAR - fantomas, uh...@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
The early bird may get the worm, but the second mouse gets the cheese.