Next Previous Contents

3. Majordomo

Majordomo is, of course, the piece of code that this document revolves around; it consists of a collection of Perl scripts with the sole purpose of managing mailing lists.

3.1 Preparing to Install

Download the gzipped source distribution of the latest version of Majordomo from http://www.greatcircle.com/majordomo/ and uncompress it


[jarchie@kes jarchie]$ zcat majordomo-1.94.4.tar.Z | tar xvf -

This will create a subdirectory with all of the files necessary to install Majordomo; this directory cannot be the same directory in which Majordomo is to be installed.

Majordomo must run under a specific UID and GID so when any of the scripts are run, they will run under Majordomo's UID. Thus, it is necessary to decide what UID and GID Majordomo should run under. Also, Majordomo must be a Sendmail trusted user. (See Consequences of Making Majordomo a Trusted User)

Check the /etc/passwd and /etc/group files to find a UID and GID that are not taken. For this example, a UID of 16 and a GID of 16 was chosen. You have to decide on the location where the Majordomo scripts will reside; in this HOWTO, the directory /usr/local/majordomo-1.94.4/ was chosen. If you are using a shadowed password file add entries similar to

majordomo:x:16:16:Majordomo List Manager:/usr/local/majordomo-1.9.4:
to your /etc/passwd and add an appropriate entry to /etc/shadow.
majordomo:*:10883:0:88888:7:::
Use the other entries in these files as a guide for exactly what should be added. These are only the values for my system. If you are not using shadowed passwords, only an entry in the /etc/passwd file is necessary.

To create a Majordomo group, add the line

majordomo:x:16:jarchie,majordomo
to your /etc/group file. This will give you access to the Majordomo files that are group writable. Also, you might want to add majordomo to the daemon group to make it a trusted user (See Sendmail Trusted Users); to do this, change the line that looks something like
daemon:x:2:root,bin,daemon
to
daemon:x:2:root,bin,daemon,majordomo

3.2 Editing the Installation Files

The Makefile contains all the information needed to install Majordomo; it is usually necessary to edit lines in the Makefile that refer to system specific settings so Majordomo will be able to install cleanly on your system. Most of the default settings are correct; however, the following settings, almost invariably, need to be changed on a per system basis.


[jarchie@kes majordomo-1.94.4]$ vi Makefile

The settings
PERL = /bin/perl
CC = cc
W_HOME = /usr/test/majordomo-$(VERSION)
MAN = $(W_HOME)/man
W_USER = 123
W_GROUP = 45
should be changed to something more appropriate for your system. For example, in my setup, the values were changed to
PERL = /usr/bin/perl
CC = gcc
W_HOME = /usr/local/majordomo-1.94.4
MAN = /usr/man
W_USER = 16
W_GROUP = 16
Also the majordomo.cf file must be created. An easy way to create this file is to copy the provided sample.cf file to majordomo.cf and edit it.

[jarchie@kes majordomo-1.94.4]$ cp sample.cf majordomo.cf
[jarchie@kes majordomo-1.94.4]$ vi majordomo.cf

Again, most of the settings are correct by default, but the following lines might need to be changed for your system from
$whereami = "example.com";
$whoami = "Majordomo\@$whereami";
$whoami_owner = "Majordomo-Owner\@$whereami";
     $homedir = "/usr/test/majordomo";
$digest_work_dir = "/usr/local/mail/digest";
$sendmail_command = "/usr/lib/sendmail";
to something more appropriate such as
$whereami = "kes.emeraldis.com";
$whoami = "majordomo\@$whereami";
$whoami_owner = "majordomo-owner\@$whereami";
     $homedir = "/usr/local/majordomo-1.94.4";
$digest_work_dir = "/usr/local/majordomo-1.94.4/digest";
$sendmail_command = "/usr/sbin/sendmail";
$whoami and $whoami_owner do not need to be changed for Majordomo to work; however, I changed them because I like to avoid typing capital letters. $digest_work_dir is a temporary directory where digest files should be placed; this directory should be assigned to wherever you want digests to be stored. If you do not plan to use digested lists, do not worry about this option. $whereami, $homedir, and $sendmail_command should be changed to appropriate values for your system. Unlike the Makefile, these options can always be changed after Majordomo is installed by editing majordomo.cf in the directory where Majordomo was installed. (The configuration file is simply copied during setup.)

