Exim4 + Mailman + Apache2 on Debian etch mini-HOWTO

This is just a very fast and rough simple guideline for setting up Mailman + Exim4 based on Debian etch. For sure that we will also configure Apache2 for Mailman web interface. Not much detail will be mentioned, please refer to corresponding document if you hope to understand more. Debian also come with a handy guideline from /usr/share/doc/mailman/README.Exim4.Debian, so you should have a look with it before follow this guideline :)

Install required packages

You may need something else but I am not sure right now. Please correct me if package missed:

apt-get update
apt-get install mailman exim4-daemon-heavy libapache2-mod-php5

Configure Mailman

Since I am not going to support virtual domain with Mailman, I will skip some step which listed in /usr/share/doc/mailman/README.Exim4.Debian. BTW, I would like to change the default web interface URL pattern so let's take the following changes in /etc/mailman/mm_cfg.py:

#-------------------------------------------------------------
# The name of the list Mailman uses to send password reminders
# and similar. Don't change if you want mailman-owner to be
# a valid local part.
MAILMAN_SITE_LIST = 'mailman'

#-------------------------------------------------------------
# If you change these, you have to configure your http server
# accordingly (Alias and ScriptAlias directives in most httpds)
DEFAULT_URL_PATTERN = 'http://%s/mailman/'
PRIVATE_ARCHIVE_URL = '/mailman/private'
IMAGE_LOGOS         = '/images/mailman/'

#-------------------------------------------------------------
# Default domain for email addresses of newly created MLs
DEFAULT_EMAIL_HOST = 'example.com'
#-------------------------------------------------------------
# Default host for web interface of newly created MLs
DEFAULT_URL_HOST   = 'lists.example.com'

I would like to activate SpamAssassin, too. So let's uncomment as below:

#-------------------------------------------------------------
# Uncomment if you want to filter mail with SpamAssassin. For
# more information please visit this website:
# http://www.daa.com.au/~james/articles/mailman-spamassassin/
GLOBAL_PIPELINE.insert(1, 'SpamAssassin')

For sure that, you will need to have a SpamAssassin which setup correctly :)

Next, setup Mailman site password and list creator password with following command:

mmsitepass
mmsitepass -c

Create the system list for mailman:

newlist mailman

Configure Apache2

Since we change the DEFAULT_URL_PATTERN in mailman configuration, we will also need to update Apache2 to handle it. Create a file call /etc/apache2/conf.d/mailman with following lines:

ScriptAlias /mailman/ /usr/lib/cgi-bin/mailman/
Alias /pipermail/ /var/lib/mailman/archives/public/
Alias /images/mailman/ /usr/share/images/mailman/

Another solution from /usr/share/doc/mailman/README.Debian:

An example Apache configuration is included in /etc/mailman/apache.conf.
It can be copied to or symlinked from e.g. the /etc/apache2/conf.d/ directory.

So we can symlink the example file with:
ln -s /etc/mailman/apache.conf /etc/apache2/conf.d/mailman

And edit the head of /etc/apache2/conf.d/mailman as below:
# We can find mailman here:
ScriptAlias /mailman/ /usr/lib/cgi-bin/mailman/
# And the public archives:
Alias /pipermail/ /var/lib/mailman/archives/public/
# Logos:
Alias /images/mailman/ /usr/share/images/mailman/

Configure Exim4

Put this in your exim4 main configuration (e.g. /etc/exim4/exim4.conf.template for unsplit configure, or files located in /etc/exim4/conf.d/*/ for split handling):

# Home dir for your Mailman installation -- aka Mailman's prefix
# directory.
MAILMAN_HOME=/var/lib/mailman
MAILMAN_WRAP=MAILMAN_HOME/mail/mailman

# User and group for Mailman, should match your --with-mail-gid
# switch to Mailman's configure script.
MAILMAN_USER=list
MAILMAN_GROUP=daemon

Put this in your exim4 router configuration:

# Messages get sent out with
# envelope from "mailman-bounces@virtual_domain"
# But mailman doesn't put such addresses
# in the aliases. Recognise these here.
mailman_workaround:
  domains = +local_domains
  require_files = MAILMAN_HOME/lists/$local_part/config.pck
  driver = accept
  local_parts = mailman
  local_part_suffix_optional
  local_part_suffix = -bounces : -bounces+* : \
           -confirm+* : -join : -leave : \
           -subscribe : -unsubscribe : \
           -owner : -request : -admin
  transport = mailman_transport
  group = MAILMAN_GROUP

# Mailman lists
mailman_router:
  domains = +local_domains
  require_files = MAILMAN_HOME/lists/$local_part/config.pck
  driver = accept
  local_part_suffix_optional
  local_part_suffix = -bounces : -bounces+* : \
                      -confirm+* : -join : -leave : \
                      -subscribe : -unsubscribe : \
                      -owner : -request : -admin
  transport = mailman_transport
  group = MAILMAN_GROUP

Put this in your exim4 transport configuration:

mailman_transport:
  driver = pipe
  command = MAILMAN_WRAP \
            '${if def:local_part_suffix \
                  {${sg{$local_part_suffix}{-(\\w+)(\\+.*)?}{\$1}}} \
                  {post}}' \
            $local_part
  current_directory = MAILMAN_HOME
  home_directory = MAILMAN_HOME
  user = MAILMAN_USER
  group = MAILMAN_GROUP
  freeze_exec_fail = true

We don't need the line below, remember to remove it:

  condition = ${lookup{$local_part@$domain}lsearch{MAILMAN_HOME/data/virtual-mailman}{1}{0}}

Save all your settings, and reactive your new Exim4 configuration with:

dpkg-reconfigure exim4-config

Post-install configuration

Up to this part, all of your service should configure correctly. So let's restart all related services for activation:

/etc/init.d/apache2 restart
/etc/init.d/exim4 restart
/etc/init.d/mailman restart

In order to protect your system list:

  1. log into mailing list mailman from http://lists.example.com/mailman/admin/mailman
  2. change the following setting in General Options:
    1. The public name of this list.: mailman
    2. The list administrator email addresses.: postmaster@example.com
    3. Prefix for subject line of list postings.: [mailman]
    4. Host name this list prefers for email.: example.com
  3. change the following setting in Privacy options -> Subscription rules:
    1. Advertise this list when people ask what lists are on this machine?: No
    2. Who can view subscription list?: List members
  4. change the following setting in Archiving Options:
    1. Is archive file source for public or private archival?: private

I will assume you know how to create your new list. If you don't know, please refer to my other article for more detail :)

Useful references


Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <h1> <h2> <h3> <h4> <h5> <h6> <em> <strong> <code> <del> <blockquote> <q> <sub> <p> <br> <ul> <ol> <li> <dl> <dt> <dd> <a> <b> <u> <i> <sup> <acronym> <pre> <img>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Images can be added to this post.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.