Working with Majordomo

 < Free Open Study > 



Majordomo is a popular but dated Unix MLM. Unless you've already got Major-domo running under another MTA and you don't want to convert the lists to ezmlm, you probably shouldn't use it. It works well with qmail, provided a few simple changes are made. Russ Allbery has written a FAQ about using Majordomo with qmail (http://www.eyrie.org/~eagle/faqs/mjqmail.html).

Allbery's FAQ describes several different ways to install Majordomo under qmail, ranging from the simple to complex. Let's follow one of the more complex methods because it results in a system that's more secure and easier to manage. Majordomo under Sendmail requires the use of a setuid() wrapper. The qmail installation in this chapter doesn't use a wrapper.

Majordomo's features include:

  • Moderated and unmoderated lists.

  • List management is done by e-mail, which means no login is required for list owners.

  • Archiving and remote retrieval of messages.

  • Digests.

  • Modular design so you use only the features you need.

  • Written in Perl, which means it's easily customizable and expandable.

  • Confirmation of subscriptions to protect against forged subscription requests.

  • List filters, based on header or body regular expressions.

Installing Majordomo

Majordomo requires qmail, of course, and the Perl language. Perl is included with most operating systems, but it's also available from the Web (http://www.cpan.org). To install Majordomo, follow these steps:

  1. Download the Majordomo tarball using your Web browser or a command-line utility. At the time of this writing, the current version of Majordomo is 1.94.5. For example, using the wget utility:

     $ wget http://www.greatcircle.com/majordomo/1.94.5/majordomo-1.94.5.tar.gz --07:33:42--  http://www.greatcircle.com/majordomo/1.94.5/majordomo-1.94.5.tar.gz             => `majordomo-1.94.5.tar.gz' Connecting to www.greatcircle.com:80. . . connected! HTTP request sent, awaiting response. . . 200 OK Length: 312,244 [application/x-tar]     0K -> .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..[ 16%]    50K -> .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..[ 32%]   100K -> .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..[ 49%]   150K -> .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..[ 65%]   200K -> .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..[ 81%]   250K -> .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..[ 98%]   300K -> .. ..[100%] 07:36:28 (2.02 KB/s) - `majordomo-1.94.5.tar.gz' saved [312244/312244] $ 

  2. Choose a user ID and group ID for Majordomo and create them, if necessary. You'll use user majordomo and group majordomo, so you'll have to create both. User majordomo's home directory will be the directory into which Majordomo will be installed, /usr/local/majordomo, not the Majordomo build directory, /usr/local/src/majordomo-1.94.5. For example, using the Red Hat groupadd and useradd utilities:

     $ su - Password: rootpassword # groupadd majordomo # useradd -g majordomo -d /usr/local/majordomo majordomo # 

