Converting spam.blacklist.rules and spam.whitelist.rules into database

Brent Bloxam brentb at
Mon Sep 21 18:53:15 IST 2009

Christopher Fisk wrote:
>>  Christopher Fisk wrote:
>>  > Is it possible to set MailScanner to query a database
>>  instead of flat files for the spam.blacklist.rules and
>>  spam.whitelist.rules lists?
>>  > 
>>  > My Black/Whitelist for MailScanner is getting a bit
>>  overboard on a couple of servers that I maintain.  If I
>>  could enter them all into a database I could track which
>>  users requested they be added and be able to maintain a
>>  bit easier.
>>  Hi Christopher,
>>  I suggest to keep flat files for performance reasons. I
>>  generate them
>>  periodically via cron from the databases I use.
>>  Regards, Roy
> This is actually an idea I didn't even think of.  Store our information in the database and just convert!
> Sometimes the simple solution is the best.

One of the issues I ran into with this is that the child reads the 
flat-file when it starts, and then holds onto that for its running 
duration. So if you're updating the blacklist/whitelist files often, 
you'll find them not taking effect until the children die off and are 

To combat this, I've written a custom function that reads the file 
per-scan and handles per-user filtering. The check takes 0.003 seconds 
on our system, so it's not really adding a whole lot of load or 
processing time. If anyone is interested in the source, I can provide a 
copy to the list.

|  .-> brent bloxam ~-.      brentb @
| (                    )     beanfield metroconnect
|  `~- wgxolq +uajq <-'      416.532.1555 ext. 2004

More information about the MailScanner mailing list