[Dovecot] Antispam plugin / sa-learn

Mathieu R. mathieu at 400iso.net
Thu Sep 12 23:09:42 EEST 2013


Le 12/09/2013 08:31, Steffen Kaiser a écrit :

> above script is missing important log information: the current uid
> and $HOME; also sa-learn knows -D
>
> I would change for a testing period:
> #!/bin/sh
> echo /usr/bin/sa-learn $* /tmp/sendmail-msg-$$.txt ;
> echo "$$-start ($*)" >> /tmp/sa-learn-pipe.log ;
> #echo $* > /tmp/sendmail-parms.txt ;
> cat<&0 >> /tmp/sendmail-msg-$$.txt ;
> /usr/bin/sa-learn -D $* /tmp/sendmail-msg-$$.txt
> >/tmp/sa-learn-pipe.$$.tmp 2>&1;
> echo $$ sa-learn rc=$? id=$(id) HOME=$HOME >> /tmp/sa-learn-pipe.log
> while read line; do
> 	echo $$-sa-learn "$line" >> /tmp/sa-learn-pipe.log
> done < /tmp/sa-learn-pipe.$$.tmp
> rm -f /tmp/sendmail-msg-$$.txt /tmp/sa-learn-pipe.$$.tmp
> echo "$$-end" >> /tmp/sa-learn-pipe.log ;
> exit 0;

thank you a lot, i tried this, and here is what i got in the log :


22:00 root at effraie01 ~ # cat /tmp/sa-learn-pipe.log
...
4933-start (--ham)
4933 sa-learn rc=0 id=uid=3000(vmail) gid=3000(vmail) 
groups=3000(vmail) HOME=
4933-end
4953-start (--spam)
4953 sa-learn rc=0 id=uid=3000(vmail) gid=3000(vmail) 
groups=3000(vmail) HOME=
4953-end

so i tried

22:01 root at effraie01 ~ # sa-learn --username=vmail --backup
v       3       db_version # this must be the first line!!!
v       0       num_spam
v       0       num_nonspam



> Read man sa-learn section MIGRATION: "Note that if you have 
> individual
> user databases you will have to perform a similar procedure for each
> one of them."
>
> sa-learn --backup > backup.txt
>
> backups the database of one particular user, I assume you use root to
> issue the command? But is the antispam learning script above runs as
> root, too?

if i correctly understood what you told me, the sa-learn-pipe (and so 
sa-learn itself) run as vmail, wich is the global user i use for email. 
and there is still nothing in sa-learn database. (i dod not have many 
spam on that server, but still have passed a few to sa-learn via that 
dovecot-antispam plugin). Maybe everything is normal, but with my low 
level spamassassin/dovecot comprehension, i think i would have something 
in sa-learn db.



-- 
Mathieu R.


More information about the dovecot mailing list