Hello!

At work I have the following real-world postfix setup:

    mydomain = redoaksw.com
    mydestination = local.redoaksw.com # note that this domain doesn't exist
    virtual_mailbox_domains = redoaksw.com

I installed mailman and created the list '[EMAIL PROTECTED]'.  So far
so good, however the "virtual-mailman" alias map mailman generates
does not work.

The problem is as follows :
    1)  the map contains entries such as
            [EMAIL PROTECTED]    test1
    2)  postfix converts "[EMAIL PROTECTED]" to "test1" as it should,
            and then qualifies the address with $mydomain,
            [EMAIL PROTECTED]
            (note: this does not actually create a loop)
    3)  with the address [EMAIL PROTECTED], postfix hands the message
            to virtual(8) which looks in the virtual_mailbox_maps and
            correctly reports no such user

The solution is simple -- change the map to:
            [EMAIL PROTECTED]    [EMAIL PROTECTED]

In this scenario, after the virtual_alias_map rewriting, postfix will
hand the message to local(8) which will find the mailman command in
$alias_maps.


To this end I created the attached patch to mailman.  It WorksForMe,
but is not yet complete enough to include in the next release.  I need
some assistance in polishing it for inclusion.  The core of the patch
is simply to optionally fully-qualify the map value in _addvirtual()
in Mailman/MTA/Postfix.py.

The parts I need help with are :
    
    +  What are good names for the parameters (in mm_cfg.py and the
        mail list object)?  I'm not convinced you want to be stuck
        with the names in my patch forever :-).

    +  How do you handle additional parameters on maillist objects?  I
        noted that __getattr__ fails when the web interface tries to
        load the current value from a list created before the
        parameter was added.

    + Should the default value for 'local_domain' (as it is currently
        called in my patch) be '' or None?  I would generally choose
        None, but that seems to not play well with the web interface
        (it shows "None" instead of nothing).

    + Do I need to do anything with any translation files with regards
        to the new list parameter?

-D

-- 
One OS to rule them all, one OS to find them,
One OS to bring them all and in the darkness bind them,
In the Land of Redmond, where the Shadows lie.
 
www: http://dman13.dyndns.org/~dman/            jabber: [EMAIL PROTECTED]
Index: Mailman/Defaults.py.in
===================================================================
RCS file: /cvsroot/mailman/mailman/Mailman/Defaults.py.in,v
retrieving revision 2.129
diff -U3 -r2.129 Defaults.py.in
--- Mailman/Defaults.py.in      10 Oct 2003 04:21:45 -0000      2.129
+++ Mailman/Defaults.py.in      24 Mar 2005 01:05:45 -0000
@@ -377,6 +377,13 @@
 # of the mailing lists.  See README.POSTFIX for details.
 POSTFIX_STYLE_VIRTUAL_DOMAINS = []
 
+# Set this if you want the virtual-mailman alias map to specify a domain
+# for the map values.  This is essential if, for example, your $mydomain is
+# a virtual domain.  If set, the list's 'local_domain' field will be used,
+# otherise POSTFIX_FQ_VIRTUAL_ALIAS_DOMAIN will be used.
+POSTFIX_FQ_VIRTUAL_ALIAS = False
+POSTFIX_FQ_VIRTUAL_ALIAS_DOMAIN = ''
+
 # These variables describe the program to use for regenerating the aliases.db
 # and virtual-mailman.db files, respectively, from the associated plain text
 # files.  The file being updated will be appended to this string (with a
Index: Mailman/MailList.py
===================================================================
RCS file: /cvsroot/mailman/mailman/Mailman/MailList.py,v
retrieving revision 2.110
diff -U3 -r2.110 MailList.py
--- Mailman/MailList.py 10 Oct 2003 04:08:27 -0000      2.110
+++ Mailman/MailList.py 24 Mar 2005 01:05:46 -0000
@@ -293,6 +293,7 @@
         # See the note in Defaults.py concerning DEFAULT_HOST_NAME
         # vs. DEFAULT_EMAIL_HOST.
         self.host_name = mm_cfg.DEFAULT_HOST_NAME or mm_cfg.DEFAULT_EMAIL_HOST
+        self.local_domain = None
         self.web_page_url = (
             mm_cfg.DEFAULT_URL or
             mm_cfg.DEFAULT_URL_PATTERN % mm_cfg.DEFAULT_URL_HOST)
Index: Mailman/Gui/General.py
===================================================================
RCS file: /cvsroot/mailman/mailman/Mailman/Gui/General.py,v
retrieving revision 2.22
diff -U3 -r2.22 General.py
--- Mailman/Gui/General.py      11 Dec 2002 12:41:56 -0000      2.22
+++ Mailman/Gui/General.py      24 Mar 2005 01:05:46 -0000
@@ -365,6 +365,16 @@
              useful for selecting among alternative names of a host that has
              multiple addresses.""")),
 
+            ('local_domain', mm_cfg.Host, WIDTH, 0,
+             _('Domain name for rhs-value in postfix virtual aliases.'),
+
+             _("""The "local_domain" is the domain name to use in the value
+             of the generated virtual alias map for postfix.  This must be
+             a domain listed in postfix' $mydestination parameter.  This
+             setting is essential if your $mydomain domain is a virtual
+             domain.  Note that this value is only used if MTA="Postfix"
+             and POSTFIX_FQ_VIRTUAL_ALIAS=True.""")),
+
           ]
 
         if mm_cfg.ALLOW_RFC2369_OVERRIDES:
Index: Mailman/MTA/Postfix.py
===================================================================
RCS file: /cvsroot/mailman/mailman/Mailman/MTA/Postfix.py,v
retrieving revision 2.22
diff -U3 -r2.22 Postfix.py
--- Mailman/MTA/Postfix.py      14 Sep 2003 04:41:32 -0000      2.22
+++ Mailman/MTA/Postfix.py      24 Mar 2005 01:05:46 -0000
@@ -143,11 +143,21 @@
     # The text file entries get a little extra info
     print >> fp, '# STANZA START:', listname
     print >> fp, '# CREATED:', time.ctime(time.time())
+
+    if mm_cfg.POSTFIX_FQ_VIRTUAL_ALIAS :
+        if hasattr(mlist, 'local_domain') and mlist.local_domain is not None :
+            local_domain = '@' + mlist.local_domain
+        else :
+            local_domain = '@' + mm_cfg.POSTFIX_FQ_VIRTUAL_ALIAS_DOMAIN
+    else :
+        # let postfix decide what domain to append by omitting it from the map
+        local_domain = ''
+
     # Now add all the standard alias entries
     for k, v in makealiases(listname):
         fqdnaddr = '[EMAIL PROTECTED]' % (k, hostname)
         # Format the text file nicely
-        print >> fp, fqdnaddr, ((fieldsz - len(k)) * ' '), k
+        print >> fp, fqdnaddr, ((fieldsz - len(k)) * ' '), k+local_domain
     # Finish the text file stanza
     print >> fp, '# STANZA END:', listname
     print >> fp

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Mailman-Developers mailing list
Mailman-Developers@python.org
http://mail.python.org/mailman/listinfo/mailman-developers
Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-developers/archive%40jab.org

Security Policy: 
http://www.python.org/cgi-bin/faqw-mm.py?req=show&file=faq01.027.htp

Reply via email to