Exim 4 routers and transport for Sympa
November 9, 2006 - 10:14amSympa is a nifty mailing list manager with a nice architecture for distributing list management duties and a solid web interface that I developed. This is a brief howto on integrating Exim4 and Sympa on a Debian-based distribution.
The problem
As with all mailing list managers, the MTA must be able to correctly route email intended for a list to the mailing list manager processing applications. Back in the bad old days on *NIX systems, this often meant creating mail aliases in /etc/aliases that routed mailing list messages to the list processing executables via a pipe, as in listname: "| /path/to/sympa/bin/queue listname@my.domain.org". This stinks because the piped command must run as the MTA's user and because this is a management nightmare and effectively means that users trsuted to edit /etc/aliases become a bottleneck to list creation.
A solution
If you are running Exim4 and Sympa, you can use two custom Exim4 routers and one transport to handle all Sympa traffic. This example assumes a Debian-based Exim4 + Sympa setup, but it should be easy to adapt to any other distribution by changing the paths to reflect the locations of the Sympa scripts on your system. For this guide, it is critical that all Sympa virtual robots, including the main/default virtual robot, have their own configuration and data directories.
The Exim routers check for the existence of the list in question by looking for the corresponding Sympa directory and then use regex matching to extract the relevant pieces of information from the message needed to tell Sympa how to process it. The Sympa transport simply provides a pipe transport for the routers.
At the top of your Exim configuration file (or in one of the files in conf.d/main/ in a split configuration), add lines to define your basic Sympa parameters:
### Sympa paths and users ###
# Location of Sympa virtual robot directories
SYMPA_LISTS = /var/lib/sympa/expl
# Sympa executable paths
SYMPA_QUEUE = /usr/lib/sympa/bin/queue
SYMPA_BOUNCEQUEUE = /usr/lib/sympa/bin/bouncequeue
# Sympa uid and gid
SYMPA_UID = sympa
SYMPA_GID = sympa
Note: If you correctly enter the paths at this point, the rest should be pretty must distribution-independent.
At this point, you need to add two routers, either in conf.d/routers or in the routers section of your config file. Router order matters -- my Sympa routers are sandwiched between the real_local router and the system_aliases router, but you'll want to put them where it makes most sense.
The first router simply looks for any address called "listmanager" and routes it to a list. This could certainly be improved to be more sophisticated, but I don't know a lot of people named "listmanager" so I figured I could get away with it:
sympa_manager:
debug_print = "R: Sympa list manager for $domain"
driver = redirect
data = ${if match{$local_part}{listmanager} \
{| /usr/lib/sympa/bin/queue sympa@$domain}}
pipe_transport = sympa_pipe
The next router is more acrobatic and the critical piece here. It handles all the administrative addresses and correct routing to the bounce queue:
sympa_queue:
debug_print = "R: Sympa mailing lists for $local_part@$domain"
driver = redirect
data = ${if exists {SYMPA_LISTS/$domain/${sg{$local_part}{-request|-editor|-owner|-subscribe|-unsubscribe}{}}}\
{${if match{$local_part}{(.*)-owner}\
{| SYMPA_BOUNCEQUEUE ${sg{$local_part}{-owner}{}}@$domain}{| SYMPA_QUEUE $local_part@$domain}}}}
pipe_transport = sympa_pipe
Somewhere, I have a diagram that breaks down the logic implied in the data statement, which I'll post when I find. In any event, if a domain.tld/listname/ directory exists in the Sympa list directory, then the router passes off the message to Sympa.
Finally, you need a Sympa transport in your transport section. Transport order does not matter.
sympa_pipe:
debug_print = "T: address_pipe for $local_part@$domain"
driver = pipe
user = SYMPA_UID
group = SYMPA_GID
return_fail_output
That's it. To test, you can use the exim4 -bt command. Your output should look something like this:
$ exim4 -bt test@lists.foobar.com
R: Sympa list manager for lists.foobar.com
R: Sympa mailing lists for test@lists.foobar.com
test@lists.foobar.com -> | /usr/lib/sympa/bin/queue test@lists.foobar.com
transport = sympa_pipe
Comments
There are no comments right now.
age of conan gold buy age of conan gold cheap age of conan gold
warhammer gold buy warhammer gold cheap warhammer gold
warhammer gold buy warhammer gold cheap warhammer gold
warhammer gold buy warhammer gold cheap warhammer gold
warhammer gold buy warhammer gold cheap warhammer gold
warhammer gold buy warhammer gold cheap warhammer gold
warhammer gold buy warhammer gold cheap warhammer gold
Post new comment