Migrating from Scalix to Zimbra

So, this week I again got a feeling that Scalix is not coming back from the dead as a company. After waiting for more than a year for new versions – I gave up.

Search for a new solution ended up on choosing Zimbra Opensource Edition.

Considering that I wasn’t able to find any real guide to migration, I decided to lay down my experiences over here for my own use and for whoever might find this useful.

Setup was smooth. We’re running CentOS 5 on our mailserver, so I just picked the RH5 rpms, did

# ./install.sh --platform-override

and it installed without problems.

Granted that we ran Scalix on the same box, I moved all Zimbra’s standard ports to +60000, so that IMAP was running on 60143, POP on 60110, web on 60080, etc.

After installing I went looking for a way to bulk-create my users.
Provided ‘zmprov’ command helped out in that:

zimbra$ zmprov createAccount user@vlfn.nl displayName 'Firstname Lastname' givenName Firstname sn Lastname

To later migrate the mail, I just set all the passwords to a default one for now:

zimbra$ zmprov ma user@vlfn.nl userPassword foobar

Now I wanted Zimbra to actually start receiving mail for the users.
Stop sendmail and SMTP relay of Scalix:

# /etc/init.d/sendmail stop
# omoff -d0 "SMTP Relay"

Move Zimbra SMTP port into place:

zimbra$ zmprov ms groupserve.vlfn.nl zimbraSmtpPort 25

Restart Zimbra. Voila, Zimbra now receives your incoming mail. Whatever Scalix received in the meantime will be migrated in a few.

After that I needed to migrate users’ mail of course.
A few googling minutes and imapsync found itself.

I’ve created all users with standard password for now, to be able to use imapsync. More on restoring original passwords below.

You can access user’s mailbox as sxadmin in Scalix without knowing user password, so that is the functionality that I abused to achieve what I wanted.
Scalix virtually raped IMAP protocol, by adding custom flags that Zimbra doesn’t understand, so I ended up stripping all the ‘X-*’ flags from mails. Final command to migrate user’s mail looked like:

# /usr/bin/imapsync --nofoldersizes --skipsize --allowsizemismatch --regexflag s/\\X-*//g --noauthmd5 --buffersize 8192000 --nosyncacls --subscribe --syncinternaldates --host1 vlfn.nl --user1 mboxadmin:sxadmin:user --password1 sxadminpass --host2 vlfn.nl --port2 60143 --user2 user@vlfn.nl --password2=foobar

Note, that ‘–regexflag s/\\X-*//g’ will also clear your read marks, so if you don’t want that, you’ll have to figure out all the flags that Scalix adds and ignore them separately.

A few more words on the flags:
–nofoldersizes and –skipsize will just make process faster as it won’t calculate the size of the folders and will not use message size comparison (in essence, there’s nothing to compare to in the new installation, so it saves an extra call to the new server)
–buffersize increased to 8M helps zimbra to process stuff faster.
–user1 format of “mboxadmin:sxadmin:user” allows you to access user’s mailbox with sxadmin password

Another handy tweak is increasing Zimbra’s indexing batch size to 20, so that it reruns its mail indexing not after each mail, but after every 20:

zimbra$ zmprov mc vlfn.nl zimbraBatchedIndexingSize 20

did that trick for me.

Note that this is where alternative ports for Zimbra come into place. In essence I’m running 2 servers next to each other on the same machine.

This process took a while. My mailbox is about 12GB in size, with around 80000 mails in it, it took somewhat 3,5 hours to migrate.

After mail has been migrated I needed to restore users’s original passwords.

First step was to extract current user passwords in crypted form from existing scalix installation.

# omsearch -d userlist -t h -e s=*

extracted all the needed information and with a few awk tricks I managed to extract UL-AUTH-ID and UL-PWD out of the “/”-delimited fields.

After that I replaced all the escaped slashes in the passwords and created a command to update passwords for the users:

zimbra$ zmprov ma user@vlfn.nl userPassword '{crypt}$1$izF4C3VL$Mw.xYuDwa21UL4dB5.CO.1'

At this point we’re almost good to go. Now we just need to kill Scalix, move Zimbra IMAP to normal port, configure Apache to proxy Zimbra’s virtual host and go have our evening coffee.

Killing scalix is easy:

# /etc/init.d/scalix stop
# /etc/init.d/scalix-postgres stop
# /etc/init.d/scalix-tomcat stop
# chkconfig --level 345 scalix off
# chkconfig --level 345 scalix-postgres off
# chkconfig --level 345 scalix-tomcat off

Now, let’s move Zimbra services into place:

zimbra$ zmprov ms groupserve.vlfn.nl zimbraImapBindPort 143
zimbra$ zmprov ms groupserve.vlfn.nl zimbraPop3BindPort 110

And restart Zimbra:

# /etc/init.d/zimbra restart

At this point, you can happily inform your users that they can access stuff via IMAP/SMTP.

Now for the webmail. I run Apache, so I didn’t want Zimbra to be the only thing hoggering the HTTP(s) ports. Therefore, as I already mentioned above, I told it to bind itself on a +60000 range.

Create a separate virtualhost in apache config:

   ServerName webmail.vlfn.nl
   ServerAdmin webmailadmin@vlfn.nl
   ProxyPass / https://webmail.vlfn.nl:60080/
   ProxyPassReverse / https://webmail.vlfn.nl:60080/
   ErrorLog logs/zimbra-error.log
   CustomLog logs/zimbra-access.log common

And if you please a /webmail redirect from your normal website:

Redirect /webmail https://webmail.vlfn.nl

Restart apache.

Now go grab that coffee. You surely deserve one.

Author: favoretti

7 thoughts on “Migrating from Scalix to Zimbra

  1. Great post – I’m looking at making a similar move myself, shame that Scalix has been killed off by mismanagement. 🙁

    Did you come up with any solution for migrating contact & calender data between the servers?

  2. To be honest, our calendars weren’t used much so I wasn’t looking into calendar data. But I suppose both support CalDAV, so there should be a way to migrate those as well.

  3. Great post
    We followed your instructions and have migrated some mailboxes but does not maintain read marks
    you can help please

  4. Yeah, sorry, I forgot to mention that. I couldn’t manage that. 🙁

    If you figure it out – let me know please, I’ll update the post.

  5. I believe you are loosing the read/unread flag due to your ‘ –regexflag s/\\X-*//g ‘
    You would want to add more specific regexflags instead of the X-* wildcard..

  6. Yeah, thank you. I figured that out later as well. Problem being, Scalix adds such a metric ton of custom flags, I wonder whether it’s worth the time to sort them out 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.