You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Scott <te...@msxc.com> on 2017/08/11 03:15:48 UTC

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:
/var/spool/amavisd/.spamassassin/
New box:
/etc/mail/bayes

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 local.cf, 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:  
/etc/mail/bayes/mybayes
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: http://spamassassin.1065346.n5.nabble.com/Bayes-auto-learn-not-happening-tp138065p138267.html
Sent from the SpamAssassin - Users mailing list archive at Nabble.com.

Re: Bayes auto-learn - not happening, tentative success....

Posted by Scott <te...@msxc.com>.
Yeah, i don't know who the culprit is. sa-learn always worked. autolearn did
not. So far this am it's looking good.  An expected spread of autolearn no,
spam, and ham. Not a single unavailable. Will check this afternoon and
expect to call this done. Summary for other googlers to follow. 



--
View this message in context: http://spamassassin.1065346.n5.nabble.com/Bayes-auto-learn-not-happening-tp138065p138295.html
Sent from the SpamAssassin - Users mailing list archive at Nabble.com.

Re: Bayes auto-learn - not happening, tentative success....

Posted by RW <rw...@googlemail.com>.
On Thu, 10 Aug 2017 20:15:48 -0700 (MST)
Scott wrote:

>   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.

But sa-learn was working. It seems more likely that the difference is
between the ordinary SA scripts and amavis rather than between auto and
manual training. Amavis uses SA libraries from it's own perl code and
it's free to behave very differently.

Re: Bayes auto-learn - not happening, tentative success....

Posted by Scott <te...@msxc.com>.
Tom:
re selinux:
Yes, once I discovered the fix, I considered that could have been the casue. 
FWIW I'm not using it and it's disabled, so it *shouldn't* hose anything. 
But I would not be surprised if it were the culprit.






--
View this message in context: http://spamassassin.1065346.n5.nabble.com/Bayes-auto-learn-not-happening-tp138065p138313.html
Sent from the SpamAssassin - Users mailing list archive at Nabble.com.

Re: Bayes auto-learn - not happening, tentative success....

Posted by Tom Hendrikx <to...@whyscream.net>.
xOn 11-08-17 17:05, Scott wrote:
> I'm going to go back and look at my build notes but I think that directory
> got created for me. It's just as possible i followed some "guide".  I am
> positive i did not think it up on my own LOL.   I remember more than set of
> instructions one with that path setting, and it very well could be the
> related Centos7 package.  Glad i found the casue though. Regardless of the
> source. 
> 
> In the FWIW department, as shown above, I still don't have it in the default
> location (I know, risks...), but why it is happy there and not under /etc I
> don't know.  And really don't care at this point.   
> 

I had to go way back in thread to look it up, but I noticed you're
running Centos, which has selinux.

Maybe your custom path is disallowed under the amavis/spamd/whatever
role? And manual testing when su'ing from the root role will not have
the same impact as running amavis using an init system.

Kind regards,
	Tom


Re: Bayes auto-learn - not happening, tentative success....

Posted by Scott <te...@msxc.com>.
I'm going to go back and look at my build notes but I think that directory
got created for me. It's just as possible i followed some "guide".  I am
positive i did not think it up on my own LOL.   I remember more than set of
instructions one with that path setting, and it very well could be the
related Centos7 package.  Glad i found the casue though. Regardless of the
source. 

In the FWIW department, as shown above, I still don't have it in the default
location (I know, risks...), but why it is happy there and not under /etc I
don't know.  And really don't care at this point.   





--
View this message in context: http://spamassassin.1065346.n5.nabble.com/Bayes-auto-learn-not-happening-tp138065p138299.html
Sent from the SpamAssassin - Users mailing list archive at Nabble.com.

Re: Bayes auto-learn - not happening, tentative success....

Posted by Matus UHLAR - fantomas <uh...@fantomas.sk>.
>On 10.08.17 20:15, Scott wrote:
>>About the only difference in my old, functioning box and this new "clean"
>>install was the location of the bayes files.
>>
>>Old box:
>>/var/spool/amavisd/.spamassassin/
>>New box:
>>/etc/mail/bayes

On 11.08.17 16:22, Matus UHLAR - fantomas wrote:
>Do did you change bayes path in first place?

I mean why, of course

[deleted]

>don't set the path, that way it should work OOTB.
-- 
Matus UHLAR - fantomas, uhlar@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
Spam is for losers who can't get business any other way.

Re: Bayes auto-learn - not happening, tentative success....

Posted by RW <rw...@googlemail.com>.
On Fri, 11 Aug 2017 16:22:50 +0200
Matus UHLAR - fantomas wrote:


> don't set the path, that way it should work OOTB.

Maybe amavis is different and has it's own internl default location, but
the equivalent for spamd relies on the packager giving the spamd user a
unix home directory.

I once saw a Bayes howto that recommended:

 mkdir  /nonexistent

Re: Bayes auto-learn - not happening, tentative success....

Posted by Matus UHLAR - fantomas <uh...@fantomas.sk>.
On 10.08.17 20:15, Scott wrote:
>About the only difference in my old, functioning box and this new "clean"
>install was the location of the bayes files.
>
>Old box:
>/var/spool/amavisd/.spamassassin/
>New box:
>/etc/mail/bayes

Do did you change bayes path in first place?

amavis is the only one who processes the database, there's no need to change
it and play with permissions (which might be the reason why it does not
work).

you can still train as root:

sa-learn --dbpath /var/spool/amavis/.spamassassin/  ...

>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

don't set the path, that way it should work OOTB.


-- 
Matus UHLAR - fantomas, uhlar@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
The only substitute for good manners is fast reflexes.