Steps to Move Users to New Mailserver (mailx)
General Ideas
Delivery of Remote Mail to Inboxes
Puremsg uses /etc/aliases to deliver mail for user to user@mail.phas.ubc.ca . An entry in /etc/mail/mailertable sends mail destined for mail.phas.ubc.ca directly to mail without an MX lookup.
After we switch servers (mailx --> mail, mail --> mbox):
- the aliases file will point user to user@mbox.phas.ubc.ca for not-yet-moved users.
- the aliases file will point user to user@mail.phas.ubc.ca for moved users.
Delivery of Local Mail to Inboxes
Currently beta (smtp) has an entry in /etc/mail/mailertable that sends mail destined for mail.phas.ubc.ca directly to mail without an MX lookup.
After we switch servers (mailx --> mail, mail --> mbox):
- the aliases file will point user to user@mbox.phas.ubc.ca for not-yet-moved users.
- the aliases file will point user to user@mail.phas.ubc.ca for moved users.
IMAP/POP Mail Delivery
The perdition imap proxy server will be installed on mailx. Initially it will point all users back to mail.phas.ubc.ca.
After we switch servers (mailx --> mail, mail --> mbox):
- Initially perdition will need to point all users to mbox.phas.ubc.ca.
- As users are moved to the new server, perdition will direct them to mail.phas.ubc.ca (localhost).
Detailed Steps
1. Test perdition imap/pop proxy on mailx
To run these perdition tests, best strategy may be to modify local /etc/hosts file and point mail to mailx.
- Redirect all users to mail.phas.ubc.ca initially.
- Test a few users going to localhost.
2. Switch mail and mailx
The reasons for doing this are:
1. We can setup and test perdition on mailx without any disruptions to normal mail delivery.
2. Clients will allways connect to mail.phas.ubc.ca.
3. Easy configuration after the move is finished.
- beta:stop sendmail.
- puremsg:stop sendmail.
- mail(mbox): stop sendmail.
- mail(mbox) & mail(mailx):Disconnect mail and mailx from network
- Reconfigure IP addresses of the two machines, mail becomes mbox, mailx becomes mail
- mail: Change ip addr of mailx to 142.103.236.13/192.168.1.13
- mbox: Change ip addr of (old) mail to 142.103.236.69/192.168.1.69
- puremsg:cp /etc/aliases.new /etc/aliases
- puremsg: edit /usr/local/bin/getaliases to rsync from mbox (192.168.1.69) instead of mail (192.168.1.13) and chg rsync to get aliases.pure instead of aliases.
- mbox:cp /opt/sysadmin/relayhost/validaliases.pl.new to validaliases.pl.
- mbox:make sure mbox is listed in /etc/mail/local-host-names.
- beta: edit /etc/mail/mailertable to point deliveries for [phas,astro,physics].ubc.ca to mbox rather than mail.
(Puremsg and beta already have mailertable entries which deliver email to mbox directly without an MX lookup.)
- mbox: edit /etc/exports to export to mail instead of mailx.
- mbox: Reboot. Now mail delivery should be back to normal, i.e. mail is delivered to mbox.
- mbox: run sendmail -bv tests to check mail delivery.
- mail: edit /etc/perdition.conf and change outgoing server to 142.103.236.69 (mbox) and binaddr to 142.103.236.13.
- mail: edit /etc/fstab to mount mbox:/mail on /mail.
- mail: Reboot. This will start perdition IMAP/POP proxy with all IMAP/POP users directed to mbox (initially).
- mail: Check mail delivery with sendmail -bv tests Test IMAP/POP connections.
- beta:double-check that /etc/aliases file has user@mbox aliases.
- beta:start sendmail.
- puremsg:double-check that /etc/aliases file has user@mbox aliases.
- puremsg:start sendmail.
- beta/mail:sync aliases files.
3. Preparation for Moving Users
- Prepare email template which will be sent to all users announcing conversion date,
containing link to webpage, and advising them to "print this email".
- On PHAS Portal LOGIN page, put message announcing changes along with link to webpage below.
- Webpage for details of changes mbox -> Maildir.
- Webpages for various mail client setups:
- Thunderbird
- Webmail
- Alpine - hyper, linux
- PC-Alpine
- Mac Mail
- Outlook / Outlook Express
- Newuser account creation while move of users is ongoing - how to handle?
- Check backup and restore of mailboxes.
- Do index files need to be rebuilt?
- How do we know which file(s) to restore?
4. Moving Users
Check which users are not using mail/ as IMAP server directory.
- Is this possible to check?
- How to handle - move mail folders under ~/ to ~/mail/ so automatic conversion happens?
Check what happens with mail delivery on new server if home dirs not available.
Put the following steps into a script (/usr/local/src/mbox2maildir/phas_migrateUsers.sh on mail)
- Stop sendmail on mbox and mail so (new) mail delivery is stopped.
- Run mb2md script to convert mbox to Maildir.
- Run mboxSubscriptions2MaildirSubscriptions to update ~/Maildir/subscriptions files.
- create file with userids to move, one per line.
- run
/usr/local/src/mbox2mdir/phasMigrateusers.sh <file with userids to move>
- Change /etc/aliases files on puremsg so that mail gets delivered to mail from this point on.
- Create aliases on mbox for moved users (that point to mail.phas.ubc.ca).
- Run newaliases on puremsg. Now mail should be getting delivered to mail (instead of mbox) for userX.
- Modify perdition to redirect IMAP/POP for userX to mail (instead of mbox).
- Restart sendmail on mbox.
- Restart sendmail on mail.
on warp, change /opt/sysadmin/passwd/createid.pl to create Maildir/ instead of mail/ for new users.
5. slist
Lists based on slist are aliases in /etc/aliases. We need to wait until all users are migrated
before moving the lists.
Need to rsync /mail/slist just before moving to the new server.
6. mailman
Lists based on mailman are aliases in /etc/aliases. We need to wait until all users are
migrated before moving them to the new mail server (mail). The web interface has already been set up.
Need to rsync /mail/mailman just before moving to the new server.
notes on Maildir in mbox:/mail/mailman/Mailman/Defaults.py
-----------------------------------------------------------------------------------
# Set this to Yes to use the `Maildir' delivery option. If you change this
# you will need to re-run bin/genaliases for MTAs that don't use list
# auto-detection.
#
# WARNING: If you want to use Maildir delivery, you /must/ start Mailman's
# qrunner as root, or you will get permission problems.
#
# NOTE: Maildir delivery is experimental for Mailman 2.1.
USE_MAILDIR = No
# NOTE: If you set USE_MAILDIR = Yes, add the following line to your mm_cfg.py
# file (uncommented of course!)
# QRUNNERS.append(('MaildirRunner', 1))
6. Final Steps After All Users Are Migrated
1. Decommission perdition on mail
- stop perdition
- stop dovecot
- edit /etc/dovecot.conf, change:
#listen = *:143
#ssl_listen = *:993
listen = 127.0.0.1:143
ssl_listen = 127.0.0.1:993
#listen = *:110
#ssl_listen = *:995
listen = 127.0.0.1:110
ssl_listen = 127.0.0.1:995
To:
listen = *:143
ssl_listen = *:993
#listen = 127.0.0.1:143
#ssl_listen = 127.0.0.1:993
listen = *:110
ssl_listen = *:995
#listen = 127.0.0.1:110
#ssl_listen = 127.0.0.1:995
- start dovecot
2. Use local disk for mail/
- stop sendmail
- rsync mbox:/mail to mail/ (or rsync mail/ to mailnew/)
- unmount mbox:/mail from mail/
- move mount of mailnew/ to mail/
3. Check Backups
- On backup.phas, edit /opt/bacula/etc/bacula-dir.conf to backup /mail
(instead of /mailnew)