[exim] Make spamassassin optinal

Top Pagina
Delete this message
Reply to this message
Auteur: Alexandre Gagné
Datum:  
Aan: exim-users
Onderwerp: [exim] Make spamassassin optinal
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.

  # 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