Re: [exim] ditch_spam problem: blackhole

Góra strony
Delete this message
Reply to this message
Autor: Cyborg
Data:  
Dla: exim-users
Temat: Re: [exim] ditch_spam problem: blackhole
Am 11.01.2012 15:46, schrieb SCHNEIDER Benoit:
> Hi
>
> tank's for you answer,
> If in understand the line: "and whiteliste not regexp
> '${quote_mysql:$header_from}''
> It's mean about every mail who come from all local domain will be accepted ?
>
> But I want to setup a list of distant domain, or email, for this i was
> thinking about two line:
> "and whiteliste not regexp '$whitelisteemail''
> "and whiteliste not regexp '$whitelistedomain''
>
> where $whitelisteemail and $whitelistedomain will be like:
>
> $whitelisteemail = user1@??? : user2@???
> $whitelistedomain = distdomaine3.com : distdomaine4.com
>
> I'm in the right way ?


no, i think not. You can't mix SQL Statements with EXIM lists as you did.

This SQL Statement : ... and whiteliste not regexp '$matchagainst' ..
compares the regexpression inside the databasefield 'whiteliste' with '$matchagainst'
which should the be the sender email.


your code :

 1.
    ditch_spam:
 2.
       driver = redirect
 3.
       allow_fail
 4.
       data = :blackhole:
 5.
       condition = ${if >{$spam_score_int}{${lookup mysql{select
    users.sa_refuse * 10 from users,domains \
 6.
                     where localpart = '${quote_mysql:$local_part}' \
 7.
                     and domain = '${quote_mysql:$domain}' \
 8.
                     and users.on_spamassassin = '1' \
 9.
                     and users.domain_id=domains.domain_id \
10.
                     and users.sa_refuse > 0 }{$value}fail}} {yes}{no}}
11.
       local_part_suffix = -*
12.
       local_part_suffix_optional
13.
       retry_use_local_part


the mail will be redirected to :blackhole: is the "condition" is true.

Example:

... and whiteliste not regexp 'test@???' ..

IF the entry for 'whiteliste' in your database is ".*@domain.de" it will not match ..
which results in a FALSE for the condition. The Result is, it's not redirected to :blackhole:

Example 2:

... and whiteliste not regexp 'test@???' ..

IF the entry for 'whiteliste' in your database is ".*@(domain|demo)\.de" it will not match => condition is false

IF the entry for 'whiteliste' in your database is ".*@doesnotwork\.de" it will match => condition is TRUE,
it gets redirected to :blackhole:

Remember, you want it blackholed if the senderdomain is NOT in the whitelist. That's why it's NOT REGEXP

if you wanne match an entire address, no problem. In this case, 'whiteliste' has to be "username@domain\.de".

Simple, ain't it ? :)


It's possible that the SQL must be the other way around:

... and 'test@???' not regexp whiteliste ..

check the mysql docs for the exact syntax.