[Mimedefang] How to test spamassassin's configuration

wrolf.courtney at donovandata.com wrolf.courtney at donovandata.com
Wed Oct 6 09:18:25 EDT 2004


# Do not spam check e-mail whitelisted in /etc/mail/access.db
# WC 9/3/2003
use DB_File;

# If SpamAssassin found SPAM, append report.  We do it as a separate
# attachment of type text/plain
sub filter_end ($) {
    my($entity) = @_;

    # If you want quarantine reports, uncomment next line
    # send_quarantine_notifications();

    # IMPORTANT NOTE:  YOU MUST CALL send_quarantine_notifications() AFTER
    # ANY PARTS HAVE BEEN QUARANTINED.  SO IF YOU MODIFY THIS FILTER TO
    # QUARANTINE SPAM, REWORK THE LOGIC TO CALL
send_quarantine_notifications()
    # AT THE END!!!

    # No sense doing any extra work
    return if message_rejected();

    # WC 9/3/2003
    # Do not spam check e-mail whitelisted in /etc/mail/access.db
    my $access_db = "/etc/mail/access.db";
    tie %access_hash,  'DB_File', $access_db, O_RDONLY;
    my $LHS = $Sender; $LHS =~ s/^<//; $LHS =~ s/>$//;
    $LHS = 'from:' . lc($LHS);
    $RHS = $access_hash{$LHS};
    md_graphdefang_log('access', $LHS, $RHS) if defined($RHS) and $RHS ne
'';
    untie %access_hash;
    return if defined($RHS) and $RHS =~ /^RELAY|^OK/;

Of course, this only checks for full from addresses.  It does not check for
the full syntax of an access file.

My main reason for this code is to skip spamassassin (but not clamav) for
messages that have been whitelisted in access.db.  I scan the maillogs for
outbound mail, and add their e-mail addresses to the access whitelist -
this predates my MIMEDefang/SA installation.  This has basically eliminated
all the the false positives due to DNSBLs.

Have fun!

Wrolf

mimedefang-bounces at lists.roaringpenguin.com wrote on 10/06/2004 05:15:59
AM:

> On Tue, 5 Oct 2004 20:26:44 -0400, wrolf.courtney at donovandata.com
> <wrolf.courtney at donovandata.com> wrote:
> > I tie to access.db in mimedefang-filter.  Not hard.
> >
> > Wrolf
>
> Hi Wrolf,
>
> Can you post the tie / access.db code as I'm trying to do a similar task.
>
> Thanks
>
> Alberto
> _______________________________________________
> Visit http://www.mimedefang.org and http://www.canit.ca
> MIMEDefang mailing list
> MIMEDefang at lists.roaringpenguin.com
> http://lists.roaringpenguin.com/mailman/listinfo/mimedefang



More information about the MIMEDefang mailing list