antispam plugin, pipe backend, how to make it work?
Johannes Rohr
johannes at rohr.org
Tue Apr 12 20:04:53 UTC 2016
Hi Jürgen,
what do you mean by "It's already integrated"? Of course I added the
configuration, see my initial mail below. I still am struggling to
understand what the reason for the wrapper script is and how the plugin
is supposed to call he helper programme, is the message passed to it via
stdout?
This is what I find in the syslog: Apr 12 21:54:32 vm10 imap: antispam:
plugin initialising (2.0-notgit)
Apr 12 21:54:32 vm10 imap: antispam: verbose debug enabled
Apr 12 21:54:32 vm10 imap: antispam: "SPAM" is exact match spam folder
Apr 12 21:54:32 vm10 imap: antispam: "Junk" is exact match spam folder
Apr 12 21:54:32 vm10 imap: antispam: no unsure folders
Apr 12 21:54:32 vm10 imap: antispam: "trash" is exact match trash folder
Apr 12 21:54:32 vm10 imap: antispam: "Trash" is exact match trash folder
Apr 12 21:54:32 vm10 imap: antispam: "Deleted Items" is exact match
trash folder
Apr 12 21:54:32 vm10 imap: antispam: "Deleted Messages" is exact match
trash folder
Apr 12 21:54:32 vm10 imap: antispam: pipe backend spam argument = --spam
Apr 12 21:54:32 vm10 imap: antispam: pipe backend not-spam argument = --ham
Apr 12 21:54:32 vm10 imap: antispam: pipe backend program =
/usr/bin/sa-learn
Apr 12 21:54:32 vm10 imap: antispam: pipe backend program arg[0] =
--username=[blanked out]@rohr.org
Apr 12 21:54:32 vm10 imap: antispam: pipe backend tmpdir /tmp
It doesn't hint at any particular error, however, when I tried to move a
message to junk, nothing happens, the message just stays at its original
place and I see that the contents of the bayes db is unchanged, so
somehow nothing happens. When I disable the plugin, moving messages to
Junk works again.
I wonder whether this is a bug in a particular version, it is quite
ancient software, the server is running on Ubuntu precise.
Cheers,
Johannes
Am 12.04.2016 um 20:18 schrieb J. Echter:
> Hi,
>
> here (Centos 7) its already integrated...
>
> Just add something like this:
>
> plugin {
>
>
> antispam_mail_sendmail = /usr/bin/sa-learn
> antispam_mail_sendmail_args = -u amavis
> antispam_mail_spam = --spam
> antispam_mail_notspam = --ham
> }
>
> to dovecot.conf
>
> Cheers
>
> Jürgen
>
> Am 12.04.2016 um 20:14 schrieb Johannes Rohr:
>> Hi, my setup is a dovecot 2.0.19 IMAP server on Ubuntu Precise with
>> the antispam plugin in version 2.0+20120225-2 and spamassassin at
>> version 3.2.2
>>
>> I have been trying and failed to get the pipe backend of the antispam
>> plugin to work. Spamassin by itself works, a manual call of sa-learn
>> works fine. Bayes data is stored in a mysql DB.
>>
>> I have the following configuration in /etc/dovecot/conf.d/90-plugin.conf
>>
>> plugin {
>> #setting_name = value
>> sieve=~/.dovecot.sieve
>> sieve_dir=~/sieve
>> antispam_pipe_program_spam_arg = --spam
>> antispam_pipe_program_notspam_arg = --ham
>> antispam_pipe_program = /usr/local/bin/sa-learn-pipe.sh
>> antispam_pipe_program_args = --username=%u # % expansion done by
>> dovecot
>> antispam_trash = trash;Trash;Deleted Items;Deleted Messages
>> antispam_spam = SPAM;Junk
>> antispam_backend = pipe
>> antispam_verbose_debug = 1
>> antispam_debug_target = syslog
>> antispam_pipe_tmpdir = /tmp
>> }
>>
>> I have tried the following wrapper script:
>> #!/bin/bash
>> # set -x
>> LOGFILE=/tmp/sa-learn-pipe.log
>> echo "$$-start ($*)" >> $LOGFILE
>> #echo $* > /tmp/sendmail-parms.txt
>> cat<&0 >> /tmp/sendmail-msg-$$.txt
>> /usr/bin/sa-learn $* -D /tmp/sendmail-msg-$$.txt >> $LOGFILE 2>&1 && \
>> rm -f /tmp/sendmail-msg-$$.txt
>> echo "$$-end" >> $LOGFILE
>> exit 0
>>
>> It somehow isn't working. I can call the wrapper script manually e.g.
>> sudo -u vmail /usr/local/bin/sa-learn-pipe.sh --username=some at mail.user
>> --ham \
>> < someham
>>
>> But it doesn't work from dovecot. It seems the script is called. but no
>> new patterns show up in the bayes DB. Unfortunately, the plugin seems to
>> be documented poorly. How does it call the programme it pipes to? Is it
>> something like $programme --par1 --par2 < message ? Why can't /
>> shouldn't I call sa-learn directly? All the instructions I found on the
>> in internet contained a wrapper script, but none bothered to explain why
>> you would actually need it.
>>
>> I would be very grateful, if someone could enlighten me on that...
>>
>> Cheers,
>>
>> Johannes
More information about the dovecot
mailing list