Anyone with experience using imapsync

Farzad FARID ffarid at pragmatic-source.com
Tue Aug 22 06:26:04 EDT 2006


Hi,

Rob Tanner wrote:
> Hi,
>
> I'm trying to migrate mail from one IMAP server to another using the
> perl program imapsync.  Both the source and destination servers are
> Cyrus IMAP4 v2.2.3 servers.  I have added a second partition to the
> destination server and made it the default by configuring imapd.conf
> as follows:
>
[...]
>
> With this setup, I can use cyradm and by hand correctly adds users to
> the new partition.  When I use imapsync to copy users over.  Instead
> of folders such as user.xyz and user.xyx.sent and user.xyz.drafts, I
> get userxyz and userxyzsent and userxyzdrafts -- all as separate and
> entirely independent folders and not even a hierarchy.
>
> Here's a script I used just to test and move over one user:
>
>
> #! /bin/bash
>
> ./imapsync \
>        --host1 belgarath.linfield.edu --user1 cyrus --passfile1
> /home/rtanner/imapsync/cyrus.pwd \
>        --host2 polgara.linfield.edu --user2 cyrus --passfile2
> /home/rtanner/imapsync/cyrus.pwd \
>        --syncinternaldates \
>        --subscribe \
>        --include "^user\.aabryan.*$"
>
I had the same issue because the users existed in LDAP, but had no
mailboxes yet on the new server (i.e. I had not executed "cm user.xyz"
with cyradm). If you run imapsync with --debug and --debugimap, you
should see that imapsync finds no prefix or separator for polgara.

But in your case I think your error is that you connect as user "cyrus"
and, as such, all maiboxes created on polgara will have wrong ACLs! The
fact that imapsync does not find the prefix and the separator by itself
is a side effect, AFAIK.

First of all, you can add "--prefix2 INBOX. --sep2 ." to you command
line, it works for me.

Then, you should authenticate as "cyrus" but use each real user's login
for authentication. This is a bit harder to configure, because the only
mechanisms that support proxy-authentication are PLAIN and CRAM-MD5.
imapsync only supports PLAIN but Cyrus forces you to use SSL with plain ;)

Thereforce, after activating ssl in Cyrus, you should be able to use
imapsync the following way:

./imapsync \
       --host1 belgarath.linfield.edu --authuser1 cyrus --passfile1
/home/rtanner/imapsync/cyrus.pwd --user1 aabryan \
       --host2 polgara.linfield.edu --authuser2 cyrus --passfile2
/home/rtanner/imapsync/cyrus.pwd --user2 aabryan \
       --syncinternaldates \
       --subscribe \
       --prefix2 INBOX. --sep2 . --ssl1 --ssl2 \
       --authmech1 PLAIN --authmech2 PLAIN

Even better, put a list of all your users in a file, one by line, and run:

for user  in $(< /tmp/list_of_users.txt); do
        ./imapsync ...... --user1 $user .... --user2 $user ......
done

If you run imapsync like thiis, you don't need to create the mailboxes
on the destination server, imapsync will do it for you.

Regards

-- 
Farzad FARID <ffarid at pragmatic-source.com>
Architecte Open Source / Pragmatic Source
http://www.pragmatic-source.com/



More information about the Info-cyrus mailing list