You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Neil Watson <sa...@watson-wilson.ca> on 2005/03/30 16:49:49 UTC
spamassassin does not rewrite headers
I've installed Spamassassin and configured Postfix to use it as a mail filter.
The log reports show that SPAM is being reported correctly. However, header
rewrites configured in /etc/spamassassin/local.cf seem to be ignored.:
local.cf:
rewrite_header Subject ****SPAM(_SCORE_)****
report_safe 1
lock_method flock
# How many hits before a message is considered spam.
required_hits 5.0
Logfile:
Mar 27 08:05:00 ettin spamd[16687]: connection from localhost [127.0.0.1] at port 36500
Mar 27 08:05:00 ettin spamd[16687]: info: setuid to filter succeeded
Mar 27 08:05:00 ettin spamd[16687]: processing message <WF...@blackstick8.cashette.com> for filter:1004.
Mar 27 08:05:01 ettin postfix/smtpd[27914]: disconnect from gd202157043232.b21.kcn-tv.ne.jp[202.157.43.232]
Mar 27 08:05:03 ettin spamd[16687]: identified spam (11.8/5.0) for filter:1004 in 2.3 seconds, 1495 bytes.
Mar 27 08:05:03 ettin spamd[16687]: result: Y 11 - DNS_FROM_RFC_ABUSE,DNS_FROM_RFC_POST,DNS_FROM_RFC_WHOIS,HTML_20_30,HTML_MESSAGE,RCVD_IN_XBL,URIBL_OB_SURBL,URIBL_SBL,URIBL_SC_SURBL scantime=2.3,size=1495,mid=<WF...@blackstick8.cashette.com>,autolearn=no
I am using a filter as suggested by the Postfix documentation:
#!/bin/bash
# see http://www.postfix.org/FILTER_README.html for details
# Simple shell-based filter. It is meant to be invoked as follows:
# /path/to/script -f sender recipients...
# Localize these.
INSPECT_DIR=/var/spool/filter
SENDMAIL="/usr/sbin/sendmail -i"
# Exit codes from <sysexits.h>
EX_TEMPFAIL=75
EX_UNAVAILABLE=69
# Clean up when done or when aborting.
trap "rm -f in.$$" 0 1 2 3 15
# Start processing.
cd $INSPECT_DIR || {
echo $INSPECT_DIR does not exist; exit $EX_TEMPFAIL; }
cat >in.$$ || {
echo Cannot save mail to file; exit $EX_TEMPFAIL; }
# Specify your content filter here.
/usr/bin/spamc <in.$$ || {
echo Message content quarantined; cat >> /var/spool/mail/quarantine; }
$SENDMAIL "$@" <in.$$
exit $?
The mail is delivered as normal with no rewrites. What have I missed?
--
Neil Watson | Gentoo Linux
Network Administrator | Uptime 12 days
http://watson-wilson.ca | 2.6.11.4 AMD Athlon(tm) MP 2000+ x 2
Re: spamassassin does not rewrite headers
Posted by Theo Van Dinter <fe...@kluge.net>.
On Wed, Mar 30, 2005 at 09:49:49AM -0500, Neil Watson wrote:
> I am using a filter as suggested by the Postfix documentation:
[...]
> cat >in.$$ || {
> echo Cannot save mail to file; exit $EX_TEMPFAIL; }
Put the message in a file ...
> # Specify your content filter here.
> /usr/bin/spamc <in.$$ || {
> echo Message content quarantined; cat >> /var/spool/mail/quarantine; }
Send the file contents to SpamAssassin unless it's spam and then do
something with quarantine (there's nothing from STDIN at this point,
so you'll probably just hang here).
> $SENDMAIL "$@" <in.$$
Send the file contents back to postfix ...
> The mail is delivered as normal with no rewrites. What have I missed?
spamc returns the message, but you don't do anything with it. Perhaps you
want something like:
/usr/bin/spamc < in.$$ > out.$$
$SENDMAIL "$@" < out.$$
I'd also look at MailScanner or something similar instead of this script.
--
Randomly Generated Tagline:
"You can not make history, you can only hope to survive it."
- G'Kar on Babylon 5, "Rising Star"