Re: Synchro for migration

Andreas Haumer <[email protected]>
Newsgroups gmane.mail.imap.cyrus
Organization xS+S
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi!

Am 16.04.2018 um 09:01 schrieb Albert Shih:
> Le 15/04/2018 à 01:17:00+0200, Michael Menge a écrit Hi,
> 
[...]
> 
>> 
>> Cyrus allows admins to proxy authenticate for users, if the sasl mech support it (PLAIN does suppot it, LOGIN does not) https://www.cyrusimap.org/sasl/sasl/authentication_mechanisms.html
>> 
>> It seems like the following imapsync options allow you to use proxy authentication
>> 
>> --authmech1 --authmech2 --authuser1 --authuser2 --proxyauth1 --proxyauth2
> 
> I'm not sure to understand how proxyauth works. I google it and find lots of doc about...proxy imap.
> 
> Currently I need to authenticate my user against a LDAP(openldap), so I configure saslauthd with ldap and works perfectly.
> 
> So one of my solution is to have a getpwent (local passwd) with real login and fake password. And after the migration switch to ldap auth.
> 

I did several migrations with imapsync in the past and it worked quite well.

Usually I use a simple script like the one I've attached.

As authuser you have to use an account with cyrus admin rights
(listed in /etc/imapd.conf). You have to know their passwords, of course.
My script expects the admin users passwords in plain text in the files
"passfile1.txt" and "passfile2.txt"

The script also expects a list of IMAP accountnames as argument.

You then call the script like this:

./doit.sh accounts


You can use the script as an example, but you have to check the options
and adapt them for your need! Use the "--dry" option first!

HTH

- - andreas

- -- 
Andreas Haumer                     | mailto:[email protected]
*x Software + Systeme              | http://www.xss.co.at/
Karmarschgasse 51/2/20             | Tel: +43-1-6060114-0
A-1100 Vienna, Austria             | Fax: +43-1-6060114-71
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)

iD8DBQFa1FCtxJmyeGcXPhERAiMwAJ4r38w7zUZ4s5rvB6bfk2OxB7AVsQCgmoyv
yZIq1qZGPNAMsgJL3EU4LEM=
=PzbH
-----END PGP SIGNATURE-----

----
Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/
To Unsubscribe:
https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus
doit.sh (application/x-shellscript, 1.3 KB)
#!/bin/sh

OLDHOST="goethe"
OLDPORT="143"
OLDADMIN="cyrusadm"
NEWHOST="schiller"
NEWPORT="143"
NEWADMIN="cyrusadm"

# uncomment this to avoid SSL certificate verification errors
#export PERL_LWP_SSL_VERIFY_HOSTNAME=0

accountlist=$1

if [ -z "$accountlist" ]; then
  echo "Usage: $0 accountfile"
  exit -1
fi

if [ ! -r $accountlist ]; then 
  echo "ERROR: could not open $accountlist" 
  exit -1 
fi

IFS=";"

{ while read user; do

  echo start IMAP transfer from $OLDHOST to $NEWHOST for user $user at `date`

  # Note: add "--dry" first to see if options are correct!
  # remove "--dry" when you are convinced everything is fine!
  ./imapsync \
             --noreleasecheck \
             --buffersize 8192000 \
             --syncinternaldates \
             --syncacls \
             --usecache \
             --exclude '^user.' \
             --delete2 \
             --sep2 . \
             --prefix2 INBOX. \
             --host1 "$OLDHOST" --port1 "$OLDPORT" --authmech1 PLAIN --tls1 \
             --host2 "$NEWHOST" --port2 "$NEWPORT" --authmech2 PLAIN --tls2 \
             --user1 "$user" \
             --authuser1 "$OLDADMIN" \
             --passfile1 passfile1.txt \
             --user2 "$user" \
             --authuser2 "$NEWADMIN" \
             --passfile2 passfile2.txt

  echo finished for user $user at `date`

done ; } < $accountlist
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.