The document describes a way how mailboxes can be migrated from MS Exchange to a cyrus IMAP server using imapsync without the need to know the users passwords.
- a cyrus IMAP server and a admin account
- the admin accounts for cyrus are defined in the parameter admins: of the configuration file /etc/imapd.conf . In this examples, the admin user name is cyrus with password cpass.
- Microsoft Exchange 2003
- others Exchange versions might work, too. 2003 was the version this howto was written with.
- postmaster account for MS Exchange
- the Exchange account for migration needs to have the rights to access all mailboxes on the Exchange server. In the examples the user name is migration with password mpass. The user can be created following these steps:
- create a new DWORD in HKEY_Current_User\Software\ Microsoft\Exchange\ExAdmin with the name ShowSecurityPage and set this to 1.
- open the Active Directory User and Computer console and create a new user with the name migration, password mpass and Exchange attributes.
- reopen the Exchange System Manger and give that new user full access to the entire mail organization (right click on the most upper entry naming your organization -> properties -> security -> add)
Testing the admin users
Those example IMAP logins descibe a telnet session where a succesfull IMAP connections gets created and closed (cyrus is running on localhost and the Exchange server on 10.20.30.170)
Test if the cyrus admin can access the server
# telnet localhost imap Trying 127.0.0.1... Connected to localhost (127.0.0.1). Escape character is '^]'. * OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS AUTH=LOGIN AUTH=PLAIN SASL-IR] servera Cyrus IMAP4 v2.3.7-Invoca-RPM-OX-2.3.7-3.OX server ready . login cyrus cpass . OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID LOGINDISABLED ACL RIGHTS=kxte QUOTA MAILBOX-REFERRALS NAMESPACE UIDPLUS NO_ATOMIC_RENAME UNSELECT CHILDREN MULTIAPPEND BINARY SORT SORT=MODSEQ THREAD=ORDEREDSUBJECT THREAD=REFERENCES ANNOTATEMORE CATENATE CONDSTORE IDLE LISTEXT LIST-SUBSCRIBED X-NETSCAPE URLAUTH] User logged in . logout * BYE LOGOUT received . OK Completed Connection closed by foreign host. #
Test if the migration user can login to its own mailbox
# telnet 10.20.30.170 imap Trying 10.20.30.170... Connected to mastercane.open-xchange.com (10.20.30.170). Escape character is '^]'. * OK Der Microsoft Exchange Server 2003 IMAP4rev1-Server, Version 6.5.6944.0 (win2003.perf.open-xchange.local), steht zur Verf�gung. . login migration mpass . OK LOGIN completed. . logout * BYE Der Microsoft Exchange Server 2003 IMAP4rev1-Server, Version 6.5.6944.0, meldet sich ab. . OK LOGOUT completed. Connection closed by foreign host. #
Test if the migration user can login for user test in domain
# telnet 10.20.30.170 imap Trying 10.20.30.170... Connected to mastercane.open-xchange.com (10.20.30.170). Escape character is '^]'. * OK Der Microsoft Exchange Server 2003 IMAP4rev1-Server, Version 6.5.6944.0 (win2003.perf.open-xchange.local), steht zur Verf�gung. . login domain/migration/test mpass . OK LOGIN completed. . logout * BYE Der Microsoft Exchange Server 2003 IMAP4rev1-Server, Version 6.5.6944.0, meldet sich ab. . OK LOGOUT completed. Connection closed by foreign host. #
Migrating a single user
Access to the Exchange mailbox is done via <domain>/migration/<user to migrate> and the password of the migration account. In cyrus the Data is stored as user with the credentials of the admin account. The imapsync command is as follows:
imapsync --host1 <ms exchange> --user1 <domain>/migration/<user to migrtate1> --password1 \ mpass --host2 <cyrus server> --user2 <user to migrate2> --authuser2 cyrus \ --password2 cpass --authmech2 PLAIN --prefix1 "INBOX." --regextrans2 \ 's/INBOX.INBOX/INBOX/' --noauthmd5 --subscribe \ --exclude "&ANY-ffentliche Ordner|Aufgaben|Journal|Kalender|Kontakte|Notizen" --dry
|<ms exchange>||hostname or ip of the Exchange server|
|<domain>||Active directory domain name|
|<user to migrtate1>||Exchange user to be migrated|
|<cyrus server>||hostname or ip of the cyrus imap server|
|user to migrate2||target user name in the cyrus imap server|
|--exclude||a list of system folders not to migrate|
The above command does actually do a try run without migrating any data. This is because of the --try option. It is needed to see what special folders are available that do not need to be migrated. This are the folders calendar,contacts,tasks,notices and shared folder. They are different in various languages. It is also save to check if the standard folders are the same on both sides (if not, that can be tuned with --regextrans2 and a regular expression that fixes that).
Removing the --try option will make the user really migrated.
The sync then can run multiple times so for example a big job can run to migrate majority of the data and and once again just before the go live for later changes.