[Mimedefang] To stop spam checking of Internal mail

alan premselaar alien at 12inch.com
Wed Jul 16 00:24:18 EDT 2003


On 7/16/03 11:32 AM, "Kevin A. McGrail" <kmcgrail at peregrinehw.com> wrote:

> Hmm, I don't really know the flow with this function will work for
> mimedefang but perhaps something like this will help get the brain thinking.
> My one worry is that you don't want to filter by IP but hey, it's just a
> thought:
> 
> sub filter_relay {
>   my($hostip, $hostname, $helo) = @_;
> 
>   if ($hostip eq '127.0.0.1' or $hostip =~ /^10\.10\.10\./) {
>     #if the host IP matches local or a local subnet than mark spamassassin
> as not available
>     $Features{"SpamAssassin"} = 0;
>   }
> 
>   return ('CONTINUE', 'ok');
> }
> 

I personally would be a little cautious about setting
$Features{"SpamAssassin"} = 0; unless you know for sure that it's going to
be set to 1 for the next iteration of the filter run.

what i would suggest is something like this:

sub is_local_sender {
    my  ($hostip) = @_ if @_;

    return 1 if ( ($hostip eq '127.0.0.1') || ($hostip =~ /^10\.10\.10\./)
); 

    return 0;
}

and then in filter_end() where you test if ($Features{"SpamAssassin"}) {
change it to something like:

if ( ($Features{"SpamAssassin"}) && (!is_local_sender($RelayAddr) ) {

(note: i'm not sure if you really want to test against $RelayAddr, so you
should double check that, but this demonstrates the syntax)

 
on a side note, i've been considering how i'm going to implement something
like this, as just having my domain in the whitelist_from setting in spam
assassin makes it easily forgeable (as i've recently seen).  my problem is
that I've got a number of users (myself included) that send mail from remote
locations. I do have sendmail configured so that SMTP AUTH is required but
haven't really worked out how to reliably use that information to guarantee
a safe means for implementing this type of whitelisting in the
mimedefang-filter.

anyways, hope this is useful information

alan




More information about the MIMEDefang mailing list