Differences between revisions 2 and 10 (spanning 8 versions)
Revision 2 as of 2008-12-19 11:08:58
Size: 3026
Editor: fmouse
Comment:
Revision 10 as of 2017-02-21 05:19:21
Size: 3994
Editor: msapiro
Comment: Fixed post 2.1.21 SpamAssassin.py patch.
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
#pragma page-filename DOC/versions/7372829 #pragma page-filename DOC/versions/4030589
Line 3: Line 3:
Line 7: Line 8:
2. Add "GLOBAL_PIPELINE.insert(1, 'SpamAssassin')" to your mm_cfg.py file. See [[http://www.jamesh.id.au/articles/mailman-spamassassin/]]. <<Verbatim([)>>see note below<<Verbatim(])>> 2. Add "GLOBAL_PIPELINE.insert(1, '!SpamAssassin')" to your mm_cfg.py file. See [[http://www.jamesh.id.au/articles/mailman-spamassassin/]]. [see note below]
Line 11: Line 12:
From a post to the mailman-users list by Dave Stern <dave@umiacs.umd.edu> on 26 Feb 2003. Editted to use default paths. Editted to use better procmail rules. From a post to the mailman-users list by Dave Stern <<MailTo(dave AT umiacs DOT umd DOT edu)>> on 26 Feb 2003. Edited to use default paths. Edited to use better procmail rules.
Line 13: Line 14:
Note that as of&nbsp; Dec 19, 2008,  James Henstridge's solution (method #2 above), is out of date when used with recent versions (>=2.1.10) of Mailman.&nbsp; The following Patch to Henstridge's SpamAssassin.py may be required. Note that as of  Dec 19, 2008, James Henstridge's solution (method #2 above), is out of date when used with recent versions (>=2.1.10) of Mailman.  The following Patch to Henstridge's !SpamAssassin.py may be required.
Line 16: Line 17:
   * SpamAssassin-2.py 2008-12-16 18:44:15.000000000 -0600 --- SpamAssassin.py 2008-12-16 18:44:15.000000000 -0600
Line 22: Line 23:

* matches_p(sender, mlist.accept_these_nonmembers):
-                   matches_p(sender, mlist.accept_these_nonmembers):
Line 28: Line 28:
   }}}
