Hi everyone,

I think I've got everything set up correctly for postfix + spamassassin
spam filtering, but I'm not getting any BAYES_ tags in the emails I am
receiving.  I'd appreciate any help you can give me.  Thanks in advance.

I'm running Ubuntu Dapper.

I've set up postfix to call spamassassin:

[EMAIL PROTECTED]:/home/andy$ cat /etc/postfix/master.cf
<snip>
smtp      inet  n       -       -       -       -       smtpd
        -o content_filter=spamassassin
<snip>
spamassassin unix -     n       n       -       -       pipe
        user=spamd argv=/usr/bin/spamc -f -e
        /usr/sbin/sendmail -oi -f ${sender} ${recipient}

and I've enabled bayes in spamassassin:

[EMAIL PROTECTED]:/home/andy$ cat /etc/spamassassin/local.cf
<snip>
use_bayes 1
use_bayes_rules 1
bayes_file_mode 0770
bayes_path /etc/spamassassin/bayes
<snip>

spamd is running as the user spamd:

[EMAIL PROTECTED]:/home/andy$ ps -ef | grep spam
root      4891     1  0 16:29 ?        00:00:00 /usr/sbin/spamd
--create-prefs --max-children 5 --username spamd --helper-home-dir
/var/lib/spamassassin/ -s /var/lib/spamassassin/spamd.log -d
--pidfile=/var/lib/spamassassin/spamd.pid
spamd     4944  4891  0 16:29 ?        00:00:00 spamd child
spamd     4945  4891  0 16:29 ?        00:00:00 spamd child
andy      6246  5896  0 16:38 pts/0    00:00:00 grep spam

spamd is in the spam-reporters group:

[EMAIL PROTECTED]:/home/andy$ sudo -u spamd -s -H
[EMAIL PROTECTED]:/home/andy$ groups
spamd spam-reporters

The spam-reporters group has permissions on the bayes files:

[EMAIL PROTECTED]:/home/andy$ ls -ld /etc/spamassassin/
drwxrwxr-x 2 root spam-reporters 4096 2007-01-02 12:12 /etc/spamassassin/

[EMAIL PROTECTED]:/home/andy$ ls -l /etc/spamassassin/
total 12276
-rw-rw---- 1 root spam-reporters     1344 2007-01-03 16:42 bayes_journal
-rw-rw---- 1 root spam-reporters 10522624 2007-01-01 19:39 bayes_seen
-rw-rw---- 1 root spam-reporters  4571136 2007-01-02 12:12 bayes_toks
-rw-r--r-- 1 root root                948 2006-08-30 01:44 init.pre
-rw-r--r-- 1 root root               1536 2007-01-02 12:10 local.cf
-rw-r--r-- 1 root root               1208 2006-12-12 14:20 local.cf.orig
-rw-r--r-- 1 root root               2179 2006-08-30 01:44 v310.pre
-rw-r--r-- 1 root root                806 2006-08-30 01:44 v312.pre

spamassassin seems to think it's working - lint output looks like this
(running as user spamd):

[EMAIL PROTECTED]:/home/andy$ sudo -u spamd -s -H
[EMAIL PROTECTED]:/home/andy$ spamassassin -D --lint 2>&1 | grep bayes
[6477] dbg: config: read file /usr/share/spamassassin/23_bayes.cf
[6477] dbg: bayes: tie-ing to DB file R/O /etc/spamassassin/bayes_toks
[6477] dbg: bayes: tie-ing to DB file R/O /etc/spamassassin/bayes_seen
[6477] dbg: bayes: found bayes db version 3
[6477] dbg: bayes: DB journal sync: last sync: 0
[6477] dbg: bayes: DB journal sync: last sync: 0
[6477] dbg: bayes: corpus size: nspam = 44517, nham = 41607
[6477] dbg: bayes: score = 0.705470924420595
[6477] dbg: bayes: DB expiry: tokens in DB: 137204, Expiry max size:
150000, Oldest atime: 1166357473, Newest atime: 1167739848, Last expire:
1167739955, Current time: 1167842527
[6477] dbg: bayes: DB journal sync: last sync: 0
[6477] dbg: bayes: untie-ing
[6477] dbg: bayes: untie-ing db_toks
[6477] dbg: bayes: untie-ing db_seen

and running it on a test message seems to work (still running as user
spamd):

[EMAIL PROTECTED]:/home/andy$ sudo -u spamd -s -H
[EMAIL PROTECTED]:/home/andy$ cd Desktop/
[EMAIL PROTECTED]:/home/andy/Desktop$ spamassassin -t test.txt
X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on 10.0.1.2
X-Spam-Level:
X-Spam-Status: No, score=0.8 required=3.0 tests=BAYES_40,NO_REAL_NAME,
        NO_RECEIVED,NO_RELAYS autolearn=no version=3.1.3

and yet, when I receive real email, there are no BAYES_ tags in any of
the message headers.

Here is an excerpt from an email I sent to myself (containing the word
viagra):

X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on 10.0.1.2
X-Spam-Level: *
X-Spam-Status: No, score=1.1 required=3.0 tests=AWL,DRUGS_ERECTILE,
        SPF_HELO_SOFTFAIL autolearn=no version=3.1.3

And here from an email that scored 0:

X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on 10.0.1.2
X-Spam-Level:
X-Spam-Status: No, score=0.0 required=3.0 tests=none autolearn=failed

A potentially important data point is that autolearn always seems to be
"failed" when it is not "no".

If anyone has any ideas what is going on, please let me know.  Also, if
you need any more information, I'd be glad to provide it.

Thanks very much,

Andy

Reply via email to