[Pkg-mailman-hackers] Pkg-mailman commit - rev 27 - in trunk/debian: . contrib

Bernd S. Brentrup bsb@haydn.debian.org
Tue, 23 Mar 2004 11:16:05 -0700


Author: bsb
Date: 2004-03-23 11:15:53 -0700 (Tue, 23 Mar 2004)
New Revision: 27

Added:
   trunk/debian/contrib/postfix-to-mailman.py
Modified:
   trunk/debian/README.Debian
   trunk/debian/changelog
   trunk/debian/rules
Log:
Adding postfix-to-mailman.py.

Modified: trunk/debian/README.Debian
===================================================================
--- trunk/debian/README.Debian	2004-03-23 12:57:30 UTC (rev 26)
+++ trunk/debian/README.Debian	2004-03-23 18:15:53 UTC (rev 27)
@@ -29,10 +29,9 @@
 You can create new lists with the newlist command (you have to add the
 aliases it needs by hand to /etc/aliases or the corresponding database
 because mailman can not know about configuration of all MTA's, but newlist 
-tells you about the alias it needs).
+tells you about the alias it needs, but see the notes on qmail and postfix
+below).
 
-Additionally you need a mailman-owner alias pointing probably to you.
-
 For users of exim: if you want to use the /etc/aliases file for mailman
 aliases, you'll need to specify a user=list line or something like that in
 the system_aliases director.
@@ -49,6 +48,10 @@
 vice versa.  This is asked by a low priority debconf question, so you
 can change it through debconf or by editing the crontab by hand.
 
+As of 2.1.4-2 a debconf question has been added allowing for
+installing only templates for languages used at your site in
+/etc/mailman (mailman/site_languages).
+
 Savannah
 --------
 Mailman now includes a savannah plugin, courtesy of Guillaume Morin.
@@ -79,6 +82,12 @@
 /usr/share/doc/mailman/examples/qmail-to-mailman.py and set it up
 according to those instructions.
 
+Postfix
+_______
+For those using postfix who are able to devote a full subdomain
+lists.doma.in for use by mailman, please see the comments in
+/usr/lib/mailman/bin/postfix-to-mailman.py.
+
 SpamAssassin
 ------------
 As of Mailman 2.1-1, Mailman includes the SpamAssassin patch from
@@ -104,4 +113,4 @@
 You must create a "mailman" list on your system, until it is added,
 mailman will not start.  (It will yell at you, so you should notice.)
 
