User controlled whitelist/blacklist

Richard Lynch rich at MAIL.WVNET.EDU
Sat May 17 15:37:25 IST 2003

On Thu, 2003-05-15 at 17:31, Julian Field wrote:
> No, it doesn't. It just does simple lookups for speed.
> This is the matching code: it shows that just the "From" address (envelope
> sender), the domain of that address and the exact IP address are tested.
> You can specify a whitelist/blacklist for an individual email address or an
> individual domain.
> I might expand this later to allow IP prefixes and possibly domain
> suffixes, but I have no immediate plans for this. Feel free to add to the
> code yourselves!
>    return 1 if $BlackWhite->{$to}{$from};
>    return 1 if $BlackWhite->{$to}{$fromdomain};
>    return 1 if $BlackWhite->{$to}{$ip};
>    return 1 if $BlackWhite->{$todomain}{$from};
>    return 1 if $BlackWhite->{$todomain}{$fromdomain};
>    return 1 if $BlackWhite->{$todomain}{$ip};

Thanks Julian, I don't think the wildcard limitation is all that big of
a deal for me but it would be nice.  I am trying to mod the code a
little to add support for an "everybodyelse" black/whitelist.

Actually, my issue is mainly with blacklists.  I have a customer who is
on a crusade to wipe out *all* spam for his domain.  He sends me new
blacklist entries everyday.  The problem is that he's a bit overzealous
and I end up blocking sites for other customers who don't want it.  So,
my plan is...

1. Move all of his blacklist entries to his own config file in
.../by.domain/blacklist.  He has multiple domain names so I've created
logical links (ln -s) of those domain names to his main config file.

2. Will update the MailScanner.conf file with "Is Definitely Spam =

3. I would still like to have a global blacklist for everybody else so
I've created a file called ".../by.domain/all" that I can put global
entries in.

4. I've modified the code in with these entries...

  return 1 if $BlackWhite->{all}{$from};
  return 1 if $BlackWhite->{all}{$fromdomain};
  return 1 if $BlackWhite->{all}{$ip};

  ...inserted right after your matching code.

Is this the right approach?  I handle several other domains and am
trying to avoid having to duplicate blacklist entries that I want to be
applied globally.  Thanks for all of your help.

Richard Lynch <rich at>

More information about the MailScanner mailing list