|
|
Sidai team: notes on Mailman (the mailing-list manager)
NB: don't forget Chris Kolar's GNU Mailman documentation...
NB: there's a Sidai script, from-majordomo, which
incorporates much of what is said here.
To convert a Majordomo list to a Mailman list,
say the wibble list:
- Remove the wibble majordomo aliases from
sendmail-land; and incorporate...
% sudo newaliases
- Create a new wibble mailman list, something like:
% sudo -u mailman bin/newlist --quiet --output=mm-aliases wibble \
sysadmin-mailing-list-keeper@mekb2.sps.mot.com <passwd>
Note: as you do this several times, new sendmail aliases
will pile up in mm-aliases.
- Copy the old archives into their new home; the majordomo
archives should be cat'd together into one big lovely mbox.
E.g., as root, run the following script:
#!/bin/sh -x
set -e
set -u
outf=/user/mailman/archives/private/wibble.mbox/wibble.mbox
[ -f $outf ] || touch $outf
for i in /user/majordom/archives/wibble/wibble.archive.[1-9]??? \
/user/majordom/archives/wibble/wibble.archive.0??? ; do
cat $i >> $outf
echo '' >> $outf
done
chown mailman:mailman $outf
chmod 664 $outf
- Munge the mbox:
% sudo -u mailman bin/arch wibble
- Add the old (majordomo) membership list to the new list;
this invocation seems to do it:
/user/mailman/bin/sync_members \
--welcome-msg=no --notifyadmin=no \
--file /user/majordom/lists/wibble wibble
Add a -n if you want to do a "dry run"...
- Make any needed adjustments to the list's settings.
- Add the mailman aliases (from mmaliases?) for the new list into the sendmail
world; then incorporate: sudo newaliases.
(This is straight from Barry Warsaw, the Mailman guy.)
Renaming a list is currently a pain to do completely
correctly, especially if you want to make sure that the old list
contacts are automatically forwarded to the new list. This ought
to be easier. :(
The biggest problem you have is how to stop mail and web traffic to
your list during the transition, and what to do about any mail
undelivered to the old list after the move. I don't think there
are any foolproof steps, but here's how you can reduce the risk:
- Temporarily disable qrunner. To do this, you need to edit the
user mailman's crontab entry. Execute the following command,
commenting out the qrunner line when you're dropped into your
editor. Then save the file and quit the editor.
% crontab -u mailman -e
- Turn off your mail server. This is mostly harmless since remote
MTAs will just keep retrying until you turn it back on, and it's
not going to be off for very long.
- Next turn off your web server if possible. This of course means
your entire site will be off-line while you make the switch and
this may not be acceptable to you. The next best suggestion is
to set up your permanent redirects now for the list you're
moving. This means that anybody looking for the list under its
old name will be redirected to the new name, but they'll get
errors until you've completed the move.
Let's say the old name is "oldname" and the new name is
"newname". Here are some Apache directives that will do the
trick, though YMMV:
RedirectMatch permanent /mailman/(.*)/oldname(.*) http://www.dom.ain/mailman/$1/newname$2
RedirectMatch permanent /pipermail/oldname(.*) http://www.dom.ain/pipermail/newname$1
Add these to your httpd.conf file and restart Apache.
- Now cd to the directory where you've installed Mailman. Let's
say it's /usr/local/mailman:
% cd /usr/local/mailman
and cd to the `lists' subdirectory:
% cd lists
You should now see the directory `oldname'. Move this to
`newname':
% mv oldname newname
- Now cd to the private archives directory:
% cd ../archives/private
You will need to move the oldname's .mbox directory, and the
.mbox file within that directory. Don't worry about the public
archives; the next few steps will take care of them without
requiring you to fiddle around in the file system:
% mv oldname.mbox newname.mbox
% mv newname.mbox/oldname.mbox newname.mbox/newname.mbox
- You now need to run the `bin/move_list' script to update some of
the internal archiver paths. IMPORTANT: Skip this step if you
are using Mailman 2.1!
% cd ../..
% bin/move_list newname
- You should now regenerate the public archives:
% bin/arch newname
- You'll likely need to change some of your list's configuration
options, especially if you want to accept postings addressed to
the old list on the new list. Visit the admin interface for your
new list:
- Go to the General options
- Change the "real_name" option to reflect the new list's name,
e.g. "Newname"
- Change the subject prefix to reflect the new list's name,
e.g. "[Newname] " (yes, that's a trailing space character).
- Optionally, update other configuration fields like info,
description, or welcome_msg. YMMV.
- Save your changes
- Go to the Privacy options
- Add the old list's address to acceptable_aliases.
E.g. "oldname@dom.ain". This way, (after the /etc/aliases
changes described below) messages posted to the old list will
not be held by the new list for "implicit destination"
approval.
o Save your changes
- Now you want to update your /etc/aliases file to include the
aliases for the new list, and forwards for the old list to the
new list. Note that these instructions are for Sendmail style
alias files, adjust to the specifics of how your MTA is set up.
- Find the lines defining the aliases for your old list's name
- Copy and paste them just below the originals.
- Change all the references of "oldname" to "newname" in the
pasted stanza.
- Now change the targets of the original aliases to forward to
the new aliases. When you're done, you will end up with
/etc/aliases entries like the following (YMMV):
# Forward the oldname list to the newname list
oldname: newname@dom.ain
oldname-request: newname-request@dom.ain
oldname-admin: newname-admin@dom.ain
oldname-owner: newname-owner@dom.ain
newname: "|/usr/local/mailman/mail/wrapper post newname"
newname-admin: "|/usr/local/mailman/mail/wrapper mailowner newname"
newname-request: "|/usr/local/mailman/mail/wrapper mailcmd newname"
newname-owner: newname-admin
- Run newaliases
- Before you restart everything, you want to make one last check.
You're looking for files in the qfiles/ directory that may have
been addressed to the old list but weren't delivered before you
renamed the list. Do something like the following:
% cd /usr/local/mailman/qfiles
% grep oldname *.msg
If you get no hits, skip to the next step, you've got nothing to
worry about.
If you did get hits, then things get complicated. I warn you
that the rest of this step is untested. :(
For each of the .msg files that were destined for the old list,
you need to change the corresponding .db file. Unfortunately
there's no easy way to do this. Anyway...
Save the following Python code in a file called 'hackdb.py':
-------------------------hackdb.py
import sys
import marshal
fp = open(sys.argv[1])
d = marshal.load(fp)
fp.close()
d['listname'] = sys.argv[2]
fp = open(sys.argv[1], 'w')
marshal.dump(d, fp)
fp.close()
-------------------------
And then for each file that matched your grep above, do the
following:
% python hackdb.py reallylonghexfilenamematch1.db newname
- It's now safe to turn your MTA back on.
- Turn your qrunner back on by running
% crontab -u mailman -e
again and this time uncommenting the qrunner line. Save the file
and quit your editor.
- Rejoice, you're done. Send $100,000 in shiny new pennies to the
Mailman cabal as your downpayment toward making this easier for
the next list you have to rename. :)
|