YoLinux Tutorial: GNU Mailman Email list installation and configuration


Mailman is a server based email list and web based list member management software. It allows list users to send a single email to the list email address (i.e. list@orgname.com) and all members on the list will recieve the email. It is a great communications tool for the disemination of information and for discussion among list members. Mailman will also save list emails for archive and viewing via the web. A full featured email web gui is also provided for list members and list administrators.

This tutorial covers the use of GNU Mailman with the sendmail MTA email server and apache web server residing on the same system. When Mailman recieves an email for distribution to the list, it then uses sendmail as the outgoing mail server. Mailman administration and configuration is available from the web based GUI which is enabled by the apache web server.

For other YoLinux eMail tutorials see:

  1. MTA or Mail Transfer Agents - sendmail, qmail, etc - Links/Info
  2. Mail Retrieval Software - pop3, imap, etc - Links/Info
  3. Mail User Agent (MUA): E-Mail client - Netscape, MUTT, etc - Links/Info

Related YoLinux Tutorials:

°Web Site Configuration

°Linux Systems Administration

°Internet Security

°YoLinux Tutorials Index



Free Information Technology Magazine Subscriptions and Document Downloads


Mailman Installation:

This installation assumes the use of the Apache web server, sendmail and Python.

The simplest method for installing Mailman on a Red Hat based server is by using an RPM. (Part of the regular distribution since RH 7.2. On Red Hat 7.1 the RPM can be found on the Powertools CD) install:

   rpm -ivh mailman-2.0.8-1.i386.rpm
Download RPM:

Ubuntu (dapper 6.06) / Debian: apt-get install mailman


If building from source: (I never did it this way.)

./configure --prefix=/var/mailman
make install
Note FC 3: RPM's use to (RH 9) install to /var/mailman. This does not conform to the newer Filesystem Hierarchy Standard (FHS) used by Fedora Core 3 and also conflicts with SELinux security. Mailman now installs to /usr/lib/mailman/... and /usr/share/doc/mailman-*

Compile wrappers: mailman-2.0.8/src/alias-wrapper.c, cgi-wrapper.c, mail-wrapper.c

Mailman source is available from:


Red Hat/CentOS RPM package notes:

  • The Red Hat RPM of Mailman integrates with the Red Hat sendmail RPM which requires a wrapper to interface with it while it executes. The smrsh (sendmail restricted shell) wrapper is installed by the RPM in:
    • Fedora Core 3: /etc/smrsh/mailman (soft linked to /usr/lib/mailman/mail/mailman)
      Note: The directory /etc/smrsh is the location of the restricted shell programs which are to interface with sendmail.
    • Red Hat 9.0: /etc/smrsh/mailman (soft linked to /var/mailman/mail/mailman)
      Note: The directory /etc/smrsh is the location of the restricted shell programs which are to interface with sendmail.
    • Red Hat 7.1: /etc/smrsh/wrapper (soft linked to /var/mailman/mail/wrapper)
    • Debian restricted shell directory: /usr/admin/sm.bin

  • Documentation will be installed in: (local system file)

  • Icons for the web interface are placed in /var/www/icons/ (PythonPowered.png,gnu-head-tiny.jpg,mailman-large.jpg,mailman.jpg)

  • RPM installs the rest of mailman in /var/mailman
    Red Hat 9.0 / Mailman 2.1.1 introduces:
    • a daemon init script: /etc/rc.d/init.d/mailman
    • logrotate support: /etc/logrotate.d/mailman
    • Apache 2.0 conf.d support: /etc/httpd/conf.d/mailman.conf
    Fedora Core splits install to include: /usr/lib/mailman/...
    for python scripts.

Ubuntu package notes:

Installs to:
  • Installed software package: /usr/lib/mailman/
  • CGI: /usr/lib/cgi-bin/mailman/
  • Configuration documentation: /usr/share/doc/mailman/
  • Log files: /usr/log/mailman/
  • User data: /var/lib/mailman/
  • Runtime lock file: /var/lock/mailman/
  • Location of process id file: /var/run/mailman/
  • Configuration files located in this directory: /etc/mailman/
  • Start script: /etc/init.d/mailman
  • Admin commands: /usr/sbin/