And beginning with Mailman 2.1.21, the following patch is required instead of the above.
{{{
--- SpamAssassin.py 2004-06-13 00:25:58.000000000 -0700
+++ SpamAssassin-fixed.py 2017-02-20 21:20:19.173188900 -0800
@@ -28,7 +28,6 @@
 from Mailman import Errors
 from Mailman.Logging.Syslog import syslog
 from Mailman.Handlers import Hold
-from Mailman.Handlers.Moderate import matches_p
 
 SPAMD_HOST = getattr(mm_cfg, 'SPAMASSASSIN_HOST', '')
 DISCARD_SCORE = getattr(mm_cfg, 'SPAMASSASSIN_DISCARD_SCORE', 10)
@@ -78,7 +77,10 @@
     if MEMBER_BONUS != 0:
         for sender in msg.get_senders():
             if mlist.isMember(sender) or \
- matches_p(sender, mlist.accept_these_nonmembers):
+ mlist.GetPattern(sender,
+ mlist.accept_these_nonmembers,
+ at_list='accept_these_nonmembers'
+ ):
                 score -= MEMBER_BONUS
                 break
 
Line 31: Line 59:
Line 33: Line 62:
==== add to you aliases file ==== ==== add to your aliases file ====
Line 41: Line 71:
==== /etc/procmailrc include things like ==== ==== in file /etc/procmailrc include things like ====
Line 47: Line 78:

 
* ^X-Spam-Status: Yes
 * ^X-Spam-Status: Yes
Line 52: Line 82:

 
* ^TO_mylist@domain.com
 * ^TO_mylist@domain.com
Line 57: Line 86:

 
* ^TO_mylist2@domain.com
 * ^TO_mylist2@domain.com
Line 63: Line 91:
The second method will work with any version of mailman giving the wrapper call is correct. For mailman 2.0 /etc/smrsh/wrapper
The second method will work with any version of mailman given that the wrapper call is correct. For mailman 2.0 /etc/smrsh/wrapper
Line 73: Line 102:
''Last changed on Fri Jan 25 00:19:57 2008 by'' jidanni
<<Color2(
Converted from the Mailman FAQ Wizard, col=darkgreen)>>This is one of many [[../Frequently Asked Questions|Frequently Asked Questions]].
Converted from the Mailman FAQ Wizard

This is one of many [[../Frequently Asked Questions|Frequently Asked Questions]].

4.23. How do I use SpamAssassin with Mailman?

There are 3 ways.

1. Integrate it into the MTA, such as described in FAQ entry 6.12 at Mailman + postfix + amavisd-new HOWTO (anti-spam).

2. Add "GLOBAL_PIPELINE.insert(1, 'SpamAssassin')" to your mm_cfg.py file. See http://www.jamesh.id.au/articles/mailman-spamassassin/. [see note below]

3. Using procmail to execute spamassassin before handing the message to mailman. (see rest of FAQ entry).

From a post to the mailman-users list by Dave Stern <dave AT umiacs DOT umd DOT edu> on 26 Feb 2003. Edited to use default paths. Edited to use better procmail rules.

Note that as of  Dec 19, 2008, James Henstridge's solution (method #2 above), is out of date when used with recent versions (>=2.1.10) of Mailman.  The following Patch to Henstridge's SpamAssassin.py may be required.

--- SpamAssassin.py     2008-12-16 18:44:15.000000000 -0600
+++ SpamAssassin-fixed.py       2008-12-16 18:49:23.000000000 -0600
@@ -78,7 +78,8 @@
     if MEMBER_BONUS != 0:
         for sender in msg.get_senders():
             if mlist.isMember(sender) or \
-                   matches_p(sender, mlist.accept_these_nonmembers):
+                   matches_p(sender, mlist.accept_these_nonmembers,
+                   mlist.internal_name()):
                 score -= MEMBER_BONUS
                 break
 

And beginning with Mailman 2.1.21, the following patch is required instead of the above.

--- SpamAssassin.py     2004-06-13 00:25:58.000000000 -0700
+++ SpamAssassin-fixed.py       2017-02-20 21:20:19.173188900 -0800
@@ -28,7 +28,6 @@
 from Mailman import Errors
 from Mailman.Logging.Syslog import syslog
 from Mailman.Handlers import Hold
-from Mailman.Handlers.Moderate import matches_p
 
 SPAMD_HOST    = getattr(mm_cfg, 'SPAMASSASSIN_HOST', '')
 DISCARD_SCORE = getattr(mm_cfg, 'SPAMASSASSIN_DISCARD_SCORE', 10)
@@ -78,7 +77,10 @@
     if MEMBER_BONUS != 0:
         for sender in msg.get_senders():
             if mlist.isMember(sender) or \
-                   matches_p(sender, mlist.accept_these_nonmembers):
+                   mlist.GetPattern(sender,
+                                    mlist.accept_these_nonmembers,
+                                    at_list='accept_these_nonmembers'
+                                   ):
                 score -= MEMBER_BONUS
                 break
 

Begin Message

Seeing how others have asked about this, I've gotten an older version of mailman (2.0.12) and spamassassin (2.1) working together. Let's say we have two lists, one called mylst, the other mylist2:

add to your aliases file

  mylist:     "/usr/bin/procmail -m /etc/procmailrc"
  mylist2:    "/usr/bin/procmail -m /etc/procmailrc"

Note: procmail will need to be in your smrsh directory.

in file /etc/procmailrc include things like

:0f
 | /usr/bin/spamassassin

 :0:
 * ^X-Spam-Status: Yes
 /tmp/Likelyspam

 :0
 * ^TO_mylist@domain.com
 |/etc/smrsh/wrapper post mylist

 :0
 * ^TO_mylist2@domain.com
 |/etc/smrsh/wrapper post mylist2

End Message

The second method will work with any version of mailman given that the wrapper call is correct. For mailman 2.0 /etc/smrsh/wrapper

For mailman 2.1 /etc/smrsh/mailman

Under Debian, relplace /etc/smrsh with /var/lib/mailman/mail or possibly /etc/mail/smrsh depending on your sendmail config.

Q: What if one does not have command line access to mailman, can one still use spamassassin with mailman?

A: Yes but you would probably have to set up a pretty fancy forwarding scheme. Moderated messages getting forwarded to an administrator whose .procmailrc sent them to spamassassin...

Converted from the Mailman FAQ Wizard

This is one of many Frequently Asked Questions.

MailmanWiki: DOC/4.23 How do I use SpamAssassin with Mailman? (last edited 2017-02-21 05:19:21 by msapiro)