[Mimedefang] Example Filters

Dave Shepherd Dave.Shepherd at Vixel.com
Mon Jul 21 11:16:01 EDT 2003


Andy,

I use the filter_relay to block entire subnets from porn sites over seas 
that I receive multipal spam from.

sub filter_relay {
    my($ip, $name, $helo) = @_;

    # Restrict to our subnets
    return('ACCEPT_AND_NO_MORE_FILTERING', "ok")
           if (
                $ip eq "127.0.0.1" or
                $ip =~ /^172\.16\./ or
                $ip =~ /^192\.168\.1\./ or
                $ip =~ /^38\.244\.18\./
              );

    # Allow mail from Mike's home mailserver
    return('CONTINUE', "ok") if($ip eq "64.91.104.2");

    # Make sure they use their hostname
    if ($helo =~ /^(\d{1,3})(.)(\d{1,3})(.)(\d{1,3})(.)(\d{1,3})$/) {
        return ('REJECT', "Please use your host name when saying HELO")
    }

    # Blocked subnets
    #do "/etc/mail/subnets-blocked";
    if(
        ($ip =~ /^200\.80\.47\./) ||
        ($ip =~ /^24\.54\.74\./) ||
        ($ip =~ /^66\.117\.15\./) ||
        ($ip =~ /^66\.232\.42\./) ||
        ($ip =~ /^218\.152\.170\./)||
        ($ip =~ /^207\.173\.88\./)
        )
    { return ('REJECT', "Rejected; smells like SPAM!");    }

    if(
        ($helo =~ /^(\d{1,3})(.)(\d{1,3})(.)(\d{1,3})(.)(\d{1,3})$/) &&
        ($ip ne $helo))
    { return ('REJECT', "Header forgery attempt, $ip claims to be $helo")  }

    return ('CONTINUE', "ok");

} # end sub


Andy Kirkby wrote:

>Does anybody have any good example filters I could have a look at? I am
>trying to create a filter that will allow me to blacklist certain
>domains, ideally I want to take a copy of the message as it is received
>and then bounce it so that they get the message that I don't want all
>their junk! I only want the message copy just in case I bounce anything
>I really need L.
>
>Cheers,
>
>Andy.
>
>
>_______________________________________________
>MIMEDefang mailing list
>MIMEDefang at lists.roaringpenguin.com
>http://lists.roaringpenguin.com/mailman/listinfo/mimedefang
>  
>





More information about the MIMEDefang mailing list