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
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
dovecot 2.2.10 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
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
On 12-04-16 20:14, Johannes Rohr wrote:> 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 > dovecotYou need to specify the argument list as a list seperated by semicolons, per example on the wiki: antispam_pipe_program_args = --username;%u The verbose debug should give you some logging to work with. Also, what does the wrapper script log when dovecot runs it? How does that differ from a manual run?> 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-------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: <http://dovecot.org/pipermail/dovecot/attachments/20160412/e5823ee0/attachment.sig>
Hi Tom, Am 12.04.2016 um 22:26 schrieb Tom Hendrikx:> On 12-04-16 20:14, Johannes Rohr wrote: >> 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 > You need to specify the argument list as a list seperated by semicolons, > per example on the wiki: > > antispam_pipe_program_args = --username;%uNot sure about that, because sa-learn expects the parameter --username=user at na.me, this is one parameter, not two, and it works for me locally, where I also set up dovecot to test. The main differences are that the versions I have here are newer, I'm running Debian sid, the server is on Ubuntu Precise, and second, the server is handling virtual users, locally I have only real Unix users. Also, dovecot doesn't complain about configuration errors regard --username=%u. What other way would be there to get the parameter passed to sa-learn the way I want? btw, I tried this, just to be sure, but the result was the same.> > The verbose debug should give you some logging to work with.Yes, and I pasted the output. I can of course repeat: Apr 12 22:53:02 vm10 imap: antispam: mailbox_is_unsure(Junk): 0 Apr 12 22:53:02 vm10 imap: antispam: mailbox_is_trash(INBOX): 0 Apr 12 22:53:02 vm10 imap: antispam: mailbox_is_trash(Junk): 0 Apr 12 22:53:02 vm10 imap: antispam: mail copy: from trash: 0, to trash: 0 Apr 12 22:53:02 vm10 imap: antispam: mailbox_is_spam(INBOX): 0 Apr 12 22:53:02 vm10 imap: antispam: mailbox_is_spam(Junk): 1 Apr 12 22:53:02 vm10 imap: antispam: mailbox_is_unsure(INBOX): 0 Apr 12 22:53:02 vm10 imap: antispam: mail copy: src spam: 0, dst spam: 1, src unsure: 0 Apr 12 22:53:02 vm10 imap: antispam: running mailtrain backend program /usr/bin/sa-learn Apr 12 22:53:02 vm10 imap: antispam: running mailtrain backend program /usr/bin/sa-learn Apr 12 22:53:02 vm10 imap: antispam: running mailtrain backend program parameter 1 --username=johannes at rohr.org Apr 12 22:53:02 vm10 imap: antispam: running mailtrain backend program parameter 2 --spam Apr 12 22:53:03 vm10 imap: antispam: run program failed with exit code -1> Also, what > does the wrapper script log when dovecot runs it?I have actually ditched the wrapper script because it works without locally, I have configured the plugin to call sa-learn directly.> How does that differ > from a manual run?sa-learn works just fine with a manual run. It seems as if the plugin is passing the parameters wrongly, but the debugging output doesn't reveal the actual command, so it's just guesswork. Cheers, Johannes> > >> 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 >
deano-dovecot at areyes.com
2016-Apr-13 20:11 UTC
antispam plugin, pipe backend, how to make it work?
Johannes - I'm running 2.2.9 under Ubuntu 14.04. I gave up on using the pipe backend, just could not get the damn thing to work. I would up using spool2dir and incron, which works perfectly. The issue was that sa-learn would cause a pthread_cancel error with libgcc_s.so.1 Below is an excerpt from my install script : ############################################ # Enable antispam - Damn, not working right with pipe backend # now using spool2dir and incron if [ -e /etc/spamassassin ]; then sed -i " s/^ #mail_plugins.*/ mail_plugins = \$mail_plugins antispam ${DOVENOTIFY}/ s/^ #mail_max_userip.*/mail_max_userip_connections = 20/ " /etc/dovecot/conf.d/20-imap.conf cat > /etc/dovecot/conf.d/99-Installerbox-antispam.conf << EOF ## ## antispam configuration ## plugin { antispam_debug_target = syslog # antispam_verbose_debug = 1 antispam_trash_pattern = Trash;Deleted * antispam_spam = Junk;Spam antispam_backend = spool2dir antispam_spool2dir_spam = /var/cache/dovecot-antispam/spam/%%020lu-%u-%%05luS antispam_spool2dir_notspam = /var/cache/dovecot-antispam/ham/%%020lu-%u-%%05luH # pipe backend not working with sa-learn - causes pthread_cancel error with libgcc_s.so.1 # antispam_backend = pipe # antispam_pipe_program = /usr/local/bin/sa-learn-pipe.sh # antispam_pipe_program_args = --for;%u # antispam_pipe_program_spam_arg = --spam # antispam_pipe_program_notspam_arg = --ham # antispam_pipe_tmpdir = /tmp } EOF # incron watches the spam/ham spool dirs, calls sa-learn-pipe.sh to handle echo "root" >> /etc/incron.allow mkdir -p /var/cache/dovecot-antispam/spam /var/cache/dovecot-antispam/ham chown -R ${VMAIL_ID}.dovecot /var/cache/dovecot-antispam/ cat > /var/spool/incron/root << "EOF" /var/cache/dovecot-antispam/spam IN_CLOSE_WRITE /usr/local/bin/sa-learn-pipe.sh --spam /var/cache/dovecot-antispam/spam/$# /var/cache/dovecot-antispam/ham IN_CLOSE_WRITE /usr/local/bin/sa-learn-pipe.sh --ham /var/cache/dovecot-antispam/ham/$# EOF chgrp incron /var/spool/incron/root chmod 600 /var/spool/incron/root # inotify needs a little more room to breath - default of 128 too low cat > /etc/sysctl.d/60-inotify.conf << EOF # inotify changes for Dovecot # http://dovecot.org/list/dovecot/2011-March/058300.html # Defaults are # fs.inotify.max_queued_events = 16384 # fs.inotify.max_user_instances = 128 # fs.inotify.max_user_watches = 8192 fs.inotify.max_user_instances = 2048 EOF # spamassassin learning script cat > /usr/local/bin/sa-learn-pipe.sh << "EOFSPAM" #!/bin/bash # Pipe script to learn/unlearn single email file # Set to read from file or from stdin # From stdin to accomodate dovecot-antispam pipe backend (nor currently working) # echo /usr/bin/sa-learn $* /tmp/sendmail-msg-$$.txt FILE=`echo $* | sed "s/^.* //"` echo "$$-start ($*)" >> /var/log/sa-learn-pipe.log echo -n "$$ " >> /var/log/sa-learn-pipe.log egrep --no-filename "^Subject: " /tmp/sendmail-msg-$$.txt ${FILE} | head -1 >> /var/log/sa-learn-pipe.log cat<&0 >> /tmp/sendmail-msg-$$.txt /usr/bin/sa-learn --progress $* /tmp/sendmail-msg-$$.txt >> /tmp/sa-learn-pipe.$$.log 2>&1 echo $$ sa-learn rc=$? id=$(id) HOME=$HOME >> /var/log/sa-learn-pipe.log while read line; do echo $$-sa-learn "$line" >> /var/log/sa-learn-pipe.log done < /tmp/sa-learn-pipe.$$.log rm -f /tmp/sendmail-msg-$$.txt /tmp/sa-learn-pipe.$$.log rm -f ${FILE} echo "$$-end" >> /var/log/sa-learn-pipe.log exit 0 EOFSPAM chmod 755 /usr/local/bin/sa-learn-pipe.sh touch /var/log/sa-learn-pipe.log chown ${VMAIL_ID}.dovecot /var/log/sa-learn-pipe.log chmod 660 /var/log/sa-learn-pipe.log cat > /etc/logrotate.d/sa-learn-pipe.log << EOFLOG /var/log/sa-learn-pipe.log { daily missingok rotate 10 compress delaycompress notifempty create 660 ${VMAIL_ID} dovecot } EOFLOG fi # spamassassin ############################################ On 2016-04-12 14:14, Johannes Rohr wrote:> 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...-- Dean Carpenter deano is at areyes dot com 203 six oh four 6644
Reasonably Related Threads
- antispam plugin, pipe backend, how to make it work?
- antispam plugin, pipe backend, how to make it work?
- antispam plugin, pipe backend, how to make it work?
- plugin antispam sa-learn run program failed with exit code -1
- Need a bit of help with the antispam plugin