Re: [exim] multiple spam engines / reset $spam_score

Páxina inicial
Borrar esta mensaxe
Responder a esta mensaxe
Autor: James
Data:  
Para: exim-users
Asunto: Re: [exim] multiple spam engines / reset $spam_score
On 17/08/2019 23:09, pille via Exim-users wrote:

> i've setup my mail system to use multiple spam engines (spamassassin and
> rspamd), similar to what was described in
> https://lists.exim.org/lurker/message/20170620.144216.2289dbff.en.html

...
>
> is there any way to detect, if the second spam engine failed?
> or is it possible to reset/unset the spam variables before the second run?


My solution is below. Probably it can be improved but you can use it
for hints. I have removed some other checks for clarity which could be
why I have sub acls where none is apparently needed.

I have two acls that do the checks: acl_rspamd and acl_sa. Variables
acl_m_rspamd and acl_m_sa are flags that store successful execution of
the spam check. I normalise (or bias) spam_score_int to 100 and store
as acl_m_rspamd_score and acl_m_sa_score.

I call these from acl_spam with warn so they just set values. Subsequent
warn, defer, deny use the values set previously.

acl_spam is called by acl_check_data with other checks not shown,



acl_rspamd:
   warn
     set acl_m_spamengine = 127.0.0.1 11333 variant=rspamd
     spam = nobody:true
     set acl_m_rspamd = 1
     set acl_m_rspamd_score = ${eval:($spam_score_int*100)/120}
   accept


acl_sa:
   warn
     set acl_m_spamengine = 127.0.0.1 783
     spam = nobody:true
     set acl_m_sa = 1
     set acl_m_sa_score = ${eval:($spam_score_int*100)/70}
   accept


acl_spam:
   warn
     set acl_m_rspamd_score = 0
     set acl_m_rspamd = 0
     acl = acl_rspamd
   warn
     set acl_m_sa_score = 0
     set acl_m_sa = 0
     acl = acl_sa
   defer
     condition = ${if and{{eq{$acl_m_rspamd}{0}} {eq{$acl_m_sa}{0}}} }
     message = Please try again later, spam check is not available
   deny
     set acl_m_score = 
${eval:($acl_m_rspamd*$acl_m_rspamd_score+$acl_m_sa*$acl_m_sa_score)/($acl_m_rspamd+$acl_m_sa)}
     condition = ${if >={$acl_m_score}{100}{true}{false}}
     message = Message refused as high probability of spam
   warn
     ...
   accept



acl_check_data:
...
   deny
     !acl = acl_spam
...