[Dovecot] AntiSpam Plugin

Leander S. leander.schaefer at googlemail.com
Wed Aug 4 23:45:46 EEST 2010


  Dovcot AntiSpam Errors:
- [SERVERBUG] failed to send mail  --> Thunderbird response when move 
from ANY to spam and the other way arround.
- [CANNOT] Cannot copy to unsure folder  --> Thunderbird response when 
move from ANY to unsure and the other way arround.
- run program failed with exit code 9 --> debug.log output from antispam 
plugin.

^^ Maybe someone will find this in an archive and saves himself a  
_freakn_lot_of_time_  ;)



Hi Nikita Koshikov,

first of all: Thanks for your reply - much apreciated! ;) It wasn't a 
problem of user rights - that's for sure now.
second: @Tom Hendriks: Thanks for the script hint!! ... but still ... 
very weired - actually extremely weired, cause if I invoke the script it 
works perfectly - don't ask me why - it's still a mystery to me since 
there is acutally no difference to how sa-learn is invoked:


script:

server [~]# cat /script.sh
#!/usr/local/bin/bash
#
# - must be bash, cause I was not able to make it log 
stdout/stderror/stdin into a file ...
# - $1,$2,$3,$4 puts all the 4 given parameters/args by dovecot into the 
sa-learn command.
# - make sure to chmod 0777 /DoveDamnAntispam.log
#
#######################################################################

/usr/local/bin/sa-learn $1 $2 $3 $4 &> /DoveDamnAntispam.log

server [~]#




Antispam part of dovecot.conf:

   ### Dovecot AntiSpam ###
    # mail signature (used with any backend requiring a signature)
    #antispam_signature = X-Spam-Status
    #antispam_signature_missing = move

    antispam_mail_sendmail = /script.sh
    #antispam_mail_sendmail = /usr/local/bin/sa-learn
    antispam_mail_sendmail_args = --username=%u;--debug;all
    antispam_mail_spam = --spam
    antispam_mail_notspam = --ham
    antispam_mail_tmpdir = /tmp
    antispam_spam = Spam
    antispam_unsure = Virus
    antispam_trash = Trash


I mean there is not a difference at all to me compared to what I've had 
before?! But what ever - I got it working - that's the most important ;)

So, thanks alot, hey!


Best regards!














Am 04.08.10 08:35, schrieb Nikita Koshikov:
> On Tue, 03 Aug 2010 23:16:38 +0200
> Leander S. wrote:
>
>>    Hi  Nikita Koshikov,
>>
>> when I googled for my SERVERBUG which I'm having right now I found your
>> configuration.
>> I'm trying to make use of the antispam plugin as you do. Unfortunately
>> I'm always getting a [SERVERBUG] error mesage with my MTC when I try
>> moving mails. The antispam debug.log doesn't really tell a lot of more:
>>
>>
>>     ### Dovecot AntiSpam ###
>>      # mail signature (used with any backend requiring a signature)
>>      #antispam_signature = X-Spam-Status
>>      #antispam_signature_missing = move
>>
>>      antispam_mail_sendmail = /usr/local/bin/sa-learn
>>      antispam_mail_sendmail_args = --username=%u;--debug;all
>>      antispam_mail_spam = --spam
>>      antispam_mail_notspam = --ham
>>      antispam_mail_tmpdir = /tmp
>>      antispam_spam = Spam
>>      antispam_unsure = Virus
>>      antispam_trash = Trash
>>
> First of all - what OS is this ? BSD ? And how did you install your spamassassin (ports\compiling from source)?
> Show your local.cf file (/etc/mail/spamassassin or /usr/local/etc/mail/spamassasin).
>
> After reading perldoc Mail::SpamAssassin::Conf add to your local.cf for debugging:
> bayes_file_mode 0777
> bayes_path /tmp/.spamassassin/bayes
>
> Create folder /tmp/.spamassassin and set permitions 777.
> Restart spamd with dovecot  and try it.
>
>
>> I also read through the sa-learn script but wasn't able to figure out
>> where this number 9 is coming from ;/
>> ... SIGKILL 9 Term Kill signal - but where from ?!
>>
> sa-learn has lots of die() function, this should be enough for raising SIGKILL.
>>
>> Do you maybe have any idea? I tried different Dovecot versions already -
>> alwys the same ... Might there maybe somethign wrong with my syntax?
>>
>>
>>
>> Any way - thanks a lot in advance&  regards
>>
> If you stuck after all, remember that sa-learn has -D key, it generate tons of output. Create wrapper and run sa-learn with -D keyword from dovecot, save result and have fun.
>

















On 03/08/10 23:17, Leander S. wrote:

