[Mimedefang] Don't call spamassassin for outbound e-mails

Barton L. Phillips barton at applitec.com
Sat Dec 10 13:08:32 EST 2005


>
>
>Hi,
>I´d like to use SpamAssassin to check just my inbound e-mails. I use SA with
>MIMEDefang and Sendmail.
>How should I do configure mimedefang to don't call SA for outbound e-mails?
>Tks!
>
Here is what I did. Also some additional stuff,  but the first 'if' is 
how I keep from filtering my outgoing through spamassassin. I hope this 
helps. Note the first comment, you need the -s flag set to look at senders.

# Add a filter sender. Must start mimedefang with -s flag
# I want to extend this to read a black list file. TBD

sub filter_sender {
  my ($sender, $ip, $hostname, $helo) = @_;

  # md_syslog('info', "Filter_sender: $helo, $sender, $ip, $hostname");

  # If this is coming from me don't do any thing just send it out

  if ($ip eq "127.0.0.1" or $ip =~ /192\.168\.1\./) {
    md_syslog('info', "Filter_sender: From ME: sender=$sender");
    return ('ACCEPT_AND_NO_MORE_FILTERING', "ok");
  }

  # Also keep people from helo-ing me with my own address
 
  if ($helo =~ 
/(?:applitec\.com)|(?:bartonphillips\.com)|(?:68\.122\.243\.210)/i) {
    if ($ip ne "127.0.0.1" and
    $ip ne "68.122.243.210") {
      md_syslog('info', "Filter_sender error: spoof helo: helo=$helo, 
ip=$ip, sender=$sender");
      return('REJECT', "Go away... $ip is not in applitec.com");
    }
  }

  # mail is not from our ip and yet the sender claims to be from here

  if (($sender =~ 
/(?:applitec\.com>)|(?:bartonphillips\.com>)|(?:swam\.us>)|(?:ceenrichment\.com>)/) 
and
      (($ip ne "127.0.0.1") and ($ip ne "68.122.243.210") and ($ip !~ 
/192\.168\.1\./))) {
    md_syslog('info', "Filter_sender error: spoofed sender: 
sender=$sender, ip=$ip, hostname=$hostname, helo=$helo");

    # For glen and alan
   
    if(($sender =~ /(?:glen)|(?:ghumphrey)|(?:alan)|(?:barton)/) and
       ($hostname =~ 
/(?:charter\.com)|(?:carrierinternetsolutions\.com)|(?:bartonphillips\.com)|(?:applitec\.com)/)) 
{
      md_syslog('info', "Filter_sender error: spoofer is glen or alan");
      return ('CONTINUE', "ok");
    }
   
    return('REJECT', "Go away... spoofing sender $sender from $ip");
  }
         
  return ('CONTINUE', "ok");
}

# </blp date="11/2/2005">
# DO NOT delete the next line, or Perl will complain.

-- 
----------------
Barton L. Phillips
Applied Technology Resources, Inc.
Tel: (818)652-9850
Web: http://www.applitec.com




More information about the MIMEDefang mailing list