Page 1 of 1

zimbraMailCatchAllCanonicalAddress outbound rewrite?

Posted: Wed Oct 03, 2018 9:45 pm
by Matt Drown
awhile back I asked a question about domain rewrites for outbound when i did 8.6->8.7, and discovered that i had to do per-account modifications for outbound rewrites to work properly. Just yesterday I had to add a different domain to a FOSS/OSE zimbra install and created the looping email setup again, because I followed the documentation I found on the zimbra wiki.

My setup:
postfix MTA on mailhub.company.com. Completely independent, accepts email for "user@company.com". Redirects to user@zimbra.company.com and via postfix transport, sends to zimbra.company.com host. Redirects some other other users to "user@host2.company.com" and via postfix transport, sends to zimbra.company.com.

Zimbra Free-Edition running on zimbra.company.com. With a couple domains, "zimbra.company.com" and "host2.company.com".

I ran the following to generat the loop:

Code: Select all

zmprov md zimbra.company.com zimbraMailCatchAllAddress @host2.company.com zimbraMailCatchAllCanonicalAddress @company.com
mail would loop between my external MTA and the zimbra server.

Previously I solved this for a handful of accounts by modifying each account and manually setting the "zimbraPrefFromAddress" for each one in the zimbra.company.com domain.

I just undid the above code and instead just ran:

Code: Select all

zmprov md zimbra.company.com zimbraMailCatchAllCanonicalAddress @company.com
This appears to have done the right thing, inbound mail is delivered, and outbound mail appears to have the from address rewritten from "user@host2.company.com" to "user@company.com".

My question, what exactly is this command doing/modifying? I can't find documentation on either of these settings to read, and I'm wary of just running random re-write commands and hoping they work. So any help, or pointers to documents would be greatly appreciated.

Re: zimbraMailCatchAllCanonicalAddress outbound rewrite?

Posted: Thu Oct 04, 2018 1:32 pm
by pup_seba
I would not expect to find proper documentation about this...I think there is still no replacement for the previous knowledge base person :/

From running "zmprov desc -a zimbraMailCatchAllCanonicalAddress" it looks that it just rewrites all headers, but if you really need to be sure, I'm thinking the only way is to access the code itself, strating with zmprov which will lead you to .jar files which you'll have to decode and try to find out from there.

You could also try to see if by anychance this command creates the map files for canonicals that used to be necessary...but maybe it does that and more, so best way I think would be to look into the code itself.

Re: zimbraMailCatchAllCanonicalAddress outbound rewrite?

Posted: Thu Oct 04, 2018 4:19 pm
by Matt Drown
Thanks for the help, I didn't know about the "zmprov desc" option, so that's at least a small start :)

In re-testing, what i thought worked, does not. I'm going to go in and modify all the user prefs to fix the from address, but it seems odd that there isn't a way to do this at the domain level. Or at least odd that there isn't some documentation about it :)

Re: zimbraMailCatchAllCanonicalAddress outbound rewrite?

Posted: Thu Oct 04, 2018 5:46 pm
by pup_seba
Have you tried the "domain masquerade" thing? It looks like outdated documentation but maybe it helps? i think you are missing at least one command there to achieve a proper configuration.

https://wiki.zimbra.com/wiki/Managing_Domains

gl mate!

Re: zimbraMailCatchAllCanonicalAddress outbound rewrite?

Posted: Thu Oct 04, 2018 6:35 pm
by Matt Drown
yea, that's the document that i used that resulted in a loop being created. Inbound is working fine, I'm just trying to get outbound. I just discovered that zimbraPrefFromAddress on an account doesn't seem to work for some reason unless the COS associated with the account allows you to modify from the send address.

Maybe I could have done this in reverse and setup the zimbra domain to be the addresses I wanted people to use, and set up aliases for the inbound address routing.

All I want to do is rewrite ALL accounts in a particular zimbra domain outbound from "user@sub.company.com" to "user@company.com". :)

Re: zimbraMailCatchAllCanonicalAddress outbound rewrite?

Posted: Mon Oct 08, 2018 4:01 pm
by Matt Drown
So I just scripted the setting up of each user to have preffromaddress, and set up the class of service for the users to allow sending from any address, otherwise the preffromaddress wouldn't work:

Code: Select all

zmprov mc subdomaindefault zimbraAllowAnyFromAddress TRUE
zmprov ma user@subdomain.company.com zimbraPrefFromAddress user@company.com
Does anyone have a better way to do this?

Re: zimbraMailCatchAllCanonicalAddress outbound rewrite?

Posted: Mon Feb 15, 2021 3:52 pm
by mkocajk
Hi Matt,

My setup is very similar to yours - separate postfix at domain.com that forwards some mailboxes from user@domain.com to user@zimbra.domain.com.
Seems like such setup is often seen in the wild, pity there's no official up-to-date docs on outbound rewrite.

Would you mind sharing other info on how you solved it? How did you set up the COS?

Thanks,

Re: zimbraMailCatchAllCanonicalAddress outbound rewrite?

Posted: Mon Feb 15, 2021 7:23 pm
by Matt Drown
Change the COS to allow the user send email from "any FROM". You can do this from the GUI (home->configure->class of service->preferences->"allow sending email from any address"), or zimbraAllowAnyFromAddress .

Then for each user I create in the subdomain.company.com, I set the zimbraPrefFromAddress to the user@company.com. This needs to be done from the CLI as far as I can tell.

It's not ideal, but it works for now.