Re: [Exim] just tag spam with spamassassin

Páxina inicial
Borrar esta mensaxe
Responder a esta mensaxe
Autor: Dennis Skinner
Data:  
Para: Tommi Mäkitalo
CC: exim-users
Asunto: Re: [Exim] just tag spam with spamassassin
On Sat, 2004-02-14 at 17:33, Tommi Mäkitalo wrote:
> Hi,
>
> I want to use spamassassin just to tag my emails as spam. I don't want to
> reject like sa-exim does.


Here is how I did it using exiscan. It uses the same DB format as SA.
Just make sure the @GLOBAL required_hits entry has the lowest prefid. A
threshhold of 999 turns off the filtering (msgs are still scanned, but
never end up delivered as junkmail.

Your spam_transport can easily deliver to a junkmail folder in the
user's maildir.

(sorry for the wrapped lines)

########################################
## Spam Macros
########################################
THRESHHOLD = ${lookup mysql{select value*10 from spamassassin.userpref
where (username='${quote_mysql:${local_part}}' or username='@GLOBAL')
and preference='required_hits' order by prefid desc limit 1}}

WHITE_CHECK = ${lookup mysql{select value from spamassassin.userpref
where (username='${quote_mysql:${local_part}}' or username='@GLOBAL')
and preference='whitelist_from' and
(value='${quote_mysql:$sender_address}' or
value='*@${quote_mysql:$sender_address_domain}') limit 1}}

BLACK_CHECK = ${lookup mysql{select value from spamassassin.userpref
where (username='${quote_mysql:${local_part}}' or username='@GLOBAL')
and preference='blacklist_from' and
(value='${quote_mysql:$sender_address}' or
value='*@${quote_mysql:$sender_address_domain}') limit 1}}


########################################
## Spam Data ACL
########################################
# Always add X-Spam-Score and X-Spam-Report headers, using SA
system-wide settings
# (user "nobody"), no matter if over threshold or not.
  warn  message = X-Spam-Score: $spam_score ($spam_bar)
        condition = ${if <{$message_size}{150k}{1}{0}}
        spam = nobody:true
  warn  message = X-Spam-Report: $spam_report
        condition = ${if <{$message_size}{150k}{1}{0}}
        spam = nobody:true




########################################
## Spam Routers
########################################

### This should never be run due to @GLOBAL Threshold entry
spam_noentry:
driver = accept
domains = +local_domains
condition = ${if eq{THRESHHOLD}{}{yes}{no}}
transport = nospam_delivery
no_verify

spam_blacklist:
driver = redirect
domains = +local_domains
condition = ${if !eq{BLACK_CHECK}{}{yes}{no}}
address_data = black
data = ${quote:$local_part}\@${domain}
no_verify

spam_whitelist:
driver = redirect
domains = +local_domains
condition = ${if !eq{WHITE_CHECK}{}{yes}{no}}
address_data = white
data = ${quote:$local_part}\@${domain}
no_verify

nospam_threshhold:
driver = redirect
domains = +local_domains
condition = ${if and {{!eq {$address_data}{white}}{!eq
{$address_data}{black}}{> {THRESHHOLD}{$spam_score_int}}}{yes}{no}}
address_data = white
data = ${quote:$local_part}\@${domain}
no_verify

spam_threshhold:
driver = redirect
domains = +local_domains
condition = ${if and {{!eq {$address_data}{white}}{!eq
{$address_data}{black}}{<= {THRESHHOLD}{$spam_score_int}}}{yes}{no}}
address_data = black
data = ${quote:$local_part}\@${domain}
no_verify

nospam_router:
driver = accept
domains = +local_domains
condition = ${if or {{>={THRESHHOLD}{9990}}{eq
{$address_data}{white}}}{yes}{no}}
headers_add = X-Spam-Status: No
transport = nospam_delivery
no_verify

spam_router:
driver = accept
domains = +local_domains
condition = ${if eq {$address_data}{black}{yes}{no}}
headers_add = X-Spam-Status: Yes
transport = spam_delivery
no_verify

--
Dennis Skinner
Systems Administrator
BlueFrog Internet
http://www.bluefrog.com