On 22 Jun 2015, at 21:45, Michael B Allen wrote:
On Mon, Jun 22, 2015 at 8:01 PM, Reindl Harald
<[email protected]> wrote:
[root@www .spamassassin]# pwd
/var/log/spamassassin/.spamassassin
[root@www .spamassassin]# ls -la
total 1100
drwx------ 2 spamd spamd 4096 Jun 22 19:42 .
drwx------ 3 spamd spamd 4096 Jun 7 00:41 ..
-rw------- 1 spamd spamd 45056 Jun 22 19:42 bayes_seen
-rw------- 1 spamd spamd 1290240 Jun 22 19:42 bayes_toks
-rw-r--r-- 1 spamd spamd 1869 Jun 7 00:41 user_prefs
i doubt that SA is using the bayes of root
so you just rain the wrong bayes
So with a default install (CentOS 7 in my case and I suspect pretty
much all other systems), bayes will NOT just work by default unless
you explicitly modify /etc/mail/spamassassin/local.cf to tell sa-learn
to use the bayes db owned by spamd
(/var/log/spamassassin/.spamassassin/bayes in my case) and NOT the one
owned by root?
However, I have done this:
bayes_path /var/log/spamassassin/.spamassassin/bayes
bayes_file_mode 0777
Don't do that, ever, on any regular file, on any system that has
processes running as more than just root. I know it's in the SA Wiki,
but it's an irresponsible recommendation.
and after running sa-learn again (as root) on ham, my db is now
broken:
[root@www .spamassassin]# sa-learn --dump magic
bayes: bayes db version 0 is not able to be used, aborting! at
/usr/share/perl5/vendor_perl/Mail/SpamAssassin/BayesStore/DBM.pm line
208.
bayes: bayes db version 0 is not able to be used, aborting! at
/usr/share/perl5/vendor_perl/Mail/SpamAssassin/BayesStore/DBM.pm line
208.
ERROR: Bayes dump returned an error, please re-run with -D for more
information
Can someone clue me in here?
See the last line. "sa-learn -D --dump magic" will provide deeper clues
as to the specific nature of the problem, which seems to be consistent
with trying to use a Bayes DB that isn't there or isn't readable.
I'm not certain what is breaking for SA after you've broken your system,
but since it's CentOS 7 it may be that SELinux is backstopping the 777
insanity. I'm unwilling to replicate the mistake to replicate the
error...
The FIRST step is to undo the breakage you directly inflicted, since
your system seems to have been working normally before, running in an
initial learning mode (i.e. without enough learned to use Bayes for
scoring).
Everything is installed as user / group spamd and postfix is set to
call spamassassin with user=spamd. And I assume I must run sa-learn as
root so that it can access Maildir directories and that bayes_path
tells sa-learn where the db is. So now what's the problem?
Wrong assumption.
The sa-learn program is for anyone to manually work with their own Bayes
DB, including for the owner of a system-wide Bayes DB to work with that
Bayes DB. If you have a system-wide Bayes DB, it should be fed by either
a system-wide filtering mechanism operating as part of the delivery
process and running as the owner of the global DB or by users running
the spamc client under their own ids to feed a spamd daemon running as
the owner of the global DB or by a combination of the two. The CentOS 7
package installs spamd and spamc, and if you want to learn
already-delivered mail into a global BayesDB, those are the tools to
use.