Re: [exim] db based IP blacklist

Góra strony
Delete this message
Reply to this message
Autor: Marcin Mirosław
Data:  
Dla: exim-users
Temat: Re: [exim] db based IP blacklist
W dniu 2012-10-27 21:51, Alexander Nagel napisał(a):
> Hi,
>
> I have a simple IP list in my PostGreSQL with inet as type in the
> table.
> Currently i have this snippet in my exim4.conf file in the
> acl_smtp_connect part.
>
> drop
> condition = ${if eq{$sender_host_address}{${lookup
> pgsql{PG_Q_BLACKLIST}}}}
> message = REJECTED - You are blacklisted
> log_message = REJECTED - $sender_host_address is blacklisted.
>
> This works with a single IP address. But I want to add whole ranges
> of
> IP addresses like 192.1.0.0/24
> How do I have to change the condition?


Hi Alex,
so you would like to block all /24 net if any ip address within this
network is in your database?
Meseems you should use >>= operator in your sql query(which you didn't
provide - I'm guessing how it can looks like) and condition create as
below:
condition = ${if eq{${mask:$sender_host_address/24}{${lookup
pgsql{PG_Q_BLACKLIST}}}}

Regards,
Marcin