Thus spake Julian Mehnle on Sat, Dec 18, 2004 at 05:58:47PM CST
> Martijn Lievaart [EMAIL PROTECTED] wrote:
> > OK, so the filters are run for every locally delivered message. But can
> > I whitelist some recipients unconditionally, no bloclists applied, or do
> > I have to use BLOCK2.
> 
> Courier does not currently support applying DNS blocklists to certain
> recipients only.  You could use (and easily extend to your needs) one of
> the more sophisticated mail filters for Courier, though:

I do this all the time, and it's pretty simple.  I'm going to extend it by
way of a web interface so that individual customers can apply blacklists or
not.  Here's how I do it.

I have BLACKLISTS set in /etc/courier/esmtpd with

BLACKLISTS="-block=sbl.spamhaus.org,BLOCK2 -block=relays.ordb.org,BLOCK3 etc.

In /etc/courier I have a file which I created called globalspampolicy which
contains the following:

import TCPREMOTEIP
if (($TCPREMOTEIP eq "::ffff:24.243.196.39") || ($TCPREMOTEIP eq 
"::ffff:127.0.0.1") || ($TCPREMOTEIP eq "::ffff:192.207
.27.55") || ($TCPREMOTEIP eq "::ffff:192.168.1.16"))
{
        EXITCODE=0
        exit
}

# This stuff (above) is to take care of the situation, at least for locally
# originating mail, where mail is addressed to two local mail boxes and one
# is filtering and one is not.

import BLOCK2
if ( "$BLOCK2" ne "" )
{
        echo "$BLOCK2 (BL-2)"
        EXITCODE=1
        exit
}

import BLOCK3
if ( "$BLOCK3" ne "" )
{
        echo "$BLOCK3 (BL-3)"
        EXITCODE=1
        exit
}

etc...

All my user mailboxes are set up as virtual mailboxes under ~vmail.  Mail
account filespaces are all in ~vmail/domains, and referenced by a MySQL
database.  Each domain name directory (e.g. ~/vmail/domains/fmp.com)
contains a file, called domainspampolicy which contains the following:

# Domain level policy
include "/etc/courier/globalspampolicy"

Under the domains name I have individual accounts by username which contain
a .mailfilters directory, (e.g. ~vmail/domains/fmp.com/fmouse/.mailfilters)
wherein I have a rcptfilter file which consists normally of only the
following:

# set EXITCODE=0 to whitelist message
# set EXITCODE=99 to invoke content filter
# any other EXITCODE rejects
include "../domainspampolicy"
EXITCODE=99
exit

This gives me maximum flexibility.  Each account is created using all my
current blacklists, however the customer may request that any individual
mailbox under his domain be expempt from spam filtering, in which case the
include in the local rcptfilter can be commented out, or replaced with a
limited version of globalspampolicy.  Blacklisting can be disabled or
limited on a per-domain basis by editing each domain's domainspampolicy
file.  I'm soon going to add a feature to my customer mail management
web interface which allows each customer to run a script that comments or
uncomments the include in the rcptfilter file to turn spam filtering off and
on for that box.

The "(BL-*)" outputs for each blocking list show up in the logs, and I have
a script here which analyzes the log and does pretty output, emailed daily,
for customers who want to know which blacklists blocked which emails.  This
helps track down false positives and helps determine which blacklists are
the most aggressive (SpamCop takes 1st prize for the most false positives).

This system works like a dream for me, and my customers love it, too!

I have reserved the courierperlfilter facility for a virus detection program
which I wrote myself, which works pretty good, too.
 
-- 
Lindsay Haisley       | "Fighting against human |     PGP public key
FMP Computer Services |    creativity is like   |      available at
512-259-1190          |    trying to eradicate  | <http://pubkeys.fmp.com>
http://www.fmp.com    |        dandelions"      |
                      |      (Pamela Jones)     |


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to