[exim] Blacklisting IP Ranges Using MySQL

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Brian Spraker
Date:  
À: Exim-users
Sujet: [exim] Blacklisting IP Ranges Using MySQL
Hello everyone,

Is there a way to blacklist IP ranges using MySQL?

I originally setup one file with all of the ranges in them such as:

41.0.0.0/8
58.0.0/8

Each IP range on a different line in the "hosts_blacklist" file that was in the
same directory as the Exim configuration file.

This has worked well for a few years without any kind of problem.

However, I am wanting to move this to a MySQL table. I have moved the domain
blacklist/whitelist, sender blacklist/whitelist, and sender domains
blacklist/whitelist to MySQL and those seem to be working OK.

However, the hosts_blacklist does not work now. I'm not too sure why it
wouldn't work; it is just a different method for storing the data.

The reason I'm moving to database storage is because I am making a series of
sites that I can use to quickly update the lists instead of logging into the
server and updating the file. In addition, because I have two servers that are
redundant, I have to update the file on each server. The MySQL database is
setup with master-master replication so if I make the change on one server, it
updates on the other at the same time - much more convenient.

This is what works when using the flat file:

hosts = ${if exists{CONFDIR/host_blacklist}{CONFDIR/host_blacklist}{}}

Now I have changed it to this:

hosts = ${lookup mysql{SELECT host FROM exim_host_blacklist }}

No longer works now.

Thank you!

Brian S.
BsnTech Networks