Package: mailman
Version: 2.1.9-7
Severity: wishlist
Tags: patch
The following patch adds a few settings to Mailman's SA handler. For mm_cfg.py:
#-------------------------------------------------------------
# Uncomment if you want to filter all mail through SA as a
# single user. If unset, the list's internal_name is used.
#SPAMASSASSIN_CONNECT_USER = 'list'
#-------------------------------------------------------------
# Uncomment if the user connecting to SA should include the
# FQDN. If necessary, the list's host_name is appended.
#SPAMASSASSIN_FQDN_USER = Yes
#-------------------------------------------------------------
# Uncomment to connect to a spamd instance on a different
# port than the default (783). You can also specify
# SPAMASSASSIN_HOST in hostname:port format, but in case you don't
# want to set the hostname (and use the default), this allows you to
# just override the port.
#SPAMASSASSIN_PORT = 784
I needed all these because I already run a mixed virtual spamd
environment (see #387878) and can fit Mailman's SA pipe nicely by
setting SPAMASSASSIN_FQDN_USER and a different port. Now
[email protected] is fed to the postfix-to-mailman.py script
according to transport_maps, but when it comes to spamd, it's
treated as if lists.mydomain.org were virtual: spamd creates
/srv/vmail/lists.mydomain.org/mylist/.spamassassin in my case.
--- /usr/lib/mailman/Mailman/Handlers/SpamAssassin.py.orig 2007-08-24 09:56:00.663172319 +0200
+++ /usr/lib/mailman/Mailman/Handlers/SpamAssassin.py 2007-08-24 10:20:20.382441167 +0200
@@ -31,6 +31,7 @@
from Mailman.Handlers.Moderate import matches_p
SPAMD_HOST = getattr(mm_cfg, 'SPAMASSASSIN_HOST', '')
+SPAMD_PORT = getattr(mm_cfg, 'SPAMASSASSIN_PORT', 0)
DISCARD_SCORE = getattr(mm_cfg, 'SPAMASSASSIN_DISCARD_SCORE', 10)
HOLD_SCORE = getattr(mm_cfg, 'SPAMASSASSIN_HOLD_SCORE', 5)
MEMBER_BONUS = getattr(mm_cfg, 'SPAMASSASSIN_MEMBER_BONUS', 2)
@@ -55,10 +56,15 @@
'''Check a message against a SpamAssassin spamd process.
Returns a tuple of the form (score, symbols)'''
try:
- connection = spamd.SpamdConnection(SPAMD_HOST)
- # identify as the mailing list, to allow storing per-list
- # AWL and bayes databases.
- connection.addheader('User', mlist.internal_name())
+ connection = spamd.SpamdConnection(host=SPAMD_HOST, port=SPAMD_PORT)
+ # connect as a specified user, or use the mailing list name to allow
+ # per-list configs, awl, bayes.
+ user = getattr(mm_cfg, 'SPAMASSASSIN_CONNECT_USER', mlist.internal_name())
+ # should the username include the FQDN? if so, append the mailing
+ # list's hostname if needed.
+ if getattr(mm_cfg, 'SPAMASSASSIN_FQDN_USER', False) and user.find('@') < 0:
+ user += '@' + mlist.host_name
+ connection.addheader('User', user)
res = connection.check(spamd.SYMBOLS, message)
score = connection.getspamstatus()[1]
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.22-1-amd64 (SMP w/1 CPU core)
Locale: LANG=en_GB, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
--
.''`. martin f. krafft <[email protected]>
: :' : proud Debian developer, author, administrator, and user
`. `'` http://people.debian.org/~madduck - http://debiansystem.info
`- Debian - when you have better things to do than fixing systems
Debbugs is free software and licensed under the terms of the GNU General
Public License version 2. The current version can be obtained
from https://bugs.debian.org/debbugs-source/.