- -- Tollef Fog Heen <tfheen@debian.org>, Sat Dec  6 14:01:20 2003
+ -- Siggy Brentrup <bsb@debian.org>, Tue Mar 23 19:08:27 2004

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2004-03-23 12:57:30 UTC (rev 26)
+++ trunk/debian/changelog	2004-03-23 18:15:53 UTC (rev 27)
@@ -27,8 +27,12 @@
     required in /etc and chattyness (bsb, closes: #232005).
   * Backed out hack in 05_config_list_member_options.dpatch since it
     breaks config_list in mm 2.1.4 (bsb, closes: #231967).
+  * Added debian/contrib/postfix-to-mailman.py installing it as
+    /usr/lib/mailman/bin/postfix-to-mailman.py (bsb).
+  * Cleaned up README.Debian removing obsolete mailman-owner alias and
+    adding a section on using postfix-to-mailman.py (bsb).
 
- -- Siggy Brentrup <bsb@debian.org>  Tue, 23 Mar 2004 12:30:01 +0100
+ -- Siggy Brentrup <bsb@debian.org>  Tue, 23 Mar 2004 19:13:30 +0100
 
 mailman (2.1.4-1) unstable; urgency=medium
 

Added: trunk/debian/contrib/postfix-to-mailman.py
===================================================================
--- trunk/debian/contrib/postfix-to-mailman.py	2004-03-23 12:57:30 UTC (rev 26)
+++ trunk/debian/contrib/postfix-to-mailman.py	2004-03-23 18:15:53 UTC (rev 27)
@@ -0,0 +1,147 @@
+#! /usr/bin/env python
+
+# $Id: postfix-to-mailman.py 8 2004-03-21 18:05:37Z bsb $
+#
+# Interface mailman to a postfix with a mailman transport. Does not require
+# the creation of _any_ aliases to connect lists to your mail system.
+#
+# Dax Kelson, dkelson@gurulabs.com, Sept 2002.
+# coverted from qmail to postfix interface
+# Jan 2003: Fixes for Mailman 2.1
+# Thanks to Simen E. Sandberg <senilix@gallerbyen.net>
+# Feb 2003: Change the suggested postfix transport to support VERP
+# Thanks to Henrique de Moraes Holschuh <henrique.holschuh@ima.sp.gov.br>
+#
+# Mar 2004: Siggy Brentrup <bsb@debian.org>
+#   downloaded from http://www.gurulabs.com/files/postfix-to-mailman-2.1.py
+#   and adopted for inclusion in the Debian Mailman package.
+#   (hi Bruce, back to the roots :-)
+#   rewritten for python >= 2.2 taking configuration from mm_cfg.py
+#
+# This script was originally qmail-to-mailman.py by:
+# Bruce Perens, bruce@perens.com, March 1999.
+# This is free software under the GNU General Public License.
+
+# This script is meant to be called as a postfix transport pipe.
+
+# It catches all mail to a virtual domain, eg "lists.example.com".  It
+# looks at the recipient for each mail message and decides if the mail
+# is addressed to a valid list or not, and bounces the message with a
+# helpful suggestion if it's not addressed to a list. It decides if it
+# is a posting, a list command, or mail to the list administrator, by
+# checking for the -admin, -owner, -request, -join, -leave, -subscribe
+# and -unsubscribe addresses. It will recognize a list as soon as the
+# list is created, there is no need to add _any_ aliases for any list.
+# It recognizes mail to postmaster, abuse and mailer-daemon, and
+# routes those mails to DEB_LISTMASTER as defined in mm_cfg.py
+
+# INSTALLATION:
+#
+# Install this file as /var/lib/mailman/bin/postfix-to-mailman.py
+#
+# To configure a virtual domain to connect to mailman, edit Postfix thusly:
+#
+# /etc/postfix/main.cf:
+#    relay_domains = ... lists.example.com
+#    transport_maps = hash:/etc/postfix/transport
+#    mailman_destination_recipient_limit = 1
+#
+# /etc/postfix/transport:
+#   lists.example.com   mailman:
+#
+# /etc/postfix/master.cf
+#    mailman unix  -       n       n       -       -       pipe
+#      flags=FR user=list 
+#      argv=/var/lib/mailman/postfix-to-mailman.py ${nexthop} ${user}
+#
+# /etc/mailman/mm_cfg.py
+#    MTA = None # No MTA alias processing required
+#    # alias for postmaster, abuse and mailer-daemon
+#    DEB_LISTMASTER = 'postmaster@example.com'
+#
+# Replace lists.example.com above with the name of the domain to be connected
+# to Mailman. Note that _all_ mail to that domain will go to Mailman, so you
+# don't want to put the name of your main domain here. Typically a virtual
+# domain lists.domain.com is used for Mailman, and domain.com for regular
+# email.
+#
+
+import sys, os
+import paths
+
+from Mailman import mm_cfg
+
+def main():
+    os.nice(5)     # Handle mailing lists at non-interactive priority.
+                   # delete this if you wish
+
+    try:
+        MailmanOwner = mm_cfg.DEB_LISTMASTER
+    except AttributeError:
+        MailmanOwner = 'postmaster@localhost'
+
+    os.chdir(os.path.join(paths.prefix, 'lists'))
+
+    try:
+        domain, local = [ a.lower() for a in sys.argv[1:] ]
+    except:
+        # This might happen if we're not using Postfix or
+        # /etc/postfix/master.cf is badly misconfigured
+        sys.stderr.write('Illegal invocation: %r\n',
+                         ' '.join(sys.argv))
+        sys.exit(1)
+
+
+    # Redirect required addresses to 
+    if local in ('postmaster', 'abuse', 'mailer-daemon'):
+        os.execv("/usr/sbin/sendmail",
+                 ("/usr/sbin/sendmail", MailmanOwner))
+        sys.exit(0)
+
+    # Assume normal posting to a mailing list
+    mlist, func = local, 'post'
+
+    # Check for control extension on local part
+    for ext in ('-admin',
+                '-owner',
+                '-request',
+                '-bounces',
+                '-confirm',
+                '-join',
+                '-leave',
+                '-subscribe',
+                '-unsubscribe',
+                ):
+        if local.endswith(ext):
+            mlist = local[:-len(ext)]
+            func  = ext[1:]
+            break
+
+    if os.path.exists(mlist):
+        mm_pgm = os.path.join(paths.prefix, 'mail', 'mailman')
+        os.execv(mm_pgm, (mm_pgm, func, mlist))
+        # NOT REACHED
+    else:
+        bounce()
+        # NOT REACHED
+
+
+def bounce():
+    """\
+TO ACCESS THE MAILING LIST SYSTEM: Start your web browser on
+  %slistinfo/
+That web page will help you subscribe or unsubscribe, and will
+give you directions on how to post to each mailing list.\n"""
+    sys.stderr.write(bounce.__doc__ % mm_cfg.DEFAULT_URL)
+    sys.exit(1)
+
+if __name__ == '__main__':
+    try:
+        main()
+    except SystemExit, argument:
+        sys.exit(argument)
+    except Exception:
+        xt, xv, tb = sys.exc_info()
+        sys.stderr.write("%s %s\n" % (xt, xv))
+        sys.stderr.write("Line %d\n" % (tb.tb_lineno))
+        sys.exit(75)       # Soft failure, try again later.


Property changes on: trunk/debian/contrib/postfix-to-mailman.py
___________________________________________________________________
Name: svn:executable
   + *

Modified: trunk/debian/rules
===================================================================
--- trunk/debian/rules	2004-03-23 12:57:30 UTC (rev 26)
+++ trunk/debian/rules	2004-03-23 18:15:53 UTC (rev 27)
@@ -151,6 +151,9 @@
 	install -m 0644 debian/contrib/SpamAssassin.py debian/mailman/usr/lib/$(package)/Mailman/Handlers
 	install -m 0644 debian/contrib/spamd.py debian/mailman/usr/lib/$(package)/Mailman/Handlers
 
+# postfix-to-mailman.py
+	install -m 0755 debian/contrib/postfix-to-mailman.py debian/mailman/usr/lib/$(package)/bin
+
 # Move templates
 	mv `find debian/mailman/etc/mailman -type d -mindepth 1 -maxdepth 1` debian/mailman/usr/share/mailman
 	cp build/contrib/qmail-to-mailman.py debian/mailman/usr/share/mailman