a new hostname

Gavin McCullagh gavin.mccullagh at gcd.ie
Mon Jul 25 14:52:40 CEST 2011


Hi,

On Mon, 25 Jul 2011, Thorsten Schnebeck wrote:

> our company name will change in some weeks. The new domain is already 
> registered and to add/change web services is a no-brainer.

Do you want to completely cease using the old one, or add the new one as
well as the old one?  I presume the former.

Supposing your domains are olddom.com and newdom.com, you will probably
want to do something like this in /kolab/etc/kolab/templates/virtual.template

@olddom.com @newdom.com

which will cause mail for the old addresses to redirect to the new
addresses.

> But... what is the best strategy for kolab? As it has a strong reference to 
> the system hostname I think about setting up a clean server with a new 
> hostname and restore a backup with search&replace of the hostname in the 
> config-files. The imap userdata should need no change when restoring. How to 
> handle the old mail addresses? Is there something like modrewrite for postfix?

It's not clear to me that the system hostname is relevant.  We have a
server called xxxxx.our.domain which is running mail for addresses
@our.domain and several other unconnected domains.

Assuming you want to move over to the new domain completely and only have
the old domain for backward compatibility, a fair bit needs to be done.
Having done a related migration some time back, I'll have a stab at a list
of things you need.  

WARNING: This is not a complete or tested recipe, just a starting point off
the top of my head for what will need to be changed.  I'm sure others will
have things to add:

0. Set up a test server and clone your working system on it for testing
   this routine.  Then you can do all of this over and over until you iron
   out the little bugs.  Also, back up the real system before you touch it.

1. Take kolab down entirely for the duration.

2. Dump your existing ldap database using slapcat, search and replace the
   new domain for loading up as replacement.  Something like:
	sed -e 's/dc=olddom,dc=com/dc=newdom,dc=com/g' -e 's/olddom.com/newdom.com/g' slapcat.ldif > newldap.ldif

3. Again assuming your domains are as above, you need to move your spool,
   sieve directories and imap lib directories to the right locations, eg
   something like:
	mkdir /kolab/var/imapd/spool/domain/n/  
	mkdir /kolab/var/imapd/sieve/domain/n/
	mkdir /kolab/var/imapd/domain/n/
	mv /kolab/var/imapd/spool/domain/o/olddom.com /kolab/var/imapd/spool/domain/n/newdom.com
	mv /kolab/var/imapd/sieve/domain/o/olddom.com /kolab/var/imapd/sieve/domain/n/newdom.com
	mv /kolab/var/imapd/domain/o/olddom.com /kolab/var/imapd/domain/n/newdom.com

4. You'll need to alter every cyrus.header file in every subfolder on the
   spool, something like:
	for i in `find /kolab/var/imapd/spool/domain/n/newdom.com -name cyrus.header `
	do
		sed -i -e 's/^olddom.com!/newdom.com!/' -e 's/@olddom.com/@newdom.com/' $i
	done

5. You'll need to dump, alter and reload the full cyrus mailboxes.db:
	sudo -u kolab-r	ctl_mboxlist -x -d  > mboxlist.txt
	sed -i -e 's/^olddom.com!/newdom.com!/' -e 's/@olddom.com/@newdom.com/' mboxlist.txt
	sudo -u kolab-r	ctl_mboxlist -u  < mboxlist.txt

6. Fix up every folder subscription list for every user
	for i in `find /kolab/var/imapd/domain/g/gcd.ie/user/n -name '*.sub'`
	do
		sed -i -e 's/^olddom.com!/newdom.com!/' $i
	done

Other than that, if you're using webmail, you might need to consider
search and replace on the user's stored horde preferences, which are here:

	/kolab/var/kolab/www/client/storage/

though this is likely to be a little complex.  You could also look at
altering people's calendars and/or contacts if you really wanted to be very
helpful.

The above suggestions likely aren't perfect.  For example, suppose someone
has a folder called "olddom.com", an ACL entry on that might get renamed,
so you may need to be a little more careful than I've been.  This might be
a starting point though to see what needs changing.

Gavin





More information about the users mailing list