amavisd-new doesn't seem to get autolearn= portion of the X-Spam-Status header from spamassassin
I've been trying to get Amavis to report if the mail it's checking has been auto learned by SpamAssassin, however the Amavis X-Spam-Status header seems to make no reference to it. This result is rather important to me as I would like to script sa-learn so users can use dump folders on IMAP for mail which hasn't been, or has been incorrectly learned by SA.
I'm running these versions on a fresh install of Hardy:
amavisd-new:
Installed: 1:2.5.3-1ubuntu3
Candidate: 1:2.5.3-1ubuntu3
Version table:
*** 1:2.5.3-1ubuntu3 0
500 http://
100 /var/lib/
spamassassin:
Installed: 3.2.4-1ubuntu1
Candidate: 3.2.4-1ubuntu1
Version table:
*** 3.2.4-1ubuntu1 0
500 http://
100 /var/lib/
Here is what I'm getting:
X-Spam-Status: No, score=-1.927 tagged_above=-9999 required=6.31
tests=[AWL=0.673, BAYES_00=-2.599, SPF_PASS=-0.001]
Here is what I want (from the old mail server):
X-Spam-Status: not spam, SpamAssassin (score=-0.803, required 6,
According to all the docs I've read on Amavis/SA, Amavis doesn't alter the return values of the test results from SA.
From running Amavis in SA debug mode, I get this:
[28443] dbg: learn: auto-learn: currently using scoreset 3, recomputing score based on scoreset 1
[28443] dbg: learn: auto-learn: message score: -3.25358685446009, computed score for autolearn: 0
[28443] dbg: learn: auto-learn? ham=1, spam=6, body-points=0, head-points=0, learned-
[28443] dbg: learn: auto-learn? yes, ham (0 < 1)
[28443] dbg: learn: initializing learner
[28443] dbg: learn: learning ham
[28443] dbg: bayes: tie-ing to DB file R/W /var/lib/
[28443] dbg: bayes: tie-ing to DB file R/W /var/lib/
[28443] dbg: bayes: found bayes db version 3
[28443] dbg: bayes: learned '9e0024004b5cce
[28443] dbg: bayes: untie-ing
[28443] dbg: bayes: files locked, now unlocking lock
[28443] dbg: learn: initializing learner
[28443] dbg: check: is spam? score=-3.254 required=5
[28443] dbg: check: tests=AWL,
[28443] dbg: check: subtests=
So SA seems to be doing the autolearn as expected.
Here are my config files:
Amavis 50-user:
use strict;
#
# Place your configuration directives here. They will override those in
# earlier files.
#
# See /usr/share/
# the directives you can use in this file
#
$unfreeze = ['unfreeze', 'freeze -d', 'melt', 'fcat']; #disabled (non-free, no security support)
$unrar = ['rar', 'unrar']; #disabled (non-free, no security support)
$lha = 'lha'; #disabled (non-free, no security support)
$myhostname = "windy.skanes.ca";
$final_spam_destiny = D_DISCARD;
$X_HEADER_LINE = "Ubuntu $myproduct_name at $mydomain";
$sa_tag_level_deflt = -9999;
$sa_kill_
$sa_dsn_
$sa_auto_whitelist = 1;
$sa_spam_
#
# Debugging settings
#
$sa_debug = '1,bayes,learn';
$log_level = 5;
$LOGFILE = "$MYHOME/
$DEBUG=1;
#
#------------ Do not modify anything below this line -------------
1; # ensure a defined return
SA local.cf:
# This is the right place to customize your installation of SpamAssassin.
#
# See 'perldoc Mail::SpamAssas
# tweaked.
#
# Only a small subset of options are listed below
#
#######
# Add *****SPAM***** to the Subject header of spam e-mails
#
# rewrite_header Subject *****SPAM*****
# Save spam messages as a message/rfc822 MIME attachment instead of
# modifying the original message (0: off, 2: use text/plain instead)
#
# report_safe 1
# Set which networks or hosts are considered 'trusted' by your mail
# server (i.e. not spammers)
#
# trusted_networks 212.17.35.
# Set file-locking method (flock is not safe over NFS, but is faster)
#
# lock_method flock
# Set the threshold at which a message is considered spam (default: 5.0)
#
# required_score 5.0
# Use Bayesian classifier (default: 1)
#
use_bayes 1
# Bayesian classifier auto-learning (default: 1)
#
bayes_auto_learn 1
# Set headers which may provide inappropriate cues to the Bayesian
# classifier
#
# bayes_ignore_header X-Bogosity
# bayes_ignore_header X-Spam-Flag
# bayes_ignore_header X-Spam-Status
bayes_auto_
bayes_auto_
Any help would be greatly appreciated as I have quite a busy mail server to retire.
Thanks,
Jonathan Skanes
Question information
- Language:
- English Edit question
- Status:
- Solved
- Assignee:
- No assignee Edit question
- Solved by:
- Jon Skanes
- Solved:
- 2008-07-16
- Last query:
- 2008-07-16
- Last reply:
Jon Skanes (jon-skanes) said : | #1 |
OK, so I got off my ass and did it myself :) If you're interested, use at your own risk.
Something similar might make it into 2.6.2.
Re: [AMaViS-user] autolearn= not showing in headers on autolearned messages
From:
Jonathan Skanes <email address hidden>
To:
<email address hidden>
Date:
Yesterday 18:18:02
On Monday 14 July 2008 19:49:30 Jonathan Skanes wrote:
> On Sunday 13 July 2008 01:11:04 Jonathan Skanes wrote:
> > Hi all,
> >
> > I'm using an Amavis/
> > Ubuntu Hardy. I don't see any reference to the autolearn= field in any
> > of the mail headers Amavis is generating. What am I missing?
> >
> > Here are the versions:
> >
> > amavisd-new:
> > Installed: 1:2.5.3-1ubuntu3
> > Candidate: 1:2.5.3-1ubuntu3
> > Version table:
> > *** 1:2.5.3-1ubuntu3 0
> > 500 http://
> > 100 /var/lib/
> > spamassassin:
> > Installed: 3.2.4-1ubuntu1
> > Candidate: 3.2.4-1ubuntu1
> > Version table:
> > *** 3.2.4-1ubuntu1 0
> > 500 http://
> > 100 /var/lib/
> >
>
> So I got bored and started poking around in the code. Can anyone see any
> issues with doing this?
>
I updated my changes to reflect the semantics of Spamassassin. It returns
'autolearn=
Use this at your own risk. It seems to work well for me.
Oh, and cheers to the developers, I found the code easy to read :) Feel free
to include this, with attribution, if you think others may find it useful.
--- /usr/sbin/
+++ /usr/sbin/
@@ -9833,6 +9833,7 @@
my($do_p0f) = $is_local && $os_fp ne '' &&
$allowed_hdrs && $allowed_
my($tag_level, $tag2_level, $subject_tag, $pp_age);
+ my(
if ($allowed_hdrs && $allowed_
$pp_age = $r->recip_
$pp_age = format_
@@ -9896,10 +9897,11 @@
# : 0+sprintf(
# my($bl) = !defined($boost) ? undef : 0+sprintf(
# (!defined($boost) || $bl==0 ? $sl : $bl>=0 ? $sl.'+'.$bl : $sl.$bl),
- $full_spam_status = sprintf("%s,\n score=%s\n %s%s%stests=[%s]",
+ $full_spam_status = sprintf("%s,\n score=%s\n autolearn=%s\n %s%s%stests=[%s]",
$do_tag2 ? 'Yes' : 'No',
!defined(
0+sprintf(
+
!defined $tag_level || $tag_level eq '' ? ''
: sprintf(
!defined $tag2_level ? '' : sprintf(
@@ -10428,6 +10430,7 @@
my($tag_
my($spam_level) = $msginfo-
my(@q_
+ my($autolearn_
for my $r (@{$msginfo-
my($rec) = $r->recip_addr;
my($blocking_ccat) = $r->blocking_ccat;
@@ -10515,9 +10518,10 @@
my($sl) = !defined(
my($bl) = !defined(
my($full_
- "%s,\n score=%s\n tag=%s\n tag2=%s\n kill=%s\n %stests=[%s]",
+ "%s,\n score=%s\n autolearn=%s\n tag=%s\n tag2=%s\n kill=%s\n %stests=[%s]",
$do_tag2_
(!defined(
+
(map { !defined $_ ? 'x' : 0+sprintf(
($tag_level_min, $tag2_level_min, $kill_level_min)),
join('', $blacklisted_any ? "BLACKLISTED\n " : (),
@@ -10593,7 +10597,6 @@
}
if (ll(2) && $msginfo-
# log entry compatible with older log parsers
- my($autolearn_
$s = $full_spam_status; $s =~ s/\n[ \t]/ /g;
do_log(2,"SPAM, %s -> %s, %s%s%s", $msginfo-
join(',', qquote_
-------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://
_______
AMaViS-user mailing list
<email address hidden>
https:/
AMaViS-FAQ:http://
AMaViS-HowTos:http://