spamassassin-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frantisek Rysanek" <Frantisek.Rysa...@post.cz>
Subject Debian 8: Postfix -> amavisd-new -> spamassassin -> Bayes : not scanning?
Date Sun, 09 Jul 2017 21:40:44 GMT
Dear polite people in the SA users' mailing list,

I would appreciate any help with the following setup.
For the record, I'm sending this same text to the 
debian-users mailing list - I'm not technically
cross-posting, as that would probably earn me a bad
reputation (or a kick).

I've just built a new mailserver based on Debian 8.8,
with Postfix + Cyrus. I have a long history of using
Amavis with SpamAssassin for SPAM filtering.
On the newly installed machine, there is 
SpamAssassin 3.4.0-6 = the current version for Jessie.

And within SpamAssassin, my previous server (based on
Debian Squeeze) was using the Bayesian filter.
Using 
  sa-learn --backup 
  sa-learn --restore=...
I have migrated the Bayes database to the new machine,
and after a few path tweaks and privilege adjustments,
I got sa-learn-cyrus to do its job.

Curiously to me, I don't see any BAYES scores
in the X-Spam-Status header. I suspect that the Bayes
plugin does not actually get called to evaluate
the messages passing through my server.

In /etc/spamassassin/local.cf, I have the following:
use_bayes 1
bayes_auto_learn 1
bayes_path /var/lib/spamassassin/.spamassassin/bayes
...a couple of whitelist_from rules, and 
add_header all Report _REPORT_


In /etc/amavis/conf.d/15-content_filter_mode, I have UNcommented 
this:

@bypass_spam_checks_maps = (
   \%bypass_spam_checks, \@bypass_spam_checks_acl, 
\$bypass_spam_checks_re);


In /etc/amavis/conf.d/50-user , I have the following:

$DO_SYSLOG = 0;
$LOGFILE = "/var/log/amavis.log";
$sa_tag_level_deflt = -9999; # always add spam info headers

$log_level = 1;
$sa_debug = 1;

I've also tried log_level = 2, which showed me a privilege problem,
where the SA's Bayes plugin couldn't create a lock file... so that's
handled too. I'm getting *some* notes about the Bayes plugin
in the amavis log:

Jul  9 21:25:54 mail.x.y.z /usr/sbin/amavisd-new[8868]: (08868-01) SA 
dbg: bayes: tie-ing to DB file R/O 
/var/lib/spamassassin/.spamassassin/bayes_toks
Jul  9 21:25:54 mail.x.y.z /usr/sbin/amavisd-new[8868]: (08868-01) SA 
dbg: bayes: tie-ing to DB file R/O 
/var/lib/spamassassin/.spamassassin/bayes_seen
Jul  9 21:25:54 mail.x.y.z /usr/sbin/amavisd-new[8868]: (08868-01) SA 
dbg: bayes: found bayes db version 3
Jul  9 21:25:55 mail /usr/sbin/amavisd-new[8868]: (08868-01) SA dbg: 
plugin: Mail::SpamAssassin::Plugin::Bayes=HASH(0x6bc65b0) implements 
'learn_message', priority 0
Jul  9 21:25:55 mail.x.y.z /usr/sbin/amavisd-new[8868]: (08868-01) SA 
dbg: locker: safe_lock: created 
/var/lib/spamassassin/.spamassassin/bayes.lock.mail.fccps.cz.8868
Jul  9 21:25:55 mail.x.y.z /usr/sbin/amavisd-new[8868]: (08868-01) SA 
dbg: locker: safe_lock: trying to get lock on 
/var/lib/spamassassin/.spamassassin/bayes with 0 retries
Jul  9 21:25:55 mail.x.y.z /usr/sbin/amavisd-new[8868]: (08868-01) SA 
dbg: locker: safe_lock: link to 
/var/lib/spamassassin/.spamassassin/bayes.lock: link ok
Jul  9 21:25:55 mail.x.y.z /usr/sbin/amavisd-new[8868]: (08868-01) SA 
dbg: bayes: tie-ing to DB file R/W 
/var/lib/spamassassin/.spamassassin/bayes_toks
Jul  9 21:25:55 mail.x.y.z /usr/sbin/amavisd-new[8868]: (08868-01) SA 
dbg: bayes: tie-ing to DB file R/W 
/var/lib/spamassassin/.spamassassin/bayes_seen
Jul  9 21:25:55 mail.x.y.z /usr/sbin/amavisd-new[8868]: (08868-01) SA 
dbg: bayes: found bayes db version 3
Jul  9 21:25:55 mail.x.y.z /usr/sbin/amavisd-new[8868]: (08868-01) SA 
dbg: bayes: learned 
'd963c4a7f11e91c3bd3317ea92408c2013c99dad@sa_generated', atime: 
1499628354
Jul  9 21:25:55 mail.x.y.z /usr/sbin/amavisd-new[8868]: (08868-01) SA 
dbg: bayes: untie-ing
Jul  9 21:25:55 mail.x.y.z /usr/sbin/amavisd-new[8868]: (08868-01) SA 
dbg: bayes: files locked, now unlocking lock
Jul  9 21:25:55 mail.x.y.z /usr/sbin/amavisd-new[8868]: (08868-01) SA 
dbg: locker: safe_unlock: unlink 
/var/lib/spamassassin/.spamassassin/bayes.lock


