Skip to content

Zimbra

The Zimbra connector reads a server as a global administrator. Accounts, aliases, distribution lists, domains and mail settings come from the admin SOAP service. Mail comes over IMAP, with the administrator signing in on behalf of each user; for accounts that are not active or have IMAP turned off, it comes over the mailbox service with the administrator’s sign-in instead. Calendars and contacts come over CalDAV and CardDAV through a delegated sign-in for each user, and Briefcase files over the mailbox service. Password hashes and DKIM keys, which the admin service does not return, come through host access.

Vandelay writes nothing on the source, apart from the sign-in record that Zimbra keeps on an account for each delegated sign-in (zimbraAuthTokens).

Zimbra runs on servers the operator controls, so both cutover strategies apply. A one-shot migration moves each domain at its MX change and needs nothing on the source. A zero-downtime migration puts the Stalwart proxy in front of Zimbra’s client ports, as described in Proxy mode settings. Detection recognises Zimbra from its IMAP greeting, at medium confidence.

Mail is copied with the folder tree, over IMAP for active accounts and over the mailbox service (folder list, message search and each message’s original form) for the others, which leaves the account’s last sign-in unchanged. Folders that another account shared and this account mounted are left out; they are copied with their owner’s account.

Mail settings come from the account’s attributes and become Sieve scripts, mail rules and the vacation response on Stalwart:

  • The mail filters (zimbraMailSieveScript), converted rule by rule. A rule that Stalwart cannot express is reported, and the rest of the script is carried.
  • Forwarding, including forwarding that an administrator set for the user (zimbraMailForwardingAddress), which becomes a user mail rule named “Zimbra admin forwarding” that the user can see on Stalwart.
  • The out-of-office reply.

Calendars and contacts are copied over CalDAV and CardDAV when they are selected; a calendar or address book that another account shared and this account mounted is copied only with its owner. Briefcase files are copied over the mailbox service: every Briefcase folder becomes a folder, and every document its current version. A document changed on the source after it was first copied is not copied again, older versions are not carried, and a file larger than 256 MiB is not copied, so each run reports it as failed.

From the admin service and the host:

  • Every account with a mailbox, with its aliases, quota and, through host access, its password hash. A hash is carried when Stalwart supports its scheme, as described in Password hashes.
  • Domains, alias domains and the catch-all address of each local domain.
  • Distribution lists with their members. A dynamic group becomes a list of its current members, which no longer follows the group’s rule.
  • The DKIM keys, through host access, carried when “DKIM keys” imports them, which only a server-scope project does.
  1. Choose a global administrator account (zimbraIsAdminAccount TRUE). A delegated administrator lacks the rights that discovery needs.

  2. Make the three services reachable from the Vandelay host: the admin SOAP service on port 7071, the mailbox service (port 443 by default) and IMAP on port 993. Zimbra refuses mail requests on port 7071, which is why the mailbox service is a separate endpoint.

  3. Give Vandelay host access to the Zimbra server as the zimbra user, over SSH (for example [email protected]) or on the server itself. Vandelay runs read-only zmprov -l queries there, getAllAccounts per domain for the password hashes and getDomain for the DKIM selector and key. Without host access, accounts get temporary passwords and the DKIM keys are not carried.

  4. When the server’s certificate is self-signed, read its fingerprint for the certificate pin. The pin applies to the admin URL’s host and covers every port of it, so on a single-host Zimbra the admin service, the mailbox service and IMAP must all present the pinned certificate. A mailbox service or an IMAP service on another host is not covered by the pin, and needs a verifiable certificate.

The same steps are printed by vandelay migrate guide zimbra and shown on the Source: access step of the web UI and the TUI.

Zimbra does not use Dovecot, so the trust settings of Proxy mode settings do not apply to its IMAP and POP3 services. Vandelay configures nothing on the source. For mail relayed from Stalwart, Zimbra’s own settings serve the same purpose:

  • Accepting mail relayed from Stalwart. Zimbra’s MTA is Postfix, configured through Zimbra’s own attributes. zimbraMtaMyNetworks sets Postfix’s mynetworks, and Zimbra also writes it into SpamAssassin’s trusted_networks and Amavis’s @mynetworks, so Stalwart’s address is appended there with zmprov, followed by a restart of the MTA. Postscreen permits mynetworks by default. When greylisting through Zimbra’s policy daemon is enabled, it runs before permit_mynetworks, so it needs an exemption of its own.

Vandelay reads the admin service, the mailbox service and IMAP directly, never through the proxy.

