[Pkg-mailman-hackers] Bug#439327: more settings relating to SpamAssassin
martin f krafft
madduck at debian.org
Fri Aug 24 08:31:02 UTC 2007
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
mylist at lists.mydomain.org 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 <madduck at debian.org>
: :' : 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature (see http://martin-krafft.net/gpg/)
Url : http://lists.alioth.debian.org/pipermail/pkg-mailman-hackers/attachments/20070824/4c0eff16/attachment.pgp
More information about the Pkg-mailman-hackers
mailing list