Loading ...
Sorry, an error occurred while loading the content.

auto-whitelist outgoing addresses?

Expand Messages
  • Louis-David Mitterrand
    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
    Message 1 of 2 , Oct 31, 2008
    • 0 Attachment
      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
    • mouss
      ... For per-user whitelits, you can use a policy server. postfix smtpd access can t use multiple fields (sender AND recipients). Note that a simplistic
      Message 2 of 2 , Nov 2, 2008
      • 0 Attachment
        Louis-David Mitterrand wrote:
        > 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.
        >

        For per-user whitelits, you can use a policy server. postfix smtpd
        access can't use multiple fields (sender AND recipients).

        Note that a simplistic implementation will be abused by spammers (they
        forge the sender address). so you should only use this "whitelist" to
        skip "aggressive" checks.

        > Is there already a serious solution out there? or should I keep
        > developping my script?
        >
        > [snip]
      Your message has been successfully submitted and would be delivered to recipients shortly.