The admin service is “Admin URL” (source.url, --admin-url), https://<zimbra host>:7071/. Mail requests go to the mailbox service at the same host without the port (port 443); “Mail SOAP URL” (source.mail, --mail-url, Advanced) names another one, as an HTTPS URL. With a pinned certificate, the mailbox service at the admin host must present the same certificate; otherwise “Mail SOAP URL” names the mailbox service, which then needs a verifiable certificate.

“IMAP URL” (source.imap, --imap-url) is imaps://<zimbra host>, the IMAP service of the mailbox server. There is no ManageSieve URL, because the filters come from the account attributes.

The administrator is “Administrator” (source.admin, --admin), the full address of the global administrator, such as [email protected]. Its password is “Master, admin or service account password” (--master-password), a secret reference, stored as the password key under [source] in plan.toml. Vandelay signs in to IMAP as the administrator on behalf of each user, with a SASL authorisation identity, as described in Master user; there is no separate master user.

The admin URL, the IMAP URL, the mailbox service URL and the host access identify the source, so they are bound when work starts and cannot change afterwards, as described in Bound settings. The administrator, its password and the certificate pin stay editable.

The following excerpt reads a single-host Zimbra with host access over SSH:

[source]
system = "zimbra"
url = "https://zimbra.example.org:7071/"
password = "env:ZIMBRA_ADMIN_PASSWORD"
imap = "imaps://zimbra.example.org"
cleartext = "forbid"
[source.host]
kind = "ssh"
destination = "[email protected]"

The following command sets the same source:

Terminal window
vandelay migrate source \
--system=zimbra \
--admin-url=https://zimbra.example.org:7071/ \
--imap-url=imaps://zimbra.example.org \
--master-password=env:ZIMBRA_ADMIN_PASSWORD \
--host-access=ssh \

An account’s status (zimbraAccountStatus) and its IMAP access (zimbraImapEnabled, zimbraPrefImapEnabled) decide whether Vandelay reads its mail over IMAP or over the mailbox service, and mail read the two ways cannot share the account’s archive. Leave these attributes as they are until the account’s migration is complete. When a change moves an account’s mail from one way to the other after its first copy, the account fails with an error that names both sources, such as archive already records <source> source (<url>, account <address>); <source> and <source> imports of one account cannot share an archive, so it would be imported twice; use a fresh archive. Putting the setting back and running again resolves it. Before the switch, Re-run from scratch copies the account’s mail again the new way instead; from the switch on, only putting the setting back helps.

Pre-flight lists the following as losses:

  • Personas and signatures, for every account: Zimbra personas (identities) and signatures are not migrated; if this account has any, recreate them on Stalwart.
  • Outgoing mail filters (zimbraMailOutgoingSieveScript), because Stalwart has no outgoing filters, and the administrator filter scripts that run before or after an account’s own.
  • Out-of-office details: the separate reply for external senders (zimbraPrefOutOfOfficeExternalReply), the setting that suppresses the reply to external senders, and the reply interval. Stalwart sends one reply to everyone. A reply with an unreadable date is migrated turned off.
  • Filter rules that Stalwart cannot express, one loss per rule; the rest of the script is carried.
  • Invalid directory entries. An alias, list member, domain or catch-all that is not valid, and a domain that forwards all of its mail elsewhere (zimbraMailCatchAllForwardingAddress).
  • Accounts without a known mailbox, listed without an id or homed on a server that Zimbra does not list as a mailbox server; their mail, calendars and contacts are not read.
  • Password hashes and DKIM keys without host access, and the hash of an account that the account list names more than once.
  • Local delivery turned off. When Zimbra kept no local copy of incoming mail (zimbraPrefMailLocalDeliveryDisabled), the loss explains how the migrated forwarding rules and filters behave on Stalwart.

Zimbra refused the admin sign-in (<code>: <reason>); check the admin account name and password, and that it is an active global administrator means a wrong name or password, or an inactive account. the admin account lacks the right (<reason>); discovery needs a global administrator (zimbraIsAdminAccount TRUE), not a delegated one means that the account is a delegated administrator.

the DKIM key of <domain> could not be read on the host (<reason>); to go on without it, set this domain's DKIM to generate or skip means that /opt/zimbra/bin/zmprov -l getDomain did not run for the host access user, which is usually zimbra. Fix host access, or set the domain to generate or skip in “DKIM keys”.

When Zimbra grants a delegated sign-in a shorter lifetime than Vandelay asks for (zimbraAuthTokenLifetime), the run log warns, and the calendars and contacts reached after the sign-in has run out fail for that run. They are read again on the next run.