Page 1 of 1

[SOLVED] Zimbra test server - keep messages locally

Posted: Wed Oct 10, 2018 12:17 pm
by ivica.glavocic
Hi all

As part of migration procedure from Exchange to Zimbra, we set up Zimbra test server for domain i.e. company.com
Real Exchange mail server for domain company.com is on other address, MX record is not yet transferred.

I would like to deliver mails sent from test Zimbra locally, in other words, when I send mail from Zimbra test server to domain company.com I want it delivered to test Zimbra server, not public Exchange.

Logical step would be to change lmtp_host_lookup = native in Postfix main.cf, but I can't find main.cf in config directory.
If I change that parameter in /opt/zimbra/common/conf/main.cf it is owerwritten when Zimbra restarts.

So, my question is: how can I force Zimbra messages for it's domain to be delivered locally?
Second question: where are Postifx config files in Zimbra?

Thanks, regards
Ivica

Re: Zimbra test server - keep messages locally

Posted: Wed Oct 10, 2018 2:17 pm
by DualBoot
Hello,

I do not understand, because it is the normal behavior for Zimbra to deliver locally when the domain exists on Zimbra server.

Regards,

Re: Zimbra test server - keep messages locally

Posted: Wed Oct 10, 2018 3:27 pm
by L. Mark Stone
When an email domain is provisioned in Zimbra, Zimbra ignores DNS for delivery and delivers all mail for the domain locally.

So you should have no problem doing this test without having to make any changes to Zimbra.

As you plan your migration, you may want to take a look at the Split Domain wiki article (https://wiki.zimbra.com/wiki/Split_Domain), and see how you can leverage the zimbraMailTransport attribute for each mailbox to control where email is delivered.

Hope that helps,
Mark

Re: Zimbra test server - keep messages locally

Posted: Thu Oct 11, 2018 2:31 pm
by ivica.glavocic
Thanks for the answers, but in my case, Zimbra sends messages to server that has MX record pointing on it, does not deliver them locally for domain company.com. In Zimbra, service host name is mail.company.com

On system level, everything should be set up correctly - hosts file shows local server address for mail.company.com, nsswitch.conf: hosts: files dns myhostname, host.conf: order hosts,bind, ping gets reply from local IP address.

Split domain may be an option when migration starts, but for now, I would like all mails to be delivered locally.

Is it possible?

Re: Zimbra test server - keep messages locally

Posted: Thu Oct 11, 2018 5:10 pm
by L. Mark Stone
ivica.glavocic wrote:Thanks for the answers, but in my case, Zimbra sends messages to server that has MX record pointing on it, does not deliver them locally for domain company.com. In Zimbra, service host name is mail.company.com

On system level, everything should be set up correctly - hosts file shows local server address for mail.company.com, nsswitch.conf: hosts: files dns myhostname, host.conf: order hosts,bind, ping gets reply from local IP address.

Split domain may be an option when migration starts, but for now, I would like all mails to be delivered locally.

Is it possible?
Sure. That's the deafult configuration.

So, let's say your new server is mail.company.com, and mailboxes are user1@company.com, user2@company.com etc.

If you do on the new server "zmprov ga user!@company.com! zimbraMailTransport" you'll get "lmtp:mail.company.com:7025". That means the new server's Postfix is using local mail transport protocol to deliver user1's email to the Zimbra mailbox server mail.company.com, using port 7025.

From a commandline on the new server, if you run "host mail.company.com", you should get the IP address of the new server (this should match the second line of /etc/hosts as well).

Given the above, if user1 on the new server sends an email to user2, that email will be delivered to user2's mailbox on the new server.

Easier to say definitively if you posted your actual /etc/hosts, /etc/resolv.conf, /etc/hostname, and ifconfig from the new server.

Hope that helps,
Mark

Re: Zimbra test server - keep messages locally

Posted: Fri Oct 12, 2018 10:15 am
by ivica.glavocic
L. Mark Stone wrote: Sure. That's the deafult configuration.
So, let's say your new server is mail.company.com, and mailboxes are user1@company.com, user2@company.com etc.
If you do on the new server "zmprov ga user!@company.com!!!!!!!!!!!!!!!!!!!! zimbraMailTransport" you'll get "lmtp:mail.company.com:7025". That means the new server's Postfix is using local mail transport protocol to deliver user1's email to the Zimbra mailbox server mail.company.com, using port 7025.
From a commandline on the new server, if you run "host mail.company.com", you should get the IP address of the new server (this should match the second line of /etc/hosts as well).
Given the above, if user1 on the new server sends an email to user2, that email will be delivered to user2's mailbox on the new server.
Easier to say definitively if you posted your actual /etc/hosts, /etc/resolv.conf, /etc/hostname, and ifconfig from the new server.
Hope that helps,
Mark
My point exactly. One important sidenote - on Linux host command always resolves name using DNS query, it does not rely on local /etc/hostname resolve order, behaviour by design, so it returns IP address of Exchange live server that MX record points to. Like I wrote before - ping reads /etc/hostname and returns local IP, host looks up DNS record returns Exchange IP. Postfix has to be told how to work - by default it checks DNS record, that's why mail goes out on Exchange server. That is the reason why I wanted to reconfigure Zimbra Postfix to force local resolving first, but I have trouble finding information how to do it, since main.cf does not exist on server filesystem.

To cut long story short - I solved problem by changing Postfix parameter lmtp_host_lookup to native

su - zimbra
postconf lmtp_host_lookup ---> lmtp_host_lookup = dns
postconf -e lmtp_host_lookup=native
postconf lmtp_host_lookup ---> lmtp_host_lookup = native

Make change permanent:

su - zimbra
zmprov ms `zmhostname` zimbraMtaLmtpHostLookup native
zmcontrol restart

Mails are now delivered locally.

Thank you all for help. With regards
Ivica

Re: Zimbra test server - keep messages locally

Posted: Fri Oct 12, 2018 3:09 pm
by L. Mark Stone
Glad you got it sorted.

FWIW, I typically recommend deploying dnscache on Zimbra servers for exactly this reason. It enables one to do proof-of-concept testing and then move to production with no changes whatsoever.

I have a blog post about this; in your case you could have used your AD servers with DNS roles as the upstream nameservers.

https://www.missioncriticalemail.com/20 ... ion-guide/

All the best,
Mark