Re: Moving from a server without virtual domains to one with virtual domains.

2006-11-17 Thread Mikael Nehlsen
Hi again,

I think I actually did succeed with this, it was some work but I used
some info I found on a website
(http://www.afp548.com/forum/viewtopic.php?forum=26showtopic=9288) and
converted all my databases to skiplist in the process (don't know if it
was really needed).

I thought that I should write how I did it if someone else needs it in
the future. Since I hate those maillist threads where your question is
asked and no one ever answer. Also of course if anyone have anything to
add that I forgot they are welcome.

On the osx host I did dump the mboxlist (ctl_mboxlist -d 
mboxlist.txt), rsync -av --delete /var/spool/imap/user/
newmailserver:/var/spool/imap/domain/example.com/user/, rsync -av
--delete /var/imap/ newmailserver:/var/imap.example.com/ and don't
forget to scp over the mboxlist.txt file as well to a directory close to
you.

so now you should have all the data on the new mailserver. I then wrote
a script that converts the .seen files (which were in flat db format on
the old server and in skiplist format on the new one), adds the domain
(example.com!) to the .sub files and fixes the cyrus.header files
(adding domains at places and changing permissions).

I also did add example.com! before all users in the mboxlist.txt, an
@example.com after the username in the same file and finally changed the
permissions.

after this you just stop cyrus on the new server, delete the following
files:

/var/imap/db/__*
/var/imap/db/log*
/var/imap/db.backup?/*
/var/imap/annotations.db
/var/imap/tls_sessions.db
/var/imap/deliver.db

I don't know if I need to delete all of these but I had a lot of
problems with bdb when I kept some of them (I didn't experiment that
much with what I could have kept)

restart the server and run:

su cyrus -c /usr/cyrus/bin/ctl_mboxlist -u  /tmp/mboxlistnew.txt

Then you of course need to import the users in whatever you use to
authenticate them but thats another problem.

I will post my scripts here but they are very hackish and you use them
on your own risk and stuff. They are split in two since solaris find
does suck.

oldtonewserver.sh:

#!/bin/bash

echo Fixing the userfile
cat mboxlist.txt | awk '{FS=\t; print example.com! $1 \t $2 \t
$3@exam\
ple.com\t $4}' | sed s/lrswipcda/lrswipkxtea/  /tmp/mboxlistnew.txt
cd /var/spool/imap/domain/example.com/user
find . -name cyrus.header -exec /root/sedstuff.sh {} \;
cd /var/imap.example.com/user
for b in `find /var/imap.example.com/user -name *.seen`
do
  echo converting  $b  to skiplist
  mv $b $b.old
  su cyrus -c /usr/cyrus/bin/cvt_cyrusdb $b.old flat $b skiplist
  rm $b.old
done
for b in `find . -name *.sub`
do
  echo fixing subsciption file $b
  mv $b $b.old
  cat $b.old | sed 's/user./example.com!user./'  $b
  rm $b.old
done
rm -rf /var/imap/domain/e/example.com/*
su cyrus -c cp -R /var/imap.example.com/user
/var/imap/domain/e/example.com/
su cyrus -c cp -R /var/imap.example.com/quota
/var/imap/domain/e/example.com/

#commands to run manually after script is done

# svcadm disable imap
# rm /var/imap/db/__* /var/imap/db/log*
# rm /var/imap/db.backup?/*
# rm /var/imap/annotations.db
# rm /var/imap/tls_sessions.db
# rm /var/imap/deliver.db
# svcadm enable imap
# su cyrus -c /usr/cyrus/bin/ctl_mboxlist -u  /tmp/mboxlistnew.txt


sedstuff.sh:

#!/bin/bash
cat $@ | gsed 's/lrswipcda/lrswipkxtea/' | gsed '6
s/\t/@example.com\t/' | gs\
ed '4 s/^/example.com!/'  /tmp/tempfile
cp /tmp/tempfile $@



And the answer to the bonus question is not saslauthd but:

sudo ldapsearch -LLL -H ldap://servername.example.com -b
cn=users,dc=example,dc=com

Since I want to dump the osx server not use the osx server as
authentication source.

/Mikael


Dmitriy Kirhlarov wrote:
 On Wed, Nov 08, 2006 at 10:08:02PM +0100, Mikael Nehlsen wrote:
 
 I have an old MacOS X server with cyrus 2.2.12. Now I want to move it to
 a solaris box with cyrus 2.3.3.
 This should be no problem I believe, but I am trying to move from a
 server without virtual domains to one with virtual domains. I wonder if
 there is any problems with that?

 My idea of the move is like:

 * Rsync the osx server to the solaris server /var/spool/imap/ to
 /var/spool/imap/domain/domain.com/
 
 You can get a problem. Different bdb versions, different OS, different
 versions of cyrus.
 Also, you want to use virtual domains. Is it mean, usernames changed
 from user to [EMAIL PROTECTED]?
 I guess imapsync best solution in your case.
 
 As a bonus question I wonder how I get the users out of ldap on the osx
 but that's for another place I guess  :) .
 
 You can use saslauthd for this.
 
 WBR

begin:vcard
fn:Mikael Nehlsen
n:Nehlsen;Mikael
org:Swedish Institute of Computer Science
adr:Box 1263;;Isafjordsgatan 22;Kista;;16429;Sweden
email;internet:[EMAIL PROTECTED]
title:Systems Administrator
tel;work:+46 (0)8 663 1553
tel;fax:+46 (0)8 751 7230
x-mozilla-html:FALSE
version:2.1
end:vcard


Cyrus Home Page: http://cyrusimap.web.cmu.edu/
Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki
List 

Re: Moving from a server without virtual domains to one with virtual domains.

2006-11-09 Thread Dmitriy Kirhlarov
On Wed, Nov 08, 2006 at 10:08:02PM +0100, Mikael Nehlsen wrote:

 I have an old MacOS X server with cyrus 2.2.12. Now I want to move it to
 a solaris box with cyrus 2.3.3.
 This should be no problem I believe, but I am trying to move from a
 server without virtual domains to one with virtual domains. I wonder if
 there is any problems with that?
 
 My idea of the move is like:
 
 * Rsync the osx server to the solaris server /var/spool/imap/ to
 /var/spool/imap/domain/domain.com/

You can get a problem. Different bdb versions, different OS, different
versions of cyrus.
Also, you want to use virtual domains. Is it mean, usernames changed
from user to [EMAIL PROTECTED]?
I guess imapsync best solution in your case.

 As a bonus question I wonder how I get the users out of ldap on the osx
 but that's for another place I guess  :) .

You can use saslauthd for this.

WBR
-- 
Dmitriy Kirhlarov
OILspace, 26 Leninskaya sloboda, bld. 2, 2nd floor, 115280 Moscow, Russia
P:+7 495 105 7247 ext.208 F:+7 495 105 7246 E:[EMAIL PROTECTED]
OILspace - The resource enriched - www.oilspace.com

Cyrus Home Page: http://cyrusimap.web.cmu.edu/
Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html


Moving from a server without virtual domains to one with virtual domains.

2006-11-08 Thread Mikael Nehlsen
Hi,

I have an old MacOS X server with cyrus 2.2.12. Now I want to move it to
a solaris box with cyrus 2.3.3.
This should be no problem I believe, but I am trying to move from a
server without virtual domains to one with virtual domains. I wonder if
there is any problems with that?

My idea of the move is like:

* Rsync the osx server to the solaris server /var/spool/imap/ to
/var/spool/imap/domain/domain.com/

* Rsync /var/imap to some random dir on the solaris server

* Shut the osx server down for users and rsync it all again

* Do some processing on the mailboxes.db from the osx server (dump
change to the right format and import into the solaris servers
mailboxes.db)

* Fix the .sub files the same way and move into the main /var/imap/ dir
on the solaris host

At this point I don't know what I need to do anymore. what are the .seen
files for? Do I need to fix them in some way?
Do I need to rebuild the indexes? They should be consistent but they
might contain pointers to the old directory structure under
/var/spool/imap or something.

Any other problems I might get?

As a bonus question I wonder how I get the users out of ldap on the osx
but that's for another place I guess  :) .


/Mikael
begin:vcard
fn:Mikael Nehlsen
n:Nehlsen;Mikael
org:Swedish Institute of Computer Science
adr:Box 1263;;Isafjordsgatan 22;Kista;;16429;Sweden
email;internet:[EMAIL PROTECTED]
title:Systems Administrator
tel;work:+46 (0)8 663 1553
tel;fax:+46 (0)8 751 7230
x-mozilla-html:FALSE
version:2.1
end:vcard


Cyrus Home Page: http://cyrusimap.web.cmu.edu/
Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html