[Mimedefang] Still outbound messages are getting blocked by s  pamassassin
    alan premselaar 
    alien at 12inch.com
       
    Sat Jul 10 00:13:41 EDT 2004
    
    
  
Matthew.van.Eerde at hbinc.com wrote:
>>From: Jim McCullars [mailto:jim at info.uah.edu]
>>On Fri, 9 Jul 2004, Vivek Kumar wrote:
>>
>>
>>>Hi Matthew,
>>>
>>>I tried both the following syntax you suggested but I got 
>>
>>compliation
>>
>>>error.
>>
>>   How about just:
>>
>>   if ($hostip =~ /^191\.0\.(?:0|1)/) {
>>    return("ACCEPT_AND_NO_MORE_FILTERING","OK")
>>   }
> 
> 
> That would aslo match 191.0.12.38, for example.
> 
> This might work though:
>     if ($hostip =~ /^(?:191\.0\.(?:0|1)|127\.0\.0)\./) {
>      return("ACCEPT_AND_NO_MORE_FILTERING","OK")
>     }
I use a subroutine that allows me to be creative and/or easily expand my 
list of machines/networks that can send email unfiltered. The code had 
been posted to the list awhile back so i'm not going to take credit for 
writing it. I obviously modified it for my own use.
I personally don't use ACCEPT_AND_NO_MORE_FILTERING because I still 
force virus scans of outgoing mail, but i use these tests to bypass the 
SpamAssassin tests as necessary.
hope this helps,
alan
code follows:
-----------------------------------------------------------------
use Socket;
sub valid_local_network {
	my	($hostip) = @_;
         my      $addr   ='';
         my      $network_string = '';
         my      $mask_string = '';
         my      %exempt_subnets = (
                         '127.0.0.0','255.0.0.0',
                         '192.168.0.0','255.255.255.0', 
			'192.168.1.0','255.255.255.0',
                 );
         $addr = inet_aton $hostip;
         while ( ($network_string,$mask_string) = each %exempt_subnets) {
                 my $network = inet_aton $network_string;
                 my $mask = inet_aton $mask_string;
                 if ( ($addr & $mask) eq $network) { 
 
                         return 1; 
 
                 } 
 
         } 
 
 
 
         return 0; 
 
}
then in filter_relay you could have:
sub filter_relay ($$$) {
	my ($hostip, $hostname, $helo) = @_;
	if (valid_local_network($hostip)) {
		return('ACCEPT_AND_NO_MORE_FILTERING', "It's from us.");
	}
	# ... other relay tests here
	return('CONTINUE',"");
}
    
    
More information about the MIMEDefang
mailing list