plugin antispam sa-learn run program failed with exit code -1

Steffen Kaiser skdovecot at smail.inf.fh-brs.de
Mon Aug 24 13:23:22 UTC 2015


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

On Fri, 21 Aug 2015, Guillaume Lakano - DOVECOT wrote:
> Le 21/08/2015 16:21, Steffen Kaiser a écrit :
>> 
>> - -1 usually means exec() failed, that is:
>> 
>> /usr/bin/sa-learn does not exist or the process thinks so at least.
>
> Hello Steffen, thanks for your reply.
>
> I've tried to use an external script sa-learn-pipe.sh :
>
>> #!/bin/bash
>> 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

Mayhap, start with something smaller:

========== /usr/local/bin/sa-learn-wrapper.sh
#!/bin/bash

echo "$0 $@" >> /tmp/sa-learn-wrapper.log

exit 0
========= END

chmod +x /usr/local/bin/sa-learn-wrapper.sh
sudo -u "user" /usr/local/bin/sa-learn-wrapper.sh 1 2 3

> And to update my configuration like that:
>>
>>   antispam_debug_target = syslog
>>   antispam_verbose_debug = 1
>>
>>   antispam_backend = pipe
>>   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=%Lu
>
> Now, this seems better, no error, the email is correctly moved in /Junk/ and 
> I have no error
>
>> Aug 21 16:31:05 mail imap: antispam: mailbox_is_unsure(Junk): 0
>> Aug 21 16:31:05 mail imap: antispam: mailbox_is_trash(INBOX): 0
>> Aug 21 16:31:05 mail imap: antispam: mailbox_is_trash(Junk): 0
>> Aug 21 16:31:05 mail imap: antispam: mail copy: from trash: 0, to trash: 0
>> Aug 21 16:31:05 mail imap: antispam: mailbox_is_spam(INBOX): 0
>> Aug 21 16:31:05 mail imap: antispam: mailbox_is_spam(Junk): 0
>> Aug 21 16:31:05 mail imap: antispam: mailbox_is_unsure(INBOX): 0
>> Aug 21 16:31:05 mail imap: antispam: mail copy: src spam: 0, dst spam: 0, 
>> src unsure: 0

This means: your config does not trigger the script, because the Junk does 
not match any special folder.  In your 1st message mailbox_is_spam(Junk) 
returned true (1)

> BUT... the sa-learn-pipe.sh doesn't seems to be called ! No files 
> created in /tmp/

you seem to have changed something else, too.

> I also tried to use the "mailtrain" backend but Dovecot doesn't accept it ( I 
> suppose I need to set "antispam_backend" to "mailtrain" but this doesn't 
> works ).

there are two forks of the antispam plugin with incompatible settings.

>
>
>
>> 
>> Do you have SELinux active? http://wiki2.dovecot.org/WhyDoesItNotWork near 
>> the end.
>
> sestatus doesn't exists, package not installed ( policycoreutils )
> and no file /var/log/audit*
>
> So I suppose iRedMail doesn't install SELinux components.
>
>
>> 
>> If this does not help, add a wrapper script in your config and check if the 
>> script is called at least
>> 
>
> It's not called at all :-/
>

- -- 
Steffen Kaiser
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEVAwUBVdsaynz1H7kL/d9rAQKb0Af7BCK4+GNVscOOEtuMDWgeiMyhM5mycFsv
vk4qi6GR5UpOK0ClVDM2xYzuTTN7YOQchNOz9qr2XqdlN4tG7nrsGUA0nUEtYbT7
9X6W6RE1xlRCAM9fh1XSBb6Gho2vSsNFXxqM3eQ9Nv5YohR62bovjbnMbSrBcZ43
5i0La3zkWb491qS7ZdJBLTfPYz03XTA4GCcxU6CsR6hz66V3I6u5O1yTjw2Jpj7D
iV+b7GuleFePccwBe5ms5Q9mY4JHec/niXlgUpI58jdVMPiMPmWjejormwBtnRJr
UnNKHO3TiQVc7mtOSpHhDfD9BDCAJeTtAMARTy00IfQiYij3gto6kw==
=K1/o
-----END PGP SIGNATURE-----


More information about the dovecot mailing list