A short link to this page is https://wiki.list.org/x/12517386

Clear message

As I say below in Comment #1, "I do not recommend people follow this article. I do not recommend postfix_to_mailman.py which is a 3rd party module neither distributed nor officially supported by the GNU Mailman project." If that isn't enough to stop you, read the Warning in Sec 4 and the complete comment # 1. /Mark Sapiro, Mailman core developer and primary MM 2.1.x supporter.

This instruction set is written for those who wish to integrate Mailman with the postfix MTA.  The documentation currently available does not cover in detail how to use virtual hosts and MySQL-based aliases.

Please note: The instructions here are based on the Ubuntu 10.10 Linux distribution, loaded on a VPS.  Specific file locations may differ.

Before beginning, postfix should be installed and working correctly.  If you are using or plan to use virtual hosts, set this up prior to installing and configuring Mailman.

Normal postfix Integration

If you do not have any subdomains or do not plan on using virtual hosts within postfix, follow the steps below to integrate Mailman with your system.

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

    MTA = 'Postfix' Please note that depending on your specific distribution, this setting may be set within $prefix/Mailman/Defaults.py.

  2. Run the following command to initialize your mailman aliases:

    $prefix/bin/genaliases The command creates two files: aliases and aliases.db. These files are usually created within $prefix/data, but may be located elsewhere, depending on your configuration. They may sometimes be found within /var/lib/mailman/data.

  3. Make sure that the owner and group owner of these files are set to mailman

postfix with Virtual Domains (hash map)

Let's assume you have several domains (in this case example1.com and example2.net) and you plan on hosting mailman on lists.example1.com and lists.example2.net.  You will have to select a default domain you want to host mailman on.  It doesn't really matter which one you choose but remember that it will be the one where everyone will come to administer their lists.  In this case, I will select lists.example1.com

  1. Within $prefix/Mailman/mmcfg.py file, add the following lines below the MTA line you inserted above:
    POSTFIX_STYLE_VIRTUAL_DOMAINS = ['example1.com', 'example2.net']
    VIRTUAL_MAILMAN_LOCAL_DOMAIN = 'localhost'
  2. Change DEFAULT_EMAIL_HOST and DEFAULT_URL_HOSTto match your default domain:

    #-------------------------------------------------------------
    # Default domain for email addresses of newly created MLs
    DEFAULT_EMAIL_HOST = 'lists.mikesoh.com'
    #-------------------------------------------------------------
    # Default host for web interface of newly created MLs
    DEFAULT_URL_HOST   = 'lists.mikesoh.com'
    # Update VIRTUAL_HOSTS for the above
    add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST)
  3. Save and close mm_cfg.py and run $prefix/bin/genaliases, taking care to make sure that the resulting alias files are readable by postfix.
  4. Next, modify your postfix configuration to include mailman aliases.  Within main.cf, add the resulting alias files:
    virtual_alias_maps = mysql:/etc/postfix/virtual/existing_aliases.cf,
             hash:/var/lib/mailman/data/virtual-mailman
    alias_maps = hash:/etc/aliases, hash:/var/lib/mailman/data/aliases

    Warning

    The above additions to virtual_alias_maps and alias_maps are not used by postfix_to_mailman.py and can potentially cause conflicts within Postfix over delivery of mail to Mailman. The GNU-Mailman project recommends the methods outlined in section 6.1.1 and section 6.1.2 of the Installation Manual for integrating Postfix and Mailman with virtual domains.

  5. Save and close main.cf. Open the master.cf file. If not already included, add the mailman service to the end of the file:
    # ==========================================================================
    # service type  private unpriv  chroot  wakeup  maxproc command + args
    #               (yes)   (yes)   (yes)   (never) (100)
    # ==========================================================================
    mailman   unix  -       n       n       -       -       pipe
      flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
      ${nexthop} ${user
    }
  6. Save and close master.cf. Open your transport file. By default, this file should be located within the same directory as your main.cf and master.cf files. Add the following lines:
    example1.com   mailman:
    example2.net   mailman:
  7. Run postmap -v on the transport file.
  8. Restart mailman and postfix

You will not be able to create lists using the web interface. New lists must use the $prefix/bin/newlist command.


Comments

Mark Sapiro

I do not recommend people follow this article. I do not recommend postfix_to_mailman.py which is a 3rd party module neither distributed nor officially supported by the GNU Mailman project. I also don't understand what is lacking in the official installation manual ("the documentation currently available" link at the beginning of this article, and I don't understand why there would be anything in even these instructions that would prevent them working with lists created via the web interface as long as the permissions are correct on Mailman's data/aliases and data/virtual-mailman files which aren't even used by postfix_to_mailman.py anyway.