Hi,

I'd like to implement an automatic whitelisting of outgoing addresses
(people I write to should be able to pass my heavy spam filter).

For a year I've been testing a minimal, proof-of-concept, whitelisting
script (see below) but haven't maintained or improved it. What I'd like
ideally is have per-user whitelists.

Is there already a serious solution out there? or should I keep
developping my script?

Thanks


        #!/usr/bin/perl
        use strict;
        use Sys::Syslog qw(:DEFAULT setlogsock);

        my $syslog_priority = "info";
        setlogsock("unix");
        openlog($0, "pid", "mail");

        my @block = do { local $/ = "\n\n"; split("\n", <STDIN>); };
        my %attr = map {/^(.+)=(.*)/} @block;
        my $recipient = $attr{recipient};
        if (open(WHITELIST, "+>> /tmp/whitelist") && seek(WHITELIST,0,0)) {
                if (!grep (/$recipient/, <WHITELIST>)) {
                        print WHITELIST "/^".$recipient."\$/ OK ## sender: 
$attr{sender}, 
                                client: $attr{client_address}\n";
                        close(WHITELIST);
                        syslog($syslog_priority, "WHITELISTED: $recipient");
                } else {
                        syslog($syslog_priority, "NOT WHITELISTED: $recipient");
                }
        } else {
                syslog('error', "WHITELISTING ERROR: ".$@);
        }
        print STDOUT "action=dunno\n\n";

-- 
http://www.lesculturelles.net

Reply via email to