spamassassin-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott <>
Subject Re: Bayes auto-learn - not happening - tentative success
Date Fri, 11 Aug 2017 03:31:36 GMT
 Aug 10, 2017; 10:15pm Scottonline Scott Re: Bayes auto-learn - not
happening, tentative success....

Well, here's a development...

About the only difference in my old, functioning box and this new "clean"
install was the location of the bayes files.  

Old box:
New box:

The other details that caught my attention were that on the old box, the
ONLY bayes thing that was explicitly set was the path, which was:
bayes_path /home/amavis/.spamassassin/bayes

On this (new) box, I commented out most of the bayes settings similarly.
Restarted amavis/SA and got some errors about no bayes db.  Ignored.

Sent an email anyway.  Guess what?  autolearn=ham right out of the gate, it
and created the database files.

And the very next message received was also shown as autolearn=ham.  

** that eliminates any doubt that a minimum corpus is necessary to autolearn
(whether that's a good practice is a different topic).

I cleared the db's with sa-learn --clear.  I received a new message,
autolearn=ham, again.  Result:

[root@mail2 .spamassassin]# su amavis -c 'sa-learn --dump magic'
0.000          0          3          0  non-token data: bayes db version
0.000          0          0          0  non-token data: nspam
0.000          0          1          0  non-token data: nham

[root@mail2 root]# ll /var/spool/amavisd/.spamassassin
total 28
-rw-rw-rw- 1 amavis amavis 12288 Aug 10 21:20 bayes_seen
-rw-rw-rw- 1 amavis amavis 12288 Aug 10 21:20 bayes_toks
-rw-r--r-- 1 amavis amavis  1869 Aug  8 15:32 user_prefs

I gradually restored all the bayes settings in, restarting amavis
each time, clearing the db and sending that same test message.  
Each time the result was autolearn=ham

Finally to the path setting:

I tried setting the default path, and changing the path filename suffix of
bayes to mybayes for curiosity...
bayes_path /var/spool/amavisd/.spamassassin/mybayes

Upon sending a test message, SA promptly auto-learned as ham and created the
2 new files starting with "mybayes" instead of bayes.

So changing the filename didn't hurt autolearn

Next I kept the new name and changed the folder back to where it was:  
Send a test message
This time, NO new file was created.  It apparently cannot write to it.
Permissions on mail, and on bayes are both amavis:amavis & 777.

**** autolearn=unavailable **** (As Matus expected)

Next, I log on as amavis.  cd to /etc/mail/bayes.  Create a file, edit it,
and then delete it.  User amavis CAN write there.  I verify I'm amavis, Try
to cd to some other user's folder, get "permission denied", check.  

Finally, because I don't like the hidden directory anyway, I try to move the
bayes folder from the default.  I configure the bayes path to:
bayes_path /var/spool/amavisd/bayes/bayes

Send my test message, voila, db files created, and autolearn=ham  Success!
(tentative, cautiously optimistic)

I hope I have solved the mystery.  For reasons beyond my skill set, SA will
not auto-learn to a bayes db in a folder in /etc/mail/bayes.  Regardless of
wide open permissions on everything except /etc.  And the user's confirmed
ability to write to the folder.

Bug I guess?  

SHIT! What a PITA to figure out.

I'm gonna let this cook overnight and see how it does.  Will report back.

View this message in context:
Sent from the SpamAssassin - Users mailing list archive at

View raw message