If you're using qmail-users-the file /var/qmail/users/assign exists-and it handles all user accounts, you'll need to run qmail-pw2u and qmail-newu:

 # /var/qmail/bin/qmail-pw2u < /etc/passwd > /var/qmail/users/assign # /var/qmail/bin/qmail-newu # 

  1. Unpack the source tarball:

     # tar xf majordomo-1.94.5.tar.gz # chown -R majordomo majordomo-1.94.5 # su majordomo $ cd majordomo-1.94.5 $ 

  2. Edit Makefile. Adjust the settings for the location of Perl, the C compiler, the Majordomo directory, and the UID and GID of the majordomo user and group. Ignore the wrapper settings. For example:

     PERL = /usr/bin/perl W_HOME = /usr/local/majordomo W_USER = 514 W_GROUP = 515 

  3. Install and edit majordomo.cf. If you're already using Majordomo under another MTA, use its majordomo.cf as a starting point. Otherwise, use sample.cf. You'll want to make sure that $whereami, $whoami, $whoami_owner, $homedir, $listdir, and $cookie_seed are set appro-priately.

    Caution 

    The $cookie_seed setting must be changed from the default to prevent trivial forging of confirmation cookies. Anyone who knows your $cookie_seed can subscribe or unsubscribe third parties without their consent. Just set it to some string of ten or more random characters.

  4. Install a small patch to make Majordomo default to list owner addresses of the form listname-owner, rather than owner-listname. Because the patch was written for Majordomo 1.94, one of the "hunks" will fail-this is normal. For example:

     $ wget ftp://ftp.eyrie.org/pub/software/majordomo/owner.patch --09:43:15--  ftp://ftp.eyrie.org/pub/software/majordomo/owner.patch             => `owner.patch' Connecting to ftp.eyrie.org:21. . . connected! Logging in as anonymous . . . Logged in! ==> TYPE I . . . done. ==> CWD pub/software/majordomo . . . done. ==> PORT . . . done.   ==> RETR owner.patch . . . done. Length: 3,630 (unauthoritative)     0K -> . . .                                                                        [100%] 09:43:20 (3.89 KB/s) - `owner.patch' saved [3630] $ patch < owner.patch patching file config_parse.pl Hunk #1 succeeded at 101 with fuzz 1. Hunk #2 FAILED at 281. 1 out of 2 hunks FAILED - saving rejects to file config_parse.pl.rej patching file majordomo Hunk #1 succeeded at 1815 (offset -55 lines). patching file majordomo.pl patching file resend Hunk #1 succeeded at 107 (offset -1 lines). $ 

  5. Because you're not using Majordomo's wrapper, the MAJORDOMO_CF environment variable that tells the Majordomo programs where to find majordomo.cf won't be set when they're run, so they'll look for it in the fallback location, /etc/majordomo.cf. Edit the Majordomo programs, which are Perl scripts, setting the fallback location to the Majordomo directory. This can be done using perl:

     $ find . -type f | xargs perl -p -i -e \ > 's|"/etc/majordomo.cf"|"/usr/local/majordomo/majordomo.cf"|go;' $ 

  6. Install Majordomo:

     $ make install cc -DBIN=\"/usr/local/majordomo\" -DPATH=\" PATH=/bin:/usr/bin:/usr/ucb\" -DHOME=\" HOME=/usr/local/majordomo\" -DSHELL=\" SHELL=/bin/sh\" - DMAJORDOMO_CF=\" MAJORDOMO_CF=/usr/local/majordomo/majordomo.cf\" - DPOSIX_UID=514 -DPOSIX_GID=515 -o wrapper wrapper.c Testing for perl (/usr/bin/perl). . . Configuring scripts. . . ./install.sh -m 751 -O 514 -g 515 . /usr/local/majordomo ./install.sh -m 755 -O 514 -g 515 . /usr/local/majordomo/bin Copying tools to /usr/local/majordomo/bin Copying Majordomo files to /usr/local/majordomo Copying archiving and other tools to /usr/local/majordomo/Tools ./install.sh -m 755 -O 514 -g 515 . /usr/local/majordomo/Tools Using majordomo.cf Installing manual pages in /usr/local/majordomo/man To finish the installation, 'su' to root and type:             make install-wrapper If not installing the wrapper, type              cd /usr/local/majordomo; ./wrapper config (no 'su' necessary) to verify the installation. $ 

  7. Set up majordomo's .qmail file to invoke the majordomo program. Put the following in /usr/local/majordomo/.qmail:

     ./incoming |./majordomo 

The first line logs a copy of each message sent to majordomo, which is handy for debugging subscription/unsubscription problems. The second line, of course, passes the message to majordomo for processing.

  1. Create the lists directory:

     $ mkdir $HOME/lists $ 

  2. Send a test message to majordomo to verify that Majordomo is working. As some user other than majordomo, do this:

     $ echo to: majordomo |/var/qmail/bin/qmail-inject $ 

If $whereami in majordomo.cf isn't the same as control/defaultdomain, add the domain to the majordomo address in the To field. For example:

 $ echo to: majordomo@lists.example.com |/var/qmail/bin/qmail-inject $ 

You should receive a response that starts with this:

 Return-Path: <Majordomo-Owner@example.com> Delivered-To: suzanne@example.com Received: (qmail 8610 invoked by uid 514); 5 Aug 2001 14:42:08 -0000 Date: 5 Aug 2001 14:42:08 -0000 Message-ID: <20010805144208.8609.qmail@example.com> To: suzanne@example.com From: Majordomo@example.com Subject: Majordomo results Reply-To: Majordomo@example.com -- **** No valid commands found. **** Commands must be in message BODY, not in HEADER. **** Help for Majordomo@example.com: This help message is being sent to you from the Majordomo mailing list management system at Majordomo@example.com. 

If you don't get a message like this, you'll have to troubleshoot and fix the problem before moving on to the next step.

  1. Download the mjinject script, which invokes qmail-queue to send messages to lists and uses VERP for reliable bounce handling. For example, using wget:

     $ cd /usr/local/src/majordomo-1.94.5 $ wget ftp://ftp.eyrie.org/pub/software/majordomo/mjinject --14:05:09--  ftp://ftp.eyrie.org/pub/software/majordomo/mjinject             => `mjinject' Connecting to ftp.eyrie.org:21. . . connected! Logging in as anonymous . . . Logged in! ==> TYPE I . . . done. ==> CWD pub/software/majordomo . . . done. ==> PORT . . . done. ==> RETR mjinject . . . done. Length: 11,270 (unauthoritative)     0K -> . . .. . .. . .. . [100%] 14:05:17 (5.67 KB/s) - `mjinject' saved [11270] $ 

  2. Edit mjinject and set $hostname to the same value as $whereami in majordomo.cf.

  3. Install mjinject:

     $ su root Password: rootpassword # cp mjinject /usr/local/bin # chmod 755 /usr/local/bin/mjinject # 

  4. Configure Majordomo to use mjinject. In majordomo.cf, change $mailer to this:

     $mailer = "/usr/local/bin/mjinject $listdir/$opt_l \$sender"; 

Majordomo is now installed and ready for lists.

Creating Lists with Majordomo

