[Mimedefang] To stop spam checking of Internal mail

Jim McCullars jim at info.uah.edu
Fri Aug 29 14:03:01 EDT 2003


On Fri, 29 Aug 2003, Ole Holm Nielsen wrote:

> What *exactly* must be added to mimedefang-filter, and at what lines
> (a context-diff would be really neat), in order to enable the
> desired filter_relay() function ?

   Exactly where you put the test depends on whether you want to skip
only SpamAssassin checks, or whether you want to skip all checks.  If you
put the test in filter_relay, you will effectively bypass all MIMEDefang
checking, and so if a local user gets a virus, he could still spread it
locally (or send it out).  If you put the test in filter_end right above
the call to SpamAssassin, then you would bypass only the SpamAssassin
checks, but still check for viruses, and other bad file attachments.

   Having said that, here is what you would do.  Exactly how to do the
test depends on what kind of subnet you have.  Since you have a Class B,
it's pretty easy - just examine the relay address and check the first two
digits.  There have been other solutions posted that may be easier if you
have a subnet mask that involves numbers other than 255 and 0, but since
you have a Class B block, this may be easier for you:

sub filter_relay {
   my ($ip, $name, $helo) = @_;
   if ($ip =~ /^130\.225/     ||     # local to our campus?
       $ip eq "127.0.0.1") {         # or localhost?
         return('ACCEPT_AND_NO_MORE_FILTERING', "ok")
   }
   return('CONTINUE', "ok");        # relay not local, continue checking
}

   In the example filter that comes with 2.35, that would go at line 149,
right above filter_begin(), and will bypass all MIMEDefang checking.

   If you want to skip just the SpamAssassin checks, then put this right
above the line in filter_end that says, "if ($Features{"SpamAssassin"}) {"

    return if($RelayAddr eq "127.0.0.1" || $RelayAddr =~ /^130\.225/);

   That will bypass all SpamAssassin checks, as well as any other tests
you put in filter_end() below that line.

   Hope this helps...

Jim





More information about the MIMEDefang mailing list