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 at cajuntechie.org> >> To: dovecot at 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 at 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 at 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, >> AnthonyI'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
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tue, 7 Apr 2015, John Perry wrote:> 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 at cajuntechie.org> >>> To: dovecot at 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 at 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 at 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!Is this script executable for all, e.g.: chmod a+x /path/to/script Is the script located in a directory everybody are allowed to execute, e.g. /usr/local/bin or /usr/bin . Can you run, e.g.: sudo -u nobody /path/to/script and something is happening? - -- Steffen Kaiser -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEVAwUBVSPUWHz1H7kL/d9rAQLtzgf5AUXDxhhQg7EsO5qEaDKgvKBgNt7dWF2Y ui7h1uW47c0bja4E4d89X7oHsZ1HQXvvuobbBlDxIzdhweoK8bISDL7DYSLCLW1s wzf5z4FqFbr6H1bj5oX8/ZgQ3+4ONL9aAmMhHT6JUxPZ98JtPUlm/yzNu2eYfQbG p5Q62RHr/tsNG0jg9AHGEsrbSDpIkrmk3n2qgddwA8dCWcNMjHzDJThgGpKoEEq2 ohvjr6V3TUJcL6BZ/GR0B+2VKaQSdR6FlhhuItZrpbClOeoe1MyOos/p5TLnL+Lp XFm5DAATbQYEEmnaC+1G2dQoFuix+mMXxPq4L1LH/+O8ztGLh8QTdQ==pLIX -----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 2015/04/07 07:58, Steffen Kaiser wrote:> > Is this script executable for all, e.g.: > > chmod a+x /path/to/scriptyes. That was the first thing I did.> > Is the script located in a directory everybody are allowed to execute, > e.g. /usr/local/bin or /usr/bin .Yes. It is in /usr/bin named antispam.sh> > Can you run, e.g.: > > sudo -u nobody /path/to/script > > and something is happening?yes. I can execute it as "nobody" and a resultant log file is created. Since it was run with no parameters the log file basically says I need to pass arguments to sa-learn. Also I'm running iRedMail-0.9.0 and trying to set up the spam filter based on the intructions found on the webpage http://www.iredmail.org/forum/topic8169-iredmail-support-antispam-via-dovecot-and-spamassassin.html. I DO see that the MySQL database is being updated when a new message comes in. - -- John Perry - WX5JP http://www.jpunix.net https://www.digitalocean.com/?refcode=b90b690ca5bb https://lastpass.com/f?3921926 -----BEGIN PGP SIGNATURE----- iQIcBAEBCAAGBQJVI9frAAoJEIn5ENyiI2/NsW8P/1izBZ+32eIF34TgJZUKReca LzDC6hXya5Gc4PQ/jAN1LyP26/nd6WGqljtK3wj2qRoclp9+7iVNOsxi3zvFIMME orl1u5vAqQPcR9//BLoYxYy5HS0aEZS1YzuH2Mvxs9Dt+Bh+aJjpn5nsRiO32bRG CLviuVddxHwf6DkLbhIp2ybnZCCyTtWZ22NwsAAwRwocGBKi/vpQ83lUB398Ojn9 aVHEnkzd+QbilPcaU5k4SY/evACDnll4a1m9eBZm5VIvGWnDjmVXUSx+iHODol9X obSSFcXPJRMpq7JBdzpnlyP2EJBMjZun52T7oBA+SpoCKamtZaUzW2r9Q3aAgrYr F88K8EAGrRZgMI8cBwfFAntkygu6SCaWVULMqlmTv+XqyMlKWt+HAfc0EiFSJdos lzryDnU64regk3Y3GknOIxVDT7KzrXGP7MwUPHSqbgYxcKGbas70P8Py4aGYexlJ oNEUTBCb+pS4pzmPpu6QCCt7B0hoU7ZNWs8tlOEVZyFN3I+iAElZf939ciF/2o7E d/gLgmKbt0kRz5LPmKFts8Aw0lZshkk1FEoW+/DvGNCzpf4IpYQjvBl2h4rQmtuo jqoycFCHGCw0bXvohe2g4ZoRZmF0EUqWa7hfHbYxNZRpLa/ygEgYnA9CZPps5WXZ UtX9CydP8CwHHQ8JOjOI =rSXU -----END PGP SIGNATURE-----