Merge lp:~stephen-xemacs/mailman/exim4 into lp:mailman

Proposed by Stephen Turnbull
Status: Merged
Approved by: Barry Warsaw
Approved revision: 7219
Merge reported by: Barry Warsaw
Merged at revision: not available
Proposed branch: lp:~stephen-xemacs/mailman/exim4
Merge into: lp:mailman
Diff against target: 233 lines (+185/-10)
3 files modified
src/mailman/config/exim4.cfg (+4/-0)
src/mailman/docs/MTA.rst (+131/-10)
src/mailman/mta/exim4.py (+50/-0)
To merge this branch: bzr merge lp:~stephen-xemacs/mailman/exim4
Reviewer Review Type Date Requested Status
Barry Warsaw Approve
Review via email: mp+187302@code.launchpad.net

Description of the change

Add Exim4 support to Mailman 3. Lightly field tested. No unit tests (well, the body of all methods is "pass", how do you test that?) Documentation in src/mailman/docs/MTA.rst.

To post a comment you must log in.
Revision history for this message
Barry Warsaw (barry) wrote :

With a few small style tweaks, LGTM. Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'src/mailman/config/exim4.cfg'
2--- src/mailman/config/exim4.cfg 1970-01-01 00:00:00 +0000
3+++ src/mailman/config/exim4.cfg 2013-09-24 17:30:07 +0000
4@@ -0,0 +1,4 @@
5+# Additional configuration variables for the Exim MTA, version 4.
6+[exim4]
7+
8+# Exim doesn't need any additional configuration yet.
9
10=== modified file 'src/mailman/docs/MTA.rst'
11--- src/mailman/docs/MTA.rst 2013-07-03 18:09:15 +0000
12+++ src/mailman/docs/MTA.rst 2013-09-24 17:30:07 +0000
13@@ -22,10 +22,10 @@
14
15 Cooperation between Mailman and the MTA requires some configuration of
16 both. MTA configuration differs for each of the available MTAs, and
17-there is a section for each one. Instructions for Postfix are given
18-below. We would really appreciate contributions of configurations for
19-Exim and Sendmail, and welcome information about other popular open
20-source mail servers.
21+there is a section for each one. Instructions for Postfix and Exim (v4)
22+are given below. We would really appreciate a contribution of a
23+configuration for Sendmail, and welcome information about other popular
24+open source mail servers.
25
26 Configuring Mailman to communicate with the MTA is straightforward,
27 and basically the same for all MTAs. In your ``mailman.cfg`` file,
28@@ -38,15 +38,25 @@
29 lmtp_port: 8024
30 smtp_host: localhost
31 smtp_port: 25
32+ configuration: mailman.config.postfix
33
34 This configuration is for a system where Mailman and the MTA are on
35 the same host.
36
37-The ``incoming`` and ``outgoing`` parameters identify the Python
38-objects used to communicate with the MTA. The ``deliver`` module used
39-in ``outgoing`` is pretty standard across all MTAs. The ``postfix``
40-module in ``incoming`` is specific to Postfix. See the section for
41-your MTA below for details on these parameters.
42+Note that the modules that configure the communication protocol
43+(especially ``incoming``) are full-fledged Python programs, and may use
44+these configuration parameters to automatically configure the MTA to
45+recognize the list addresses and other attributes of the communication
46+channel. This is why some constraints on the format of attributes arise
47+(e.g., ``lmtp_host``), even though Mailman itself has no problem with
48+them.
49+
50+The ``incoming`` and ``outgoing`` parameters identify the Python objects
51+used to communicate with the MTA. They should be dotted Python module
52+specifications. The ``deliver`` module used in ``outgoing`` should be
53+satisfactory for most MTAs. The ``postfix`` module in ``incoming`` is
54+specific to the Postfix MTA. See the section for your MTA below for details on
55+these parameters.
56
57 ``lmtp_host`` and ``lmtp_port`` are parameters which are used by
58 Mailman, but also will be passed to the MTA to identify the Mailman
59@@ -175,7 +185,118 @@
60 Exim
61 ====
62
63-Contributions are welcome!
64+`Exim 4`_ is an MTA maintained by the `University of Cambridge`_ and
65+distributed by most open source OS distributions.
66+
67+Mailman settings:
68+-----------------
69+
70+Add or edit a stanza like this in mailman.cfg::
71+
72+ [mta]
73+ # For all Exim4 installations
74+ incoming: mailman.mta.exim4.LMTP
75+ outgoing: mailman.mta.deliver.deliver
76+ # Typical single host with MTA and Mailman configuration.
77+ # Adjust to your system's configuration.
78+ # Exim happily works with the "localhost" alias rather than IP address.
79+ lmtp_host: localhost
80+ smtp_host: localhost
81+ # Mailman should not be run as root.
82+ # Use any convenient port > 1024. 8024 is a convention, but can be
83+ # changed if there is a conflict with other software using that port.
84+ lmtp_port: 8024
85+ # smtp_port rarely needs to be set.
86+ smtp_port: 25
87+ # Exim4-specific configuration parameter defaults. Currently empty.
88+ configuration: python:mailman.config.exim4
89+
90+For further information about these settings, see
91+``mailman/config/schema.cfg``.
92+
93+Exim4 configuration
94+-------------------
95+
96+The configuration presented below is mostly boilerplate that allows Exim
97+to automatically discover your list addresses, and route both posts and
98+administrative messages to the right Mailman services. For this reason,
99+the mailman.mta.exim4 module ends up with all methods being no-ops.
100+
101+This configuration is field-tested in a Debian "conf.d"-style Exim
102+installation, with multiple configuration files that are assembled by a
103+Debian-specific script. If your Exim v4 installation is structured
104+differently, ignore the comments indicating location in the Debian
105+installation.
106+::
107+
108+ # /etc/exim4/conf.d/main/25_mm3_macros
109+ # The colon-separated list of domains served by Mailman.
110+ domainlist mm_domains=list.example.net
111+
112+ MM3_LMTP_PORT=8024
113+
114+ # Assuming a typical source installation in /usr/local, with
115+ # links to the Mailman bin directory and so on from MM3_HOME.
116+ MM3_HOME=/usr/local/var/mailman
117+ MM3_UID=list
118+ MM3_GID=list
119+
120+ ################################################################
121+ # The configuration below is boilerplate:
122+ # you should not need to change it.
123+
124+ # The path to the list receipt (used as the required file when
125+ # matching list addresses)
126+ MM3_LISTCHK=MM3_HOME/lists/${local_part}@${domain}
127+
128+ # /etc/exim4/conf.d/main/455_mm3_router
129+ mailman3_router:
130+ driver = accept
131+ domains = +mm_domains
132+ require_files = MM3_LISTCHK
133+ local_part_suffix_optional
134+ local_part_suffix = -admin : \
135+ -bounces : -bounces+* : \
136+ -confirm : -confirm+* : \
137+ -join : -leave : \
138+ -owner : -request : \
139+ -subscribe : -unsubscribe
140+ transport = mailman3_transport
141+
142+ # /etc/exim4/conf.d/main/55_mm3_transport
143+ mailman3_transport:
144+ driver = smtp
145+ protocol = lmtp
146+ allow_localhost
147+ hosts = localhost
148+ port = MM3_LMTP_PORT
149+
150+Troubleshooting
151+---------------
152+
153+The most likely causes of failure to deliver to Mailman are typos in the
154+configuration, and errors in the ``MM3_HOME`` macro or the
155+``mm_domains`` list. Mismatches in the LMTP port could be a cause.
156+Finally, Exim's router configuration is order-sensitive. Especially if
157+you are being tricky and supporting Mailman 2 and Mailman 3 at the same
158+time, you could have one shadow the other.
159+
160+Exim 4 documentation
161+--------------------
162+
163+There is `copious documentation for Exim`_. The parts most relevant to
164+configuring communication with Mailman 3 are the chapters on the `accept
165+router`_ and the `LMTP transport`_. Unless you are already familiar
166+with Exim configuration, you probably want to start with the chapter on
167+`how Exim receives and delivers mail`.
168+
169+.. _`Exim 4`: http://www.exim.org/
170+.. _`University of Cambridge`: http://www.cam.ac.uk/
171+.. _`copious documentation for Exim`: http://www.exim.org/docs.html
172+.. _`accept router`: http://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_accept_router.html
173+.. _`LMTP transport`: http://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_lmtp_transport.html
174+.. _`how Exim receives and delivers mail`: http://www.exim.org/exim-html-current/doc/html/spec_html/ch-how_exim_receives_and_delivers_mail.html
175+
176
177
178 Sendmail
179
180=== added file 'src/mailman/mta/exim4.py'
181--- src/mailman/mta/exim4.py 1970-01-01 00:00:00 +0000
182+++ src/mailman/mta/exim4.py 2013-09-24 17:30:07 +0000
183@@ -0,0 +1,50 @@
184+# Copyright (C) 2001-2013 by the Free Software Foundation, Inc.
185+#
186+# This file is part of GNU Mailman.
187+#
188+# GNU Mailman is free software: you can redistribute it and/or modify it under
189+# the terms of the GNU General Public License as published by the Free
190+# Software Foundation, either version 3 of the License, or (at your option)
191+# any later version.
192+#
193+# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT
194+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
195+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
196+# more details.
197+#
198+# You should have received a copy of the GNU General Public License along with
199+# GNU Mailman. If not, see <http://www.gnu.org/licenses/>.
200+
201+"""Creation/deletion hooks for the Exim4 MTA."""
202+
203+# if needed:
204+# from __future__ import absolute_import, print_function, unicode_literals
205+
206+__metaclass__ = type
207+__all__ = [
208+ 'LMTP',
209+ ]
210+
211+from zope.interface import implementer
212+from mailman.interfaces.mta import IMailTransportAgentLifecycle
213+
214+
215+
216
217+@implementer(IMailTransportAgentLifecycle)
218+class LMTP:
219+ """Connect Mailman to Exim4 via LMTP.
220+
221+ See `IMailTransportAgentLifecycle`."""
222+
223+ # Exim4 handles all configuration itself, by finding the list config file.
224+ def __init__(self):
225+ pass
226+
227+ def create(self, mlist):
228+ pass
229+
230+ delete = create
231+
232+ def regenerate(self, directory=None):
233+ """See `IMailTransportAgentLifecycle`."""
234+ pass