On 2015/04/07 04:22, Steffen Kaiser wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Tue, 31 Mar 2015, Anthony Papillion wrote:
Date: Tue, 31 Mar 2015 18:37:34 -0500 From: Anthony Papillion anthony@cajuntechie.org To: dovecot@dovecot.org Subject: Need a bit of help with the antispam plugin
Hello Everyone,
I'm running the antispam plugin on Dovecot 2.0.19 on Ubuntu Server 14.04 and I can't seem to get it to work. In the IMAP section of dovecot.conf I have the following lines:
protocol imap { mail_plugins = $mail_plugins imap_quota imap_acl antispam # mail_plugins = $mail_plugins imap_quota imap_acl imap_client_workarounds = tb-extra-mailbox-sep
# Maximum number of IMAP connections allowed for a user from each IP address. # NOTE: The username is compared case-sensitively. # Default is 10. # Increase it to avoid issue like below: # "Maximum number of concurrent IMAP connections exceeded" mail_max_userip_connections = 20
plugin { antispam_debug_target = syslog antispam_verbose_debug = 1
antispam_backend = pipe antispam_trash = Trash antispam_spam = Junk antispam_pipe_program_spam_arg = --spam antispam_pipe_program_notspam_arg = --ham antispam_pipe_program = /usr/bin/sa-learn antispam_pipe_program_args = --username=%Lu } }
replace the value of antispam_pipe_program with a script:
====== #/bin/bash
( set -x id -a date /usr/bin/sa-learn "$@" rc=$? echo rc=$rc exit $rc ) >/tmp/antispam.$$.log 2>&1
Then check on the command line, what happens if you invoke the command line as the user displayed by the id command.
For some reason, when I try to move something to Junk, I get the following in my syslog:
Mar 31 18:27:16 anonymail imap: antispam: plugin initialising (2.0-notgit) Mar 31 18:27:16 anonymail imap: antispam: verbose debug enabled Mar 31 18:27:16 anonymail imap: antispam: "Junk" is exact match spam folder Mar 31 18:27:16 anonymail imap: antispam: no unsure folders Mar 31 18:27:16 anonymail imap: antispam: "Trash" is exact match trash folder Mar 31 18:27:16 anonymail imap: antispam: pipe backend spam argument = --spam Mar 31 18:27:16 anonymail imap: antispam: pipe backend not-spam argument = --ham Mar 31 18:27:16 anonymail imap: antispam: pipe backend program = /usr/bin/sa-learn Mar 31 18:27:16 anonymail imap: antispam: pipe backend program arg[0]
--username=anthony@cajuntechie.org Mar 31 18:27:16 anonymail imap: antispam: pipe backend tmpdir /tmp Mar 31 18:27:19 anonymail imap: antispam: mailbox_is_unsure(Junk): 0 Mar 31 18:27:19 anonymail imap: antispam: mailbox_is_trash(INBOX): 0 Mar 31 18:27:19 anonymail imap: antispam: mailbox_is_trash(Junk): 0 Mar 31 18:27:19 anonymail imap: antispam: mail copy: from trash: 0, to trash: 0 Mar 31 18:27:19 anonymail imap: antispam: mailbox_is_spam(INBOX): 0 Mar 31 18:27:19 anonymail imap: antispam: mailbox_is_spam(Junk): 1 Mar 31 18:27:19 anonymail imap: antispam: mailbox_is_unsure(INBOX): 0 Mar 31 18:27:19 anonymail imap: antispam: mail copy: src spam: 0, dst spam: 1, src unsure: 0 Mar 31 18:27:19 anonymail imap: antispam: running mailtrain backend program /usr/bin/sa-learn Mar 31 18:27:19 anonymail imap: antispam: running mailtrain backend program /usr/bin/sa-learn Mar 31 18:27:19 anonymail imap: antispam: running mailtrain backend program parameter 1 --username=anthony@cajuntechie.org Mar 31 18:27:19 anonymail imap: antispam: running mailtrain backend program parameter 2 --spam Mar 31 18:27:21 anonymail imap: antispam: run program failed with exit code -1
This is probably a permissions issue but I'm not able to debug it. Can anyone offer me any clues as to what I might be doing wrong or how I might fix it?
Thanks, Anthony
I'm having the exact same issue. I applied the change you recommended to Anthony (I.E. create the script and call that rather than sa-learn directly) and I see that the resultant log file in /tmp is never created. Any additional suggestions would be greatly appreciated!
-- John Perry - WX5JP http://www.jpunix.net https://www.digitalocean.com/?refcode=b90b690ca5bb https://lastpass.com/f?3921926