Install and Configure Zimbra Proxy HA: 5 Fixes to Avoid

To install and configure Zimbra proxy HA you need two proxy servers that share one virtual IP (VIP), and keepalived is the usual tool for that. I wrote this post in 2017 for a Zimbra multi-server setup with the proxies in a DMZ, and the configuration I published then no longer loads cleanly on current keepalived. So I rebuilt the failover in a lab and show what works today, what fails, and what the two proxies do when one of them dies.

Install and configure Zimbra proxy HA with keepalived: errors from the 2017 config and the failover test
Real lab output: the 2017 config checked by keepalived 2.3.3, then a failover in about 3 seconds.

Lab setup to install and configure Zimbra proxy HA

I did not install Zimbra for this test, so this is the network layer only of the install and configure Zimbra work. The Zimbra proxy is an nginx-based service (see the Zimbra multi-server installation guide), so I used two Debian 13 containers, proxy01 (10.89.30.11) and proxy02 (10.89.30.12), each running plain nginx 1.26.3 with a page that prints its own name, plus keepalived v2.3.3 and a client container. The VIP is 10.89.30.30. This proves the keepalived part, which is the part that this post is about. For the Zimbra part, see the proxy installation post. The original lab used proxy01 192.168.10.10, proxy02 192.168.20.20 and VIP 192.168.30.30, with mail.huuphan.com as the Zimbra server host name.

Step 1: install keepalived before you install and configure Zimbra proxies

On CentOS the 2017 commands were yum update -y and yum install -y keepalived, then chkconfig keepalived on and service keepalived start. On a systemd distribution use the package manager of your system and systemctl enable --now keepalived. The basics of the tool are in the keepalived IP failover post, and every keyword is described in the keepalived documentation.

Why the 2017 configuration fails today

My 2017 master config used vrrp_unicast_bind, vrrp_unicast_peer, state MASTER with nopreempt, an SMTP alert block and the password MY_SECURE_PASSWORD. Checking it with keepalived -t on version 2.3.3 gives:

(Line 6) Invalid smtp server mbx.huuphan.com 25
(Line 23) Unknown keyword 'vrrp_unicast_bind'
(Line 24) Unknown keyword 'vrrp_unicast_peer'
(Line 30) Truncating auth_pass to 8 characters
SECURITY VIOLATION - scripts are being executed but script_security not enabled.
(VI_1) Warning - nopreempt will not work with initial state MASTER - clearing

Five problems in one file. The unicast keywords are now unicast_src_ip and unicast_peer { ... }. The password is cut to 8 characters, so a long one only gives a false sense of safety. The tracking script needs enable_script_security, and nopreempt only works when the initial state is BACKUP on both nodes. The SMTP server name must resolve, or you remove the alert block. Without these fixes the "no failback" behaviour I described in 2017 does not happen, and the only trace is a warning line in the log.

Step 2: the corrected configuration to install and configure Zimbra HA

Master (proxy01). The backup file differs in four lines: router_id proxy02, priority 100, unicast_src_ip 10.89.30.12 and the peer address 10.89.30.11.

global_defs {
    router_id proxy01
    enable_script_security
    script_user root
}
vrrp_script chk_nginx_service {
    script "/usr/bin/killall -0 nginx"
    interval 2
    fall 2
    rise 2
}
vrrp_instance VI_1 {
    interface eth0
    state BACKUP
    virtual_router_id 51
    priority 101
    advert_int 1
    nopreempt
    unicast_src_ip 10.89.30.11
    unicast_peer {
        10.89.30.12
    }
    virtual_ipaddress {
        10.89.30.30/24 dev eth0 label eth0:vip
    }
    authentication {
        auth_type PASS
        auth_pass Zpx7Ha91
    }
    track_script {
        chk_nginx_service
    }
}

Replace the interface name and the addresses with yours, and note that the password above is a lab value of exactly 8 characters. keepalived -t returned code 0. After both nodes started, proxy01 held 10.89.30.30 as a secondary address and the client got proxy01 from curl http://10.89.30.30/.

Step 3: validate the failover after you install and configure Zimbra

Testing is the part people skip when they install and configure Zimbra proxies. This is step 4 of the old post, now with numbers. I ran killall nginx on proxy01 and asked the VIP once per second from the client:

t+1 s: no-answer
t+2 s: no-answer
t+3 s: proxy02
t+4 s: proxy02

About two seconds without an answer, then proxy02 serves the VIP. The log of proxy01 shows VRRP_Script(chk_nginx_service) failed (exited with status 1), Entering FAULT STATE and removing VIPs, and proxy02 sent gratuitous ARP for the VIP. When I started nginx again on proxy01, the VIP stayed on proxy02 (master set to 10.89.30.12), which is what nopreempt is for. Killing nginx on proxy02 then moved the VIP back to proxy01, and stopping keepalived on proxy01 let proxy02 take over within 4 seconds. The old advice to read /var/log/messages still works when you log to syslog; in my lab keepalived wrote to its own log file.

Mistakes to avoid when you install and configure Zimbra proxy HA

I broke the setup on purpose three ways. A different auth_pass on one node did not give an error: both nodes entered MASTER and both held 10.89.30.30, which is a split brain. A different virtual_router_id produced the same result. Starting keepalived in a container without the NET_ADMIN capability fails with "Netlink: error: Operation not permitted", so check capabilities on virtual machines and containers. Also remember that a VIP check only proves nginx is running; run a real mail login test after any change, and watch the Zimbra proxy ports described in the guide.

Notes for a production rollout

Before you move real mail traffic, write down who owns the VIP, how the DNS name of the mail host maps to it, and what the on-call person must check first. Keep the two configuration files in version control, change only one node at a time, and repeat the nginx kill test after every change. On a Zimbra system the same test should be run against the proxy service itself, not only against a stand-in web server.

FAQ

Can I install and configure Zimbra proxy HA without keepalived? Yes, with a load balancer in front of two proxies, but keepalived is a small and simple choice for two nodes with one VIP.

Do both servers need the same Zimbra configuration when I install and configure Zimbra proxies? Both proxies must point to the same Zimbra mailbox and LDAP servers; the guide linked above describes the proxy setup.

Conclusion

To install and configure Zimbra proxy HA with keepalived today, use unicast_src_ip, set both nodes to BACKUP with different priorities, enable script security and test with a real kill of nginx. The 2017 file from this post would have run without failback, and it is the reason for this update. Tested with keepalived 2.3.3 and nginx 1.26.3 on Debian 13, with nginx standing in for the Zimbra proxy.

Comments

Popular posts from this blog

How to Play Minecraft Bedrock Edition on Linux: A Comprehensive Guide for Tech Professionals

Linux desktop frozen? My 5 go-to tricks to try - before forcing a hard reboot

The Ultimate Guide: How to Set Up DXVK in Wine on Linux for Enhanced Gaming Performance