Makes me wonder if the "implements" messages can mean something (no 
"scan" operation?):


Jul  9 21:25:21 mail.x.y.z /usr/sbin/amavisd-new[8850]: SA dbg: 
plugin: Mail::SpamAssassin::Plugin::Bayes=HASH(0x6bc65b0) implements 
'learner_new', priority 0
Jul  9 21:25:21 mail.x.y.z /usr/sbin/amavisd-new[8850]: SA dbg: 
plugin: Mail::SpamAssassin::Plugin::Bayes=HASH(0x6bc65b0) implements 
'learner_is_scan_available', priority 0
Jul  9 21:25:22 mail.x.y.z /usr/sbin/amavisd-new[8850]: SA dbg: 
plugin: Mail::SpamAssassin::Plugin::Bayes=HASH(0x6bc65b0) implements 
'learner_close', priority 0
Jul  9 21:25:22 mail.x.y.z /usr/sbin/amavisd-new[8850]: SA dbg: 
plugin: Mail::SpamAssassin::Plugin::Bayes=HASH(0x6bc65b0) implements 
'prefork_init', priority 0
Jul  9 21:25:22 mail.x.y.z /usr/sbin/amavisd-new[8868]: SA dbg: 
plugin: Mail::SpamAssassin::Plugin::Bayes=HASH(0x6bc65b0) implements 
'spamd_child_init', priority 0
Jul  9 21:25:22 mail.x.y.z /usr/sbin/amavisd-new[8869]: SA dbg: 
plugin: Mail::SpamAssassin::Plugin::Bayes=HASH(0x6bc65b0) implements 
'spamd_child_init', priority 0
Jul  9 21:25:55 mail.x.y.z /usr/sbin/amavisd-new[8868]: (08868-01) SA 
dbg: plugin: Mail::SpamAssassin::Plugin::Bayes=HASH(0x6bc65b0) 
implements 'learn_message', priority 0


But looking into the PluginHandler.pm, these messages possibly 
point to some "unexpected" sub names. Perhaps the "check"
sub is just "too common to be worth mentioning"...


In /usr/share/perl5/Mail/SpamAssassin/Plugin/Bayes.pm, 
in the check_bayes() subroutine, I have added a debug message,
to see if that sub gets called at all:

sub check_bayes {
  my ($self, $pms, $fulltext, $min, $max) = @_;
  dbg("bayes: check_bayes() called");

And the result is... no it doesn't get called.
The message doesn't get logged.
Nor do I see messages from the scan() sub,
which should report a score into the log,
with $sa_debug = 1;


Unfortunately, I don't have the ... grey matter to
follow the "call stack" up towards Amavis, to see 
exactly where the Bayes check gets avoided.
Too many indirections for my lay brain :-)

Any help would be much appreciated.

Frank Rysanek


Mime
View raw message