Migration Zimbra to Zarafa

From Zarafa wiki

Revision as of 12:25, 3 October 2012 by Admin (Talk | contribs)
Jump to: navigation, search

To migrate a Zimbra environment to Zarafa different migration methods should be used.

Email migration

For migration of all the email data, the opensource tool imapsync can be used. Imapsync is included in most Linux distributions.

Imapsync will synchronise all messages and folders between Zimbra and Zarafa. As the imap protocol is used for this, it's important that the IMAP feature is enabled for users on Zarafa.

To enable IMAP for all users, change the following option in the server.cfg.

disabled_features = 

To start the imapsync migration for a user, use the following command:

 imapsync --buffersize 8192000 --nosyncacls --useheader 'Message-Id' --subscribe --host1 <zimbra host> --user1 <username> --password1 pw_zimbra --ssl1 \ 
 --host2 <zarafa host> --user2 <username> --password2 pw_zarafa --syncinternaldates --nofoldersizes --skipsize --fast

In order to do a mass migration of users, the following script can be used:



#host1 is Source

#host2 is Dest

###### Do not modify past here

date=`date +%X_-_%x`

echo "" >> $logfile
echo "------------------------------------" >> $logfile
echo "IMAPSync started.. $date" >> $logfile
echo "" >> $logfile

{ while IFS=';' read u1 p1 u2 p2; do
  echo "Syncing User $user"
  date=`date +%X_-_%x`
  echo "Start Syncing User $user1"
  echo "Starting $user1 $date" >> $logfile
  imapsync --buffersize 8192000 --nosyncacls --useheader 'Message-Id' --subscribe --syncinternaldates --nofoldersizes --skipsize --fast \
    --host1 $host1 --user1 "$user1" --password1 "$p1" --host2 $host2 --user2 "$user2" --password2 "$p2" --sep2 / --prefix2 ""
  date=`date +%X_-_%x`
  echo "User $user done"
  echo "Finished $user1 $date" >> $logfile
  echo "" >> $logfile

done ; } < userlist.txt

date=`date +%X_-_%x`

echo "" >> $logfile
echo "IMAPSync Finished.. $date" >> $logfile
echo "------------------------------------" >> $logfile

The script will read out all user information from the file userlist.txt. The userlist.txt should contain the user names and passwords in the following format:


The import batch script can be executed multiple times and will only synchronise changed and new emails.

Migrating calendar

Calendars can be migrated by exporting them to the ics format and import them via the Zarafa-ical gateway to Zarafa.

To export the calendar for the Zimbra users, use:

/opt/zimbra/bin/zmmailbox -z -m <zimbra_username> getRestUrl "//Calendar?fmt=ics" > /tmp/<zimbra_username>.ics

To import the ics file into Zarafa, use:

curl -u [username]:[password] -T /tmp/<zimbra_username>.ics http://[zarafa-ical-server]:8080/ical/[username]

If the calendar does not exist yet, the last example will not work when using a zarafa-admin user. This needs to be done as the user itself. There is a workaround however if you need to do some massive scripting on this and you don't know the users' passwords.

You will need to run the zarafa-ical service and zarafa-server on the same host and the zarafa-ical service needs to run as root. Change the server_socket in /etc/zarafa/ical.cfg to:

server_socket = file:///var/run/zarafa

After this change restart the zarafa-ical service.

You can now import calendars (both to default calendars and to calendars that need to be newly created) as the user. But now the zarafa-ical service will accept any password as the users' password as long as it is not empty:

curl -u [username]:[any password] -T [path to ics file] http://[zarafa-ical-server]:8080/ical/[username]/[calendar name]

Important: Revert the server_socket back to it's original setting before going into production, as setting the server to a unix socket creates a security leak. So edit the file /etc/zarafa/ical.cfg and change server_socket back to:

server_socket = http://localhost:236/zarafa

Migrating Addressbook

To migrate personal addressbooks of Zimbra users, the addressbook is exported to a csv file. The csv file can be created by following command:

/opt/zimbra/bin/zmmailbox -z -m <zimbra_username> getRestUrl "//Contacts?csvfmt=outlook-2003-csv" > <zimbra_username>.csv

It's very important to generate the csv file in outlook 2003 format, otherwise the mapping between csv records and Zarafa contact records are mismatched.

To import the csv file to Zarafa, use the File:Zimbracsv2contacts.zip import script.

php zimbracsv2contacts.php <username> <zimbra_username>.csv
Personal tools