[Mailman-Users] Two lists: same name, different domain -- the postfix way

Karl O. Pinc kop at meme.com
Mon Feb 9 23:35:12 CET 2009


I've been wanting 2 different mailing lists with the same
name, each on a different domain.  This configuration
is not supported in the stock mailman (pre 3.0), but it occurs to
me that there is a workaround when the MTA is postfix.

It's a bit of a kludge, but I think it will work.
I'm interested in what the list thinks.

Note:  I have not tested this.  I've done a little
bit of testing on the outbound mail part, and it
seems to work.  It happens
that the mail architecture in use is forwarding list traffic
to the mailman server, so the inbound translations are
handled by the forwarder and I don't need the
inbound mail part.  I'm running Debian Etch.

First off, FWIW, in debian mailman comes integrated
out of the box with postfix so mailman automatically
maintains all it's aliases.  This is done via a transport map
and postfix-to-mailman.py; any mail sent to the
box's "regular domain" is run through mailman.

The idea is to use postifx's canonical mapping
to re-write the email addresses on all inbound
list traffic to "secondary" domains to add
a "tag" to the user part of the address.  And then
do the reverse to outbound list traffic.  This
is best illustrated by way of example.

Suppose you want 2 lists, foo at example.com and
foo at example.net.  The "regular" domain for the
box is example.com.  Make two lists:
foo and foo-examplenet.

In /etc/postfix/main.cf put the lines:

recipient_canonical_maps = pcre:/etc/postfix/recipient_canonical_domains
sender_canonical_maps = pcre:/etc/postfix/sender_canonical_domains

In /etc/postfix/recipient_canonical_domains put:

/^foo(-.+)?@example.net$/ foo-examplenet${1}@example.com

In /etc/postfix/sender_canonical_domains put:

/^(.*)-examplenet(-(.*))@example.com$/ ${1]${2}@example.net

Mail that comes in as foo at example.net (or e.g.
foo-subscribe at example.net) is readdressed to foo-examplenet at example.com
(or foo-examplenet-subscribe at example.com).  It's then delivered to
mailman's foo-examplenet list just like normal.  Outbound mail sent
from the list comes from foo-examplenet at example.com but
all the addresses are rewritten so as to come from
foo at example.net.

I don't know whether rfc2369 headers are rewritten by
postfix's canonical mapping, I suppose it depends
on whether postfix is rfc2369 aware.  Anyway, that's
simple enough to take care of with header_checks, pcre patterns
like those above, and the REPLACE action.  I think this
would work on both inbound and outbound..., right?

The limitations are you can't have any email addresses
in @example.com that have '-examplenet' in the user
part, and you can't have any foo-.* user names in
@example.net (besides the mailing list.)

This seems a lot more straightforward to setup and
maintain than running multiple instances of mailman,
which is the only other solution I know of.  All
that's needed for maintenance is to add a line
for any new lists to recipient_canonical_domains
and sender_canonical_domains and otherwise everything
works "as it should".  If the "secondary" domains
have no users, only mailing lists, you can construct
a pcre that rewrites all inbound/outbound mail to/from
the domains and there's no work involved when adding
a mailing list.


Karl <kop at meme.com>
Free Software:  "You don't pay back, you pay forward."
                  -- Robert A. Heinlein

More information about the Mailman-Users mailing list