Re: [exim] Make spamassassin optinal

Top Pagina
Delete this message
Reply to this message
Auteur: Andrew D
Datum:  
Aan: Alexandre Gagné
CC: exim-users
Onderwerp: Re: [exim] Make spamassassin optinal
G'Day,

Alexandre Gagné wrote:
> Hi !
>
> I have some user that would prefer to rely on their mail client for
> spam filtering instead of the server-side anti-spam (spamassassin).
>
> I use MySQL to manage my users, so I added a "enable_antispam" in the
> table which can be set to "YES" or "NO".
>
> Then I have defined a variable in Exim config, 'ENABLE_ANTISPAM',
> which do a mysql lookup and get the 'enable_antispam' value. So
> 'ENABLE_ANTISPAM' should return 'YES' or 'NO'.
>
> I added a condition to my ACLs that have something to do with spam,
> and I'm not sure if I done it right. I did a lot a googling and read
> exim documentation, but I haven't found anything that make me confident
> I am doing things right.
>
> Below, the parts in my 'exim.conf' that are concerned. Does it seems
> to be right ? I added my "condition" before those that were already
> there. The idea being that if "ENABLE_ANTISPAM" return "NO", I don't
> wan't to do the spam-check.
>



The issue with this is that the scanning is done at the DATA acl, which
means variables like $local_part and $domain aren't available, due to
there possibly being multiple recipients in different domains.

It also means that if an email comes in to multiple recipients and you
set the ENABLE_ANTISPAM variable to no before hand, none of those
recipients would have their email scanned.

What you could do is defer (during the rcpt to phase) on those ppl, that
don't want spam scanning, when in a mutiple rcpt email (defer the rest
if it is the first rcpt), getting around this issue.

Cheers I hope that helps.
cya
Andrew


>   # Add headers to all messages (:true). Before enabling this,
>   # you must install SpamAssassin. You may also need to set the
> spamd_address
>   # option above.
>   #
>   warn  message         = X-Spam-Score: $spam_score\n\
>                           X-Spam-Score-Int: $spam_score_int\n\
>                           X-Spam-Bar: $spam_bar\n\
>                           X-Spam-Report: $spam_report
>         !authenticated  = *
>         condition       = ${if eq {ENABLE_ANTISPAM}{'YES'}{yes}{no}}
>         condition       = ${if < {$message_size}{SPAM_FILESIZE_LIMIT}}
>         spam            = spamassassin:true

>
>   # 2007-02-27 <pille@???>
>   # temp. reject messages that seem to have timeouts during spam-scan
>   defer message         = Temporary error while spam-scanning. Please
> try again later.
>         log_message     = message temporarily rejected, because of
> spam-scan error (maybe timeout)
>         !authenticated  = *
>         condition       = ${if eq {ENABLE_ANTISPAM}{'YES'}{yes}{no}}
>         condition       = ${if < {$message_size}{SPAM_FILESIZE_LIMIT}}
>         condition       = ${if !def:spam_score}

>
>   # Reject spam messages with score over 10+2*max_score_from_db
> (fallback=15 if mysql fails), using an extra condition.
>   deny  message         = This message is classified as UBE (SPAM) and
> therefore rejected. You scored $spam_score points. Congratulations!
>         !authenticated  = *
>         condition       = ${if eq {ENABLE_ANTISPAM}{'YES'}{yes}{no}}
>         condition       = ${if >={$spam_score_int}{${lookup mysql{\
>                                 SELECT ((max(spam_threshold)*2+10)*10)
> AS spam_reject_threshold \
>                                 FROM user \
>                                 WHERE SMTP_allowed='YES' \
>                           }{$value}{15}}}{true}{false}}

>
> Thanks a lot !
> AlexG
>
>