3.3 Installing Majordomo

The next step is to compile the Majordomo wrapper. The wrapper is the only Majordomo component that needs to be compiled because everything else is a collection of perl scripts and, therefore, is not compiled.

[jarchie@kes majordomo-1.94.4]$ make wrapper
To install the Majordomo files, execute the commands
[jarchie@kes majordomo-1.94.4]# make install
[jarchie@kes majordomo-1.94.4]# make install-wrapper
The first command can be done as the Majordomo user, but the second command needs to be done as root so the installation script can SUID root the Majordomo wrapper. (Since, majordomo was created without a login shell or password, if you want to execute the first command as majordomo, you will need to su majordomo as root in order to become majordomo.)

3.4 Creating the Majordomo Aliases

Sendmail aliases must be created for Majordomo so commands sent to Majordomo can be processed by Majordomo and the majordomo owner in order that people can E-mail you through the standard owner-majordomo address. Add the following entries to your aliases file. (See Aliases)

majordomo:       "|/usr/local/majordomo-1.94.4/wrapper majordomo"
owner-majordomo: jarchie
majordomo-owner: jarchie

3.5 Testing the Configuration

As a regular user (not as majordomo or as root), run


[jarchie@kes jarchie]$ /usr/local/majordomo-1.94.4/wrapper config-test

This program can detect most problems in the Majordomo installation.

3.6 Creating Lists

To create a list, create a file with the name of the list in the Majordomo lists directory. For example, to create a list called test, create a test file as Majordomo


[root@kes /]# su majordomo
[majordomo@kes /]$ touch /usr/local/majordomo-1.94.4/lists/test

and add the related aliases
test:          :include:/usr/local/majordomo-1.94.4/lists/test
owner-test:    jarchie
test-request:  "|/usr/local/majordomo-1.94.4/wrapper request-answer test"
test-approval: jarchie

3.7 Further Testing of the Configuration

Now test the operation of the list by issuing a lists command to majordomo.


[jarchie@kes jarchie]$ echo lists | mail majordomo

It should only take a second for majordomo to reply with a message containing all the lists which are currently set up. Next, try issuing a help command.

[jarchie@kes jarchie]$ echo help | mail majordomo

Majordomo should reply with a list of all commands that Majordomo accepts. It might be a good idea to save the message for future reference.

To see if the aliases are working properly, try subscribing and unsubscribing yourself to the list.


[jarchie@kes jarchie]$ echo subscribe test | mail majordomo

You will receive an E-mail message containing instructions on how to confirm your subscription as well as a letter confirming that your command was successful. After sending back your confirmation, Majordomo should send back two letters--one letter stating that your subscribe request was successful and another letter welcoming you to the test list. The owner of the list will also be sent a message stating that you have subscribed to the list.

To unsubscribe from a list, send a unsubscribe command


[jarchie@kes jarchie]$ echo unsubscribe test | mail majordomo

You should be sent back a letter stating that your command was successful.

3.8 Creating Better Aliases

For some lists, it may be desirable to have Majordomo process messages before they reach the list. For example, Majordomo has an option automatically to filter messages based on content (such as taboo words), or Majordomo can catch people trying to send Majordomo commands to the list. To use these options, it is necessary to use a better set of aliases such as

test:        "|/usr/local/majordomo-1.94.4/wrapper resend -l test test-list"
test-list:   :include:/usr/local/majordomo-1.94.4/lists/test
owner-test:  jarchie
test-owner:  jarchie
test-request:  "|/usr/local/majordomo-1.94.4/wrapper majordomo -l test"
The last entry allows someone simply to send a message to [email protected] with the text subscribe rather than sending a letter to [email protected] with the text subscribe test.
Next Previous Contents