Creating lists consists of two phases: creating the list files under majordomo's list directory and configuring qmail to accept mail addressed to the list addresses and deliver it to the right place.

For example, say the example.com mail administrator wants to create a list called hopheads. He would do this:

  1. Create an empty file called hopheads in ~majordomo/lists, where ~major- domo is majordomo's home directory. As user majordomo:

     $ touch ~/lists/hopheads $ 

  2. As another user, send majordomo a message containing the command config hopheads:

     $ (echo to: majordomo; echo; echo "config hopheads") |/var/qmail/bin/qmail-inject $ 

You should receive a response that starts with this:

 From: Majordomo@example.com Subject: Majordomo results Reply-To: Majordomo@example.com -- >>>> config hopheads **** config: needs password **** config: invalid password. **** Help for Majordomo@example.com: 

This is normal. The lists directory should now contain a file named hopheads.config.

  1. Edit the list configuration file, lists/hopheads.config. Be sure to set the admin_password, approve_password, description, and other options as desired. Change sender from owner-hopheads to hopheads-owner, and make sure that strip is set to yes.

  2. The next step is to configure qmail to direct the list's mail to the right place. Allbery's FAQ shows a simple way to do this when you have a domain name dedicated to mailing lists, such as lists.example.com. You're going to use the more general approach that relies on the qmail-users mechanism described in Chapter 3, "Configuring qmail: The Basics."

Here again, there are multiple options. You can either use qmail-users for all users, using qmail-pw2u to convert /etc/passwd to qmail-users format, or you can use it only for addresses configured in /var/qmail/users/assign. You'll set it up for all users because it's simpler and allows qmail to look up users faster. If you want to do it the other way, just put the necessary entries in assign and run qmail-newu.

Add a line to /var/qmail/users/subusers for the list, creating the file if it doesn't already exist, then run qmail-pw2u and qmail-newu:

 # echo hopheads:majordomo:hopheads: > /var/qmail/users/subusers # qmail-pw2u < /etc/passwd > /var/qmail/users/assign # qmail-newu # 

  1. Set up the .qmail-hopheads files in ~majordomo. There will be six files for each list, as described in Table 9-1.

    Table 9-1: .qmail Files for Majordomo Lists

    FILENAME

    PURPOSE

    CONTENTS

    .qmail-list

    Sends to subscribers

    |/usr/local/majordomo/resend -l list list-owner

    .qmail-list-approval

    Approves requests

    list-owner or address of alternates

    .qmail-list-default

    Catchall

    list-owner

    .qmail-list-owner

    Goes to list owner

    List owner's address, for example: &dave

    .qmail-list-owner-default

    Receives bounces

    list-owner or a bounce handling utility

    .qmail-list-request

    Lists commands

    |/usr/local/majordomo/majordomo -l list

For example, if the hopheads list is owned by the local user dave, you could populate the .qmail files like this:

 $ cd $HOME $ echo "|/usr/local/majordomo/resend -l hopheads hopheads-owner" > \ > .qmail-hopheads $ echo "&hopheads-owner" > .qmail-hopheads-approval $ echo "&hopheads-owner" > .qmail-hopheads-default $ echo "&dave" > .qmail-hopheads-owner $ echo "&hopheads-owner" > .qmail-hopheads-owner-default $ echo "|/usr/local/majordomo/majordomo -l hopheads" > .qmail-hopheads-request $ echo ./incoming-hopheads >> .qmail-hopheads-request $ 

The last line keeps a log of Majordomo commands sent to hopheads-request. You might want to make a script to automate the creation of new lists.

Subscribing to Majordomo Lists

Users interact with Majordomo via e-mail to majordomo@domain or listname-request@domain. Continuing with the hopheads example, let's subscribe a user to the list:

  1. As some user other than majordomo, mail a "subscribe hopheads" command to majordomo:

     $ (echo to: majordomo; echo; echo "subscribe hopheads") | \ > /var/qmail/bin/qmail-inject $ 

You should receive a confirmation request from Majordomo that starts like this:

 Someone (possibly you) has requested that your email address be added to or deleted from the mailing list "hopheads@example.com". If you really want this action to be taken, please send the following commands (exactly as shown) back to "Majordomo@example.com":          auth 777b50fa subscribe hopheads dave@example.com 

  1. Send a confirmation back to Majordomo:

     $ (echo to: majordomo; echo; \ > echo "auth 777b50fa subscribe hopheads dave@example.com") | \ > /var/qmail/bin/qmail-inject $ 

You should receive yet another response from Majordomo welcoming you to the list:

 Welcome to the hopheads mailing list! Please save this message for future reference. Thank you. If you ever want to remove yourself from this mailing list, you can send mail to <Majordomo@example.com> with the following command in the body of your email message:     unsubscribe hopheads 



 < Free Open Study > 



The Qmail Handbook
The qmail Handbook
ISBN: 1893115402
EAN: 2147483647
Year: 2001
Pages: 186
Authors: Dave Sill

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net