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):

  1. the aliases file will point user to user@mbox.phas.ubc.ca for not-yet-moved users.
  2. 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):

  1. the aliases file will point user to user@mbox.phas.ubc.ca for not-yet-moved users.
  2. 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):

  1. Initially perdition will need to point all users to mbox.phas.ubc.ca.
  2. 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.
  1. Redirect all users to mail.phas.ubc.ca initially.
  2. 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.
  1. beta:stop sendmail.
     
  2. puremsg:stop sendmail.
     
  3. mail(mbox): stop sendmail.
     
  4. mail(mbox) & mail(mailx):Disconnect mail and mailx from network
     
  5. Reconfigure IP addresses of the two machines, mail becomes mbox, mailx becomes mail

  6. puremsg:cp /etc/aliases.new /etc/aliases
     
  7. 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.
     
  8. mbox:cp /opt/sysadmin/relayhost/validaliases.pl.new to validaliases.pl.
     
  9. mbox:make sure mbox is listed in /etc/mail/local-host-names.
     
  10. beta: edit /etc/mail/mailertable to point deliveries for [phas,astro,physics].ubc.ca to mbox rather than mail.
     
  11. (Puremsg and beta already have mailertable entries which deliver email to mbox directly without an MX lookup.)

  12. mbox: edit /etc/exports to export to mail instead of mailx.
     
  13. mbox: Reboot. Now mail delivery should be back to normal, i.e. mail is delivered to mbox.
     
  14. mbox: run sendmail -bv tests to check mail delivery.
     
  15. mail: edit /etc/perdition.conf and change outgoing server to 142.103.236.69 (mbox) and binaddr to 142.103.236.13.
     
  16. mail: edit /etc/fstab to mount mbox:/mail on /mail.
     
  17. mail: Reboot. This will start perdition IMAP/POP proxy with all IMAP/POP users directed to mbox (initially).
     
  18. mail: Check mail delivery with sendmail -bv tests Test IMAP/POP connections.
     
  19. beta:double-check that /etc/aliases file has user@mbox aliases.
     
  20. beta:start sendmail.
     
  21. puremsg:double-check that /etc/aliases file has user@mbox aliases.
     
  22. puremsg:start sendmail.
     
  23. beta/mail:sync aliases files.
     

3. Preparation for Moving Users

  1. Prepare email template which will be sent to all users announcing conversion date, containing link to webpage, and advising them to "print this email".
  2. On PHAS Portal LOGIN page, put message announcing changes along with link to webpage below.
  3. Webpage for details of changes mbox -> Maildir.
  4. Webpages for various mail client setups:
  5. Newuser account creation while move of users is ongoing - how to handle?
  6. Check backup and restore of mailboxes.

4. Moving Users

Check which users are not using mail/ as IMAP server directory.

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)
  1. Stop sendmail on mbox and mail so (new) mail delivery is stopped.
  2. Run mb2md script to convert mbox to Maildir.
  3. Run mboxSubscriptions2MaildirSubscriptions to update ~/Maildir/subscriptions files.
  4. create file with userids to move, one per line.
  5. run
    /usr/local/src/mbox2mdir/phasMigrateusers.sh <file with userids to move>
  6. Change /etc/aliases files on puremsg so that mail gets delivered to mail from this point on.
  7. Create aliases on mbox for moved users (that point to mail.phas.ubc.ca).
  8. Run newaliases on puremsg. Now mail should be getting delivered to mail (instead of mbox) for userX.
  9. Modify perdition to redirect IMAP/POP for userX to mail (instead of mbox).
  10. Restart sendmail on mbox.
  11. 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

  1. stop perdition
  2. stop dovecot
  3. 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
  4. start dovecot

2. Use local disk for mail/

  1. stop sendmail
  2. rsync mbox:/mail to mail/ (or rsync mail/ to mailnew/)
  3. unmount mbox:/mail from mail/
  4. move mount of mailnew/ to mail/

3. Check Backups

  1. On backup.phas, edit /opt/bacula/etc/bacula-dir.conf to backup /mail (instead of /mailnew)