Zimbra: How to make two different domain’s GAL available for each other?

Purpose

Lets assume there are multiple domains in ZCS environment and GAL needs to be configured between two domains “MYZIMBRA.COM” and “EXAMPLE.COM” where users from both domains can search/autocomplete contacts of each other. How can this be configured?

Resolution

With the help of following steps, add a new datasource on existing GAL Sync accounts of both domains to fetch contacts from each other.

1) On Zimbra server, load the default system variables

    source bin/zmshutil; zmsetvars

2) Add a new datasource in galsync@MYZIMBRA.COM account

    zmgsautil addDataSource -a galsync@MYZIMBRA.COM -n AnotherGAL --domain MYZIMBRA.COM -t ldap -f _AnotherGAL -p 1d

3) Modify the datasource to fetch contacts from domain EXAMPLE.COM

    zmprov mds galsync@MYZIMBRA.COM  AnotherGAL zimbraGalSyncLdapBindDn $zimbra_ldap_userdn zimbraGalSyncLdapBindPassword $zimbra_ldap_password zimbraGalSyncLdapFilter '(&(mail=*)(zimbraAccountStatus=active)(!(zimbraHideInGAL=TRUE)))' zimbraGalSyncLdapSearchBase dc=EXAMPLE,dc=COM zimbraGalSyncLdapURL ldap://LDAP-MASTER-SERVER:389

4) Enable newly created datasource

    zmprov mds galsync@MYZIMBRA.COM AnotherGAL zimbraDataSourceEnabled TRUE

5) Force sync newly added datasource

   zmgsautil forceSync -a galsync@MYZIMBRA.COM -n AnotherGAL 

6) Check the count of contacts in _AnotherGAL folder using below command

   zmmailbox -z -m galsync@MYZIMBRA.COM gaf

7) Make sure zimbraGALMode is set to “both” on domain level config

   zmprov md MYZIMBRA.COM zimbraGALMode both  

8) Follow the same steps for the second domain “EXAMPLE.COM”.

9) Test that the users from both domains are able to search/autocomplete contacts from both the domain.