> >    Am 03.08.10 22:53, schrieb Gregory Finch:
>> >>  On 2010-08-03 1:41 PM, Leander S. wrote:
>>> >>>     Am 28.07.10 23:43, schrieb Harlan Stenn:
>>>> >>>>  Figure out exactly what script is running and see if it says why it
>>>> >>>>  would return with a status of 9.  If that is because of a SIGKILL,
>>>> >>>>  it is
>>>> >>>>  because some process is sending that signal.  You are gonna get to
>>>> >>>>  figure out what debug knobs to crank to figure out why this is going
>>>> >>>>  on.
>>>> >>>>
>>>> >>>>  Can you invoke any of this stuff manually from the command line to see
>>>> >>>>  what messages may come up?
>>>> >>>>
>>>> >>>>  h
>>> >>>  Hi,
>>> >>>
>>> >>>  unfortunately I still wasn't able to figure out what's going on. I
>>> >>>  tried to debug the sa-learn perl script and I wasn't able to find any
>>> >>>  hint to that code. (I'm not a beginner) But I guess that this is not
>>> >>>  an issue of sa-learn. Why? Because sa-learn does as I asked it to.
>>> >>>  sa-learn writes everything into the SQL DB as wanted - but the mail is
>>> >>>  not being copied to the destination plus the dovecot server returns
>>> >>>  the old known [SERVERBUG] message to Thunderbird. I obviously also
>>> >>>  tried:
>>> >>>
>>> >>>
>>> >>>  server [~]# sa-learn --username=admin at mydom.com --spam
>>> >>>  /var/mail/admin/.Spam/
>>> >>>  Learned tokens from 0 message(s) (2 message(s) examined)
>>> >>>  server [~]#
>>> >>>
>>> >>>  "Learned tokens from 0" because it has learnd from Dovecot antispam
>>> >>>  already. If I reset SQL values it would learn again.
>>> >>>
>>> >>>
>>> >>>  Here is my debug.log output again.
>>> >>>
>>> >>>  Aug  3 22:16:29 server imap: antispam: plugin initialising (1.2-notgit)
>>> >>>  Aug  3 22:16:29 server imap: antispam: "Trash" is exact match trash
>>> >>>  folder
>>> >>>  Aug  3 22:16:29 server imap: antispam: "Spam" is exact match spam folder
>>> >>>  Aug  3 22:16:29 server imap: antispam: "Virus" is exact match unsure
>>> >>>  folder
>>> >>>  Aug  3 22:16:29 server imap: antispam: mail backend spam address --spam
>>> >>>  Aug  3 22:16:29 server imap: antispam: mail backend not-spam address
>>> >>>  --ham
>>> >>>  Aug  3 22:16:29 server imap: antispam: mail backend sendmail
>>> >>>  /usr/local/bin/sa-learn
>>> >>>  Aug  3 22:16:29 server imap: antispam: mail backend sendmail arg
>>> >>>  --username=admin at mydom.com --debug all
>>> >>>  Aug  3 22:16:29 server imap: antispam: mail backend tmpdir /tmp
>>> >>>  Aug  3 22:16:34 server imap: antispam: mailbox_is_unsure(Spam): 0
>>> >>>  Aug  3 22:16:34 server imap: antispam: mailbox_is_trash(INBOX): 0
>>> >>>  Aug  3 22:16:34 server imap: antispam: mailbox_is_trash(Spam): 0
>>> >>>  Aug  3 22:16:34 server imap: antispam: mail copy: from trash: 0, to
>>> >>>  trash: 0
>>> >>>  Aug  3 22:16:34 server imap: antispam: mailbox_is_spam(INBOX): 0
>>> >>>  Aug  3 22:16:34 server imap: antispam: mailbox_is_spam(Spam): 1
>>> >>>  Aug  3 22:16:34 server imap: antispam: mailbox_is_unsure(INBOX): 0
>>> >>>  Aug  3 22:16:34 server imap: antispam: mail copy: src spam: 0, dst
>>> >>>  spam: 1, src unsure: 0
>>> >>>  Aug  3 22:16:34 server imap: antispam: running mailtrain backend
>>> >>>  program /usr/local/bin/sa-learn
>>> >>>  Aug  3 22:16:34 server imap: antispam: running mailtrain backend
>>> >>>  program /usr/local/bin/sa-learn
>>> >>>  Aug  3 22:16:38 server imap: antispam: run program failed with exit
>>> >>>  code 9
>>> >>>
>>> >>>
>>> >>>
>>> >>>
>>> >>>  Those are my Antispam options from dovecot.conf:
>>> >>>
>>> >>>  [...]
>>> >>>      ### Dovecot AntiSpam ###
>>> >>>       # mail signature (used with any backend requiring a signature)
>>> >>>       #antispam_signature = X-Spam-Status
>>> >>>       #antispam_signature_missing = move
>>> >>>
>>> >>>       antispam_mail_sendmail = /usr/local/bin/sa-learn
>>> >>>       antispam_mail_sendmail_args = --username=%u --debug all
>> >>  anitspam_blah_args is a semicolon separated list, no spaces (I thought
>> >>  this odd too), therefore:
>> >>  antispam_mail_sendmail_args = --username=;%u;--debug;all
>> >>
>> >>  (i think)
>> >>
>>> >>>       antispam_mail_spam = --spam
>>> >>>       antispam_mail_notspam = --ham
>>> >>>       antispam_mail_tmpdir = /tmp
>>> >>>       antispam_spam = Spam
>>> >>>       antispam_unsure = Virus
>>> >>>       antispam_trash = Trash
>>> >>>  [...]
>>> >>>
>>> >>>  Even --debug all doesn't help a thing ;( I tried my luck enabeling
>>> >>>  all this Dovecot debug knobs:
>>> >>>
>>> >>>  ##
>>> >>>  ## Logging
>>> >>>  ##
>>> >>>  mail_debug = yes
>>> >>>  auth_verbose = yes
>>> >>>  auth_debug = yes
>>> >>>  auth_debug_passwords = yes
>>> >>>  log_timestamp = "%b %d %H:%M:%S "
>>> >>>  syslog_facility = mail
>>> >>>
>>> >>>
>>> >>>  ... didn't help ... - dovecot's log didn't tell me anything new - no
>>> >>>  error nothing after the Serverbug happend ... ;(
>>> >>>
>>> >>>
>>> >>>  I really don't know where to debug anymore ;( Therefore, I would
>>> >>>  _really_  - out of all my frustration - appreaciate your help (cause
>>> >>>  this issue is now bothering me now for more than two weeks now already
>>> >>>  - without any little peace of success)
>>> >>>
>>> >>>
>>> >>>
>>> >>>  Thanks&   Regards
>>> >>>
>>> >>>
>>> >>>
>> >>  -Greg
>> >>
> >  
> >  Thanks for your reply. I tried that one as well - unfortunately that
> >  didn't really help a lot. Debug now looks a bit different than before:
> >  (Ofcourse did I try it without the debug option at all as well - but
> >  with the same result.)
> >  
> >  
> >     ### Dovecot AntiSpam ###
> >      # mail signature (used with any backend requiring a signature)
> >      #antispam_signature = X-Spam-Status
> >      #antispam_signature_missing = move
> >  
> >      antispam_mail_sendmail = /usr/local/bin/sa-learn
> >      antispam_mail_sendmail_args = --username=%u;--debug;all
> >      antispam_mail_spam = --spam
> >      antispam_mail_notspam = --ham
> >      antispam_mail_tmpdir = /tmp
> >      antispam_spam = Spam
> >      antispam_unsure = Virus
> >      antispam_trash = Trash
> >  
> >  
> >  
> >  
> >  
> >  Aug  3 23:08:38 server imap: antispam: plugin initialising (1.2-notgit)
> >  Aug  3 23:08:38 server imap: antispam: "Trash" is exact match trash folder
> >  Aug  3 23:08:38 server imap: antispam: "Spam" is exact match spam folder
> >  Aug  3 23:08:38 server imap: antispam: "Virus" is exact match unsure folder
> >  Aug  3 23:08:38 server imap: antispam: mail backend spam address --spam
> >  Aug  3 23:08:38 server imap: antispam: mail backend not-spam address --ham
> >  
> >  Aug  3 23:08:38 server imap: antispam: mail backend sendmail
> >  /usr/local/bin/sa-learn
> >  Aug  3 23:08:38 server imap: antispam: mail backend sendmail arg
> >  --username=admin at mydom.com
> >  Aug  3 23:08:38 server imap: antispam: mail backend sendmail arg --debug
> >  Aug  3 23:08:38 server imap: antispam: mail backend sendmail arg all
> >  
> >  Aug  3 23:08:38 server imap: antispam: mail backend tmpdir /tmp
> >  Aug  3 23:08:38 server imap: antispam: mailbox_is_unsure(Spam): 0
> >  Aug  3 23:08:38 server imap: antispam: mailbox_is_trash(INBOX): 0
> >  Aug  3 23:08:38 server imap: antispam: mailbox_is_trash(Spam): 0
> >  Aug  3 23:08:38 server imap: antispam: mail copy: from trash: 0, to
> >  trash: 0
> >  Aug  3 23:08:38 server imap: antispam: mailbox_is_spam(INBOX): 0
> >  Aug  3 23:08:38 server imap: antispam: mailbox_is_spam(Spam): 1
> >  Aug  3 23:08:38 server imap: antispam: mailbox_is_unsure(INBOX): 0
> >  Aug  3 23:08:38 server imap: antispam: mail copy: src spam: 0, dst spam:
> >  1, src unsure: 0
> >  Aug  3 23:08:38 server imap: antispam: running mailtrain backend program
> >  /usr/local/bin/sa-learn
> >  Aug  3 23:08:38 server imap: antispam: running mailtrain backend program
> >  /usr/local/bin/sa-learn
> >  Aug  3 23:08:40 server imap: antispam: run program failed with exit code 9
> >  
> >  
> >  
> >  But unfortunately there is no more debug as I was hoping of sa-learn.
> >  I also tried using different Dovecot versons already - but with the same
> >  result - they all give my MTC a SERVERBUG when I try to move mails with
> >  the help of the antispam plugin.
> >  
What happens when you write a small shell wrapper and put that in place
of sa-learn, which calls sa-learn, and let it save the input (arguments
as produced by the plugin) and output of sa-learn to a temporary file?

-- Regards, Tom




More information about the dovecot mailing list