0

recently our mail server (Zimbra) had a crash and its not recoverable. We decided to move to a mail provider, and i would like to send them all the email addresses we had on our Zimbra server. The accounts are close to 1300, so its not possible for me to remember one by one. We have a backup of the zimbra directory (/opt/zimbra) at hand. Is it possible to get the users from there?

Regards, Nicos

Nicos
  • 101
  • 2

2 Answers2

0

Note: the commands listed below apply to ZCS 7.x Network Edition and may need to change to work with other versions. Specifically, I believe only the Network Edition includes the built-in backup facility, although hopefully one of the other options will be of use.

If the Zimbra LDAP server is still functioning, you should be able to retrieve the address information with something like:

su - zimbra
/opt/zimbra/libexec/zmslapcat /tmp
egrep '^(zimbraMailAlias|zimbraMailDeliveryAddress):' /tmp/ldap.bak

If the LDAP server is unavailable, but you have access to the location Zimbra is configured to backup to (the default is /opt/zimbra/backup), it should have a copy of the LDAP data for each successful backup. Use:

find /opt/zimbra/backup -maxdepth 3 -name ldap -exec ls -ld {}/ldap.bak ';'

to show all copies that are available, and then select the most recent file. Then you can use grep to extract the email addresses from this file as mentioned above.

If both the LDAP server and /opt/zimbra/backup are not available, there might be a copy of ldap.bak in /opt/zimbra/data/ldap. I believe this copy is only updated when the system is patched though.

Note: Depending on exactly how the system crashed, it might be possible to recover the LDAP information using the db_recover tool. If this type of recovery is required, you should open a new question as it is outside the scope of this one, but here are some starting points:

Sources:

mvermaes
  • 671
  • 5
  • 7
0

I was experiment a similar situation an obtain the users from the mysql stored on zimbra. Is possible but is a long work. You can install (on sandbox environment) a zimbra with the same crashed version. So you rename the /opt/zimbra/db folder to /opt/zimbra/db-new and copy the /opt/zimbra/db from the crashed server (or backup) to the same path. That will be provide you access to the old mysql/mariaDB and you can check in the zimbra db the column "comments" to get the user list. having that list, in the sandbox server rename the /opt/zimbra/db to /opt/zimbra/db-orig and /opt/zimbra/db-new to /opt/zimbra/db. Now use that list to create all the users using a bulk process provided by zimbra here

https://wiki.zimbra.com/wiki/Bulk_Provisioning

when you have all the users created (in the db without messages), you must access again to the zimbra db and run a select query to got the the user id and the email account. With that info, rename again the db folder ($path/db to $path/db-new and $path/db-orig to $path/db) and update all the users id with the new id provided by zimbra when create the users using the bulk process.

Now, you have all "mailbox" vinculated correctly with the zimbra ID stored in the new ldap. So you can access at this moment to the old mailboxes.

After that, you decide how to move the info. Exporting by account, enabling imap an connecting from to the new server or whatever.

I told you to that is a long process, but i use that solution and is worked.

PD: do permanently backup to the ldap to prevent future similar issues.