Check file and directory permissions of installation: /usr/sbin/check_perms
Use check_perms -f to fix permission problems.
Manual fix: chown -R list.list /var/lib/mailman/*


Configuration: (sendmail, Apache, cron)

  • Create the default list "mailman": (as root)
    • Fedora Core 3 / Mailman 2.1.5 RPM:
      This requires the manual creation of the default list "mailman" and the entry for the aliases file:
      [root prompt]# cd /usr/lib/mailman
      [root prompt]# bin/newlist mailman        - Creates a mailing list called mailman.
                     Enter the email address of the person running the list:
                     Initial mailman password:    - Type it correctly. There is no verification!
                   
      Cut and paste entry to the file /etc/aliases
      ## mailman mailing list
      mailman:              "|/usr/lib/mailman/mail/mailman post mailman"
      mailman-admin:        "|/usr/lib/mailman/mail/mailman admin mailman"
      mailman-bounces:      "|/usr/lib/mailman/mail/mailman bounces mailman"
      mailman-confirm:      "|/usr/lib/mailman/mail/mailman confirm mailman"
      mailman-join:         "|/usr/lib/mailman/mail/mailman join mailman"
      mailman-leave:        "|/usr/lib/mailman/mail/mailman leave mailman"
      mailman-owner:        "|/usr/lib/mailman/mail/mailman owner mailman"
      mailman-request:      "|/usr/lib/mailman/mail/mailman request mailman"
      mailman-subscribe:    "|/usr/lib/mailman/mail/mailman subscribe mailman"
      mailman-unsubscribe:  "|/usr/lib/mailman/mail/mailman unsubscribe mailman"
          
                            
      Virtual hosting notes: (multiple domains on a single system)
      • The command /usr/lib/mailman/bin/newlist can take the domain as an argument. i.e. lista@www.mydomain.com
        where www.mydomain.com is the URL to the list and is a key in mm_cfg.py or Defaults.py
      • Virtual domains are specified as a key-value pair:
        add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST)
      • Defaults are specified with the directives DEFAULT_EMAIL_HOST and DEFAULT_URL (specified in /usr/lib/mailman/Mailman/mm_cfg.py)
      • List names are forced to lower case.
    • Red Hat 9.0 / Mailman 2.0.8 RPM:
      This requires the manual creation of the default list "mailman" and the entry for the aliases file:
      [root prompt]# cd /var/mailman
      [root prompt]# bin/newlist mailman - Creates a mailing list called mailman. Enter the email address of the person running the list: Initial mailman password: - Type it correctly. There is no verification!
      Cut and paste entry to the file /etc/aliases
      ## mailman mailing list
      mailman: "|/var/mailman/mail/mailman post mailman"
      mailman-admin: "|/var/mailman/mail/mailman admin mailman"
      mailman-bounces: "|/var/mailman/mail/mailman bounces mailman"
      mailman-confirm: "|/var/mailman/mail/mailman confirm mailman"
      mailman-join: "|/var/mailman/mail/mailman join mailman"
      mailman-leave: "|/var/mailman/mail/mailman leave mailman"
      mailman-owner: "|/var/mailman/mail/mailman owner mailman"
      mailman-request: "|/var/mailman/mail/mailman request mailman"
      mailman-subscribe: "|/var/mailman/mail/mailman subscribe mailman"
      mailman-unsubscribe: "|/var/mailman/mail/mailman unsubscribe mailman"
    • The Red Hat 7.1 / Mailman 2.0.8 RPM creates two sendmail aliases in the file /etc/aliases
          mailman: postmaster
      mailman-owner: mailman

  • The RPM creates a sendmail user. (and entries in the files /etc/passwd, /etc/shadow, /etc/gshadow, /etc/group)
    • Fedora Core 3:
          mailman:x:41:41:GNU Mailing List Manager:/usr/lib/mailman:/sbin/nologin
    • Red Hat 9.0:
          mailman:x:41:41:GNU Mailing List Manager:/var/mailman:/sbin/nologin
    • Red Hat 7.1:
          mailman:x:41:41:GNU Mailing List Manager:/var/mailman:/bin/false
  • Apache configuration:
    • Fedora Core 3: (Apache 2.0) /etc/httpd/conf.d/mailman.conf
      ScriptAlias /mailman/ /usr/lib/mailman/cgi-bin/
      <Directory /usr/lib/mailman/cgi-bin/>
      AllowOverride None
      Options ExecCGI
      Order allow,deny
      Allow from all
      </Directory>

      Alias /pipermail/ /var/lib/mailman/archives/public/
      <Directory /var/lib/mailman/archives/public>
      Options Indexes MultiViews FollowSymLinks
      AllowOverride None
      Order allow,deny
      Allow from all
      </Directory>

      # Uncomment the following line, replacing www.example.com with your server's
      # name, to redirect queries to /mailman to the listinfo page (recommended).

      # RedirectMatch ^/mailman[/]*$ http://www.example.com/mailman/listinfo

      The last line of this file can be manually edited to match your domain. Default is to have the line commented out.
    • Red Hat 9.0: (Apache 2.0) /etc/httpd/conf.d/mailman.conf
      ScriptAlias /mailman/ /var/mailman/cgi-bin/
      <Directory /var/mailman/cgi-bin">
      AllowOverride None
      Options ExecCGI
      Order allow,deny
      Allow from all
      </Directory>

      Alias /pipermail/ /var/mailman/archives/public/
      <Directory /var/mailman/archives>
      Options +FollowSymlinks
      </Directory>

      # Redirect queries to /mailman to the listinfo page (recommended)
      RedirectMatch /mailman[/]*$ http://www.mega-corp.com/mailman/listinfo
      The last line of this file can be manually edited to match your domain. Default is to have the line commented out.
      [Potential Pitfall]: The Red Hat 9.0 install does NOT include the "Directory" statement for /var/mailman/cgi-bin. Add this in manually.
    • Red Hat 7.1: Apache configuration file additions: /etc/httpd/conf/httpd.conf
      ..
      ...
      ScriptAlias /mailman/ /var/mailman/cgi-bin/
      Alias /pipermail/ /var/mailman/archives/public/
      <Directory /var/mailman/archives>
      Options +FollowSymlinks
      </Directory>
      <Directory /var/mailman/cgi-bin">
      AllowOverride None
      Options +ExecCGI
      Order allow,deny
      Allow from all
      </Directory>
      ...
      ..
    Restart the web server: service httpd restart (or: /etc/init.d/httpd restart)

  • CRON: The file /var/spool/cron/mailman controls timed events:
    • Mail reminder to admins as to pending requests. (Daily)
    • Mail digests for lists that do periodic as well as threshhold delivery. (Daily)
    • Mail password reminders to list members. (Monthly)
    • News interface to mail is run every five minutes! By defaults this in on. Edit file and comment this line out if you are not using this feature. (You probably are not)
    • Manage archives. (Daily)
    • Retry failed mail deliveries. (Every minute)

    Changes are made to the file: (Defaults ok)

    • Fedora Core 3: /usr/lib/mailman/cron/crontab.in (group.owner root.mailman)
      (Also the init script will populate: /etc/cron.d/mailman)
      As root execute the following commands:
          [root prompt]# cd /usr/lib/mailman/cron
      [root prompt]# crontab -u mailman crontab.in
      This will create/update /var/spool/cron/mailman
    • Red Hat 7.1-9.0: /var/mailman/cron/crontab.in (group.owner root.mailman)
      As root execute the following commands:
          [root prompt]# cd /var/mailman/cron
      [root prompt]# crontab -u mailman crontab.in
      This will create/update /var/spool/cron/mailman


Mailman Configuration:

  1. Change defaults file mm_cfg.py
    • Fedora Core 3 / Mailman 2.1.5: /usr/lib/mailman/Mailman/mm_cfg.py
      try:
      fqdn = getfqdn()
      except:
      fqdn = 'mm_cfg_has_unknown_host_domains'

      DEFAULT_URL_HOST = fqdn
      DEFAULT_EMAIL_HOST = fqdn
    • Red Hat 9.0 / Mailman 2.1.1: /var/mailman/Mailman/mm_cfg.py
      DEFAULT_URL_HOST   = 'mega-corp.com'
      DEFAULT_EMAIL_HOST = 'mega-corp.com'
    • Red Hat 7.1 / Mailman 2.0.8: /var/mailman/Mailman/mm_cfg.py
      DEFAULT_HOST_NAME = 'localhost'
      DEFAULT_URL = 'http://localhost/mailman/'

  2. Create a mailing list (example: test):
    [root prompt]# cd /var/mailman
    [root prompt]# bin/newlist test - Creates a mailing list called test. Enter the email address of the person running the list: Initial test password: - Type it correctly. There is no verification!
  3. Configure sendmail: The newlist command will then print the entries to add to the file /etc/aliases.
    Add (cut and paste) the entries to the file /etc/aliases:
    • Fedora Core 3 / Mailman 2.1.5:
      test:              "|/usr/lib/mailman/mail/mailman post test"
      test-admin: "|/usr/lib/mailman/mail/mailman admin test"
      test-bounces: "|/usr/lib/mailman/mail/mailman bounces test"
      test-confirm: "|/usr/lib/mailman/mail/mailman confirm test"
      test-join: "|/usr/lib/mailman/mail/mailman join test"
      test-leave: "|/usr/lib/mailman/mail/mailman leave test"
      test-owner: "|/usr/lib/mailman/mail/mailman owner test"
      test-request: "|/usr/lib/mailman/mail/mailman request test"
      test-subscribe: "|/usr/lib/mailman/mail/mailman subscribe test"
      test-unsubscribe: "|/usr/livarb/mailman/mail/mailman unsubscribe test"
    • Red Hat 9.0 / Mailman 2.1.1:
      test:              "|/var/mailman/mail/mailman post test"
      test-admin: "|/var/mailman/mail/mailman admin test"
      test-bounces: "|/var/mailman/mail/mailman bounces test"
      test-confirm: "|/var/mailman/mail/mailman confirm test"
      test-join: "|/var/mailman/mail/mailman join test"
      test-leave: "|/var/mailman/mail/mailman leave test"
      test-owner: "|/var/mailman/mail/mailman owner test"
      test-request: "|/var/mailman/mail/mailman request test"
      test-subscribe: "|/var/mailman/mail/mailman subscribe test"
      test-unsubscribe: "|/var/mailman/mail/mailman unsubscribe test"
    • Red Hat 7.1 / Mailman 2.0.8:
      test:                    "|/var/mailman/mail/wrapper post test"
      test-admin: "|/var/mailman/mail/wrapper mailowner test"
      test-request: "|/var/mailman/mail/wrapper mailcmd test"
      test-owner: test-admin
    Once the new sendmail directives have been added to the aliases file, regenerate the aliases database with the command: /usr/bin/newaliases
    Restart sendmail with the command: /etc/rc.d/init.d/sendmail restart
    The newlist command creates the directory:
    • Fedora Core 3: /usr/lib/mailman/lists/test/
    • Red Hat 7.1-9.0: /var/mailman/lists/test/
    and also creates the required files for the list.

    Potential Pitfall: If this is not set-up properly you will probably get an email stating that the list was not found.

  4. Site Password:
    • Fedora Core 3: Creat site admin password with the command /usr/lib/mailman/bin/mmsitepass (which creates the file /usr/lib/mailman/data/adm.pw) This is required or else the daemon started by the init script /etc/rc.d/init.d/mailman will not start.
    • Red Hat 9.0: Creat site admin password with the command /var/mailman/bin/mmsitepass (which creates the file /var/mailman/data/adm.pw) This is required or else the daemon started by the init script /etc/rc.d/init.d/mailman will not start.
    • Red Hat 7.1: Install notes suggested the creation of an admin password with the command /var/mailman/bin/mmsitepass (which creates the file /var/mailman/data/adm.pw) This did not seem necessary.

  5. Note mailman 2.1.1 (Red Hat 9.0, Fedora Core and later) uses a daemon, qrunner, which must be started: (as root)
    • chkconfig --level 35 mailman on
    • service mailman start


Using Mailman:

  • Point your browser to http://your-domain/mailman/admin/test/
    (or http://your-domain/mailman/admin/)
    From this administration interface, one will configure the security, policies, users and presentation of the email list.

    User should be pointed to: http://your-domain/mailman/listinfo/test
    Here users may subscribe, unsubscribe configure their account.

    User options (for their given email address) may be set by pointing the browser to: http://your-domain/mailman/options/test/email-user%40your-isp.com

    Once an email has been sent to the list, archives will be available from http://your-domain/pipermail/test/

    (Is http://localhost/mailman/private/test suppose to do something?? It didn't for me)

  • Log files are available for reviewing errors etc.: /var/mailman/logs/...

Potential Pitfalls:

  • If upgrading mailman, the command /var/mailman/bin/update will update Mailman list files. The RPM install should do this for you.
  • The easiest configuration is to run Mailman on the same computer which is running your mail server (MTA). If not, and you are sharing a filesystem, beware that the locking mechanism of NFS way thwart sucess. See: Mailman/LockFile.py and the constant CLOCK_SLOP to fix any potential problem with clock skew.


Mailman administration commands:

Mailman commands to view contents of data files:

Command Description
dumpdb List contents.
dumpdb -p /var/mailman/list-name/config.pck > outfile

Command Location:

  • Ubuntu (dapper 6.06) / Debian: /var/mailman/bin/


Transferring a Mailman repository from one server to another:

The Mailman data files are stored in the following directories:

  • Fedora Core/CentOS/Ubuntu:
    • /var/lib/mailman/lists/list-name/...
    • /var/lib/mailman/archives/private/list-name/...
      /var/lib/mailman/archives/public/list-name/...
    • /var/lib/mailman/data/...
  • Red Hat 9.0
    • /var/mailman/lists/list-name/...
    • /var/mailman/archives/private/list-name/...
      /var/mailman/archives/public/list-name/...
    • /var/mailman/data/...
Simply tar the directories and transfer them to the new server:
cd /var/lib/mailman
tar cf mailman-archive.tar lists archive data

Note:

  • When I transferred a Mailman repository from a Red Hat system to an Ubuntu system it required a soft link to maintain the CGI in the Apache CGI script alias path.
    ln -s /var/lib/mailman/cgi-bin /usr/lib/cgi-bin/mailman/
  • Directory permissions must be set to the system user id used for Mailman: (i.e. chown -R root:list)
    • Red Hat/Fedora Core: root:mailman
    • Ubuntu: root:list

This worked for me.


Links:


Return to http://YoLinux.com for more Linux links, information and tutorials
Return to YoLinux Tutorial Index
Feedback Form

Copyright © 2001, 2002, 2005, 2006, 2008 by Greg Ippolito