###
6.1.1 Integrating Postfix and Mailman

You can integrate Postfix and Mailman such that when new lists are created, or lists are removed, Postfix's alias database will be automatically updated. The following are the steps you need to take to make this work.

In the description below, we assume that you've installed Mailman in the default location, i.e. /usr/local/mailman. If that's not the case, adjust the instructions according to your use of configure's --prefix and --with-var-prefix options.

Note: If you are using virtual domains and you want Mailman to honor your virtual domains, read the 6.1 section below first!

- Add this to the bottom of the $prefix/Mailman/mm_cfg.py file:

              MTA = 'Postfix'

  The MTA variable names a module in the Mailman/MTA directory which contains the mail server-specific functions to be executed when a list is created or removed.

- Look at the Defaults.py file for the variables POSTFIX_ALIAS_CMD and POSTFIX_MAP_CMD command. Make sure these point to your postalias and postmap programs respectively. Remember that if you need to make changes, do it in mm_cfg.py.

- Run the bin/genaliases script to initialize your aliases file.

              % cd /usr/local/mailman
              % bin/genaliases

  Make sure that the owner of the data/aliases and data/aliases.db file is `mailman`, that the group owner for those files is `mailman`, or whatever user and group you used in the configure command, and that both files are group writable:

              % su
              % chown mailman:mailman data/aliases*
              % chmod g+w data/aliases*

- Hack your Postfix's main.cf file to include the following path in your alias_maps variable:

                /usr/local/mailman/data/aliases

  Note that there should be no trailing `.db`. Do not include this in your alias_database variable. This is because you do not want Postfix's newaliases command to modify Mailman's aliases.db file, but you do want Postfix to consult aliases.db when looking for local addresses.

  You probably want to use a `hash:` style database for this entry. Here's an example:

              alias_maps = hash:/etc/postfix/aliases,
                  hash:/usr/local/mailman/data/aliases

- When you configure Mailman, use the --with-mail-gid=mailman switch; this will be the default if you configured Mailman after adding the `mailman` owner. Because the owner of the aliases.db file is `mailman`, Postfix will execute Mailman's wrapper program as uid and gid `mailman`.

That's it! One caveat: when you add or remove a list, the aliases.db file will updated, but it will not automatically run postfix reload. This is because you need to be root to run this and suid-root scripts are not secure. The only effect of this is that it will take about a minute for Postfix to notice the change to the aliases.db file and update its tables.