Mail SRS conflict with per-sender-domain rule

Hi,

I just noticed that my smarthost started to refuse emails forwarded form a domain I host to another one (aliases that points to external adresses).

I’m running 1.9.2 so I guess that the fix doesn’t work in my case : 1.9.1 added “skip SRS behind a smarthost”, but this does not seem to apply when the relay is a per-sender-domain rule rather than a global one.

Could you check ?

Thanks !

Thanks for the report, you’re right. The automatic SRS check in 1.9.1 only looks at the default relay route (the one for all outgoing mail), not at relay rules for a specific sender domain. With such a rule, the rewritten sender SRS0=...@yourdomain matches the rule, so forwarded mail goes through the smarthost, and the smarthost refuses it.

I reproduced it and filed a bug: Mail: forwarded mail rejected by a smarthost configured with a sender relay rule · Issue #8322 · NethServer/dev · GitHub

Until a fix is released, you can turn SRS off. Run these commands as root, and replace mail1 with your mail module instance:

runagent -m mail1 python3 -c 'import agent ; agent.set_env("POSTFIX_SRS", "0")'
runagent -m mail1 systemctl --user reload postfix

Forwarded mail will then keep its original sender, as it did before 1.9.

did not work for me

Hi Marko, I’m sorry but I don’t understand: what didn’t work? Please create a new topic in Support category and describe the issue, your environment, and what you want to achieve.

That doesn’t help get the recipient rules to work in the mail relay.

…just to clarify.

Hi @davidep,

I just updated mail to 2.0.0. I still have to agent.set_env("POSTFIX_SRS", "0")' because otherwise the smarthost still sees the sender as the alias target, not the alias itself when it is configured as an external destination.

example : local alias = matt@mydomain.tld --points to–> someemail@gmail.com is refused by the smarthost :

From header sender domain not verified (gmail.com)
On your Sending > Verified Senders page
verify the sender domain or email to be allowed to send.

Is it expected ?

Yes, there are no code changes on relay rules and SRS. They still don’t work together and you need to disable SRS explicitly.