[Dovecot] Antispam plugin / sa-learn

Steffen Kaiser skdovecot at smail.inf.fh-brs.de
Thu Sep 12 09:31:24 EEST 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, 11 Sep 2013, Mathieu R. wrote:

> Sorry for posting on both list spamassassin and dovecot : my question is
> on dovecot antispam plugin, used to learn spamassassin with sa-learn.
>
> I wonder if there is a way to confirme sa-learn is correctly feeded by
> the antispam plugin.

> using that script to pipe message to sa-learn :
>
> #!/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 $* /tmp/sendmail-msg-$$.txt ;
> rm -f /tmp/sendmail-msg-$$.txt ;
> echo "$$-end" >> /tmp/sa-learn-pipe.log ;
> exit 0;

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;

> For me, it's working, but when i run sa-learn --backup, i just get
> this :
>
> 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?

I assume you need some --username=username and/or --prefspath=file 
setting.

- -- 
Steffen Kaiser
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQEVAwUBUjFfvF3r2wJMiz2NAQIzIwgAt3414bPm+imJkaocSJRgfveJGCDnSnKB
hRZNbXuA9qpQwOUpoKSwoUTi4oXoS/Jh0mhHZkumKLp6NXNym99IhezWjmw54vV4
nwWQ8ZJI6JCeR2y6i+/QHmQipUH1/8sYez3ouFyR+8kBck6ZkywPnntB/FiiOwY0
uLRPErefGQ2xQdkN5L4nTeCVcS4IarEL9W6pUQKhA9wgBhqNzf8ocM1riwauuWMr
Y6YSagSnOx/89q1/XCpb8YMO+ZDYY4cbMPVR9AlHW1XwT7f0QWY/8Ztjo9fC3m0K
HTC4+NRkiFBp1ept6Qs5Itb0z9n//lz7V2bXgThcWloTmcOScqZ2kQ==
=blum
-----END PGP SIGNATURE-----


More information about the dovecot mailing list