[prev in list] [next in list] [prev in thread] [next in thread] 

List:       spamassassin-users
Subject:    Re: getting the daily learning cronjob right
From:       Bill Shirley <bill () philly ! polymerindustries ! biz>
Date:       2015-11-25 8:07:25
Message-ID: 56556C3D.2030006 () philly ! polymerindustries ! biz
[Download RAW message or body]

I use per-user databases for unix users and virtual users on both small
and large shops.  It works pretty well.  I have two instances of spamd
running, one for unix users and the 2nd one on port 784 for virtual-users.

Mail flow is postfix > spamc > dovecot-lda

If you only have virtual users then you won't need a 2nd spamd instance
and port.

postfix main.cf:
# dovecot 2.x local
mailbox_command = /usr/bin/spamc -e /usr/libexec/dovecot/dovecot-lda -a "$RECIPIENT" \
                -f "$SENDER"  -m "$EXTENSION"
.
.
# virtual user
virtual_transport = vdovecot

postfix master.cf (needed for virtual user)
vdovecot        unix    -       n       n       -       5       pipe
         flags=DRuh user=vmail:vmail argv=/usr/bin/spamc -p 784 -u ${recipient} -e \
/usr/libexec/dovecot/dovecot-lda -d  ${user}@${domain} -a {recipient} -f ${sender}

('flags= ... -f ${sender}' is all one line)

spamd options unix user:
SPAMDOPTIONS="-c -m20 --min-children=5 --max-spare=5 --user-config"

spamd options virtual user:
SPAMDOPTIONS1="-c -m20 --min-children=5 --max-spare=5 -x \
                --virtual-config-dir=/home/vmail/domains/%d/%l/.spamassassin -u vmail \
                
--port=784 -H"

-----------------
All my users have a Maildir with:
.SystemFolders
.SystemFolders.Ham
.SystemFolders.Spam
.SystemFolders.SuspectedSpam

SuspectedSpam is where dovecot sieve puts Spamassassin tagged spam.
Users put ham and spam in their respective folders.

I have a bash script that runs from crontab to poll the ham and spam folders which
uses sa-learn to populate each user's Bayes database.

Hope this isn't terribly confusing.

Bill


On 11/16/2015 11:15 PM, Eric Abrahamsen wrote:
> I set up a new mail server (postfix) a month or two ago, and all is
> working well.
> 
> My solution for learning spam and ham was to give users two mailboxes,
> learn/ham and learn/spam, where they move messages to learn. Every three
> hours a cronjob runs to iterate through virtual users, learn the
> messages, and then move them elsewhere. Pretty standard.
> 
> I run spamd with this in the OPTIONS:
> 
> --virtual-config-dir=/var/lib/spamassassin/%d/%u/spamassassin
> 
> to activate per-virtual-user databases. In /etc/postfix/master.cf, the
> dovecot line starts:
> 
> argv=/usr/bin/spamc -u ${user}@${nexthop} .....
> 
> I used to use sa-learn in the learning cronjob, but after reading some
> threads here I changed to using spamc, also with the -u option.
> 
> Spam filtering isn't working very well though (it's hard to be sure, but
> it seems pretty clear that learning isn't working), and I'm starting to
> think that the -u option to spamc doesn't actually correspond to what's
> happening with the --virtual-config-dir option to spamd.
> 
> I used "sa-learn --dump magic --dbpath ...." on several of my virtual
> users, and it's hard to tell what's going on -- they seem to have their
> own databases, but most have little or nothing in them, which makes me
> think the script is not actually recording the learning properly.
> 
> I also tried directly running this, to re-learn what was already in my
> Junk folder:
> 
> spamc -u eric@ericabrahamsen.net \
> --spam /var/mail/vmail/ericabrahamsen.net/eric/Junk/cur/*
> 
> And the command simply hung -- I killed it after a minute or two.
> 
> So obviously I'm doing something pretty wrong.
> 
> Can someone confirm what I should be doing with spamc (both in postfix
> delivery, and the learning script) to make this work correctly with
> per-virtual-user databases?
> 
> Thanks,
> Eric
> 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic