[Mimedefang] SPF help needed

Mack roaringpenguin.com at bass-speaker.com
Sat Oct 1 11:20:49 EDT 2005


This is the spf I use, seems to work fine


sub spf_query ($$$$) {
        my ($ip, $sender, $helo, $guess) = @_;
        # The guess parameter needs to be set to either 0 or 1.
        if ($guess != 1) {
                $guess = 0;
        }
        # Check this sender against any SPF or Caller-ID records
        # that might be available.
        my $ospfresult;
        my $ospfsmtp_comment;
        my $ospfheader_comment;
        my $ospfspf_record;
        eval {
            my $query = new Mail::SPF::Query ( ip           => $ip,
                                           sender       => $sender,
                                           helo         => $helo,
                                           guess        => $guess,
                                           callerid     => {
                                                "*."    => {
                                                check   => 1 } }
            );
            my ($result, $smtp_comment, $header_comment, $spf_record) =
$query->result();
            $ospfresult=$result;
            $ospfsmtp_comment=$smtp_comment;
            $ospfheader_comment=$header_comment;
            $ospfspf_record=$spf_record;
        };
        if ( $@ ) {
           $ospfresult="invalid";
        }
        return ($ospfresult, $ospfsmtp_comment, $ospfheader_comment,
$ospfspf_record);
}

-----Original Message-----
From: mimedefang-bounces at lists.roaringpenguin.com
[mailto:mimedefang-bounces at lists.roaringpenguin.com]On Behalf Of
Super-Dome
Sent: 01 October 2005 15:58
To: mimedefang at lists.roaringpenguin.com
Subject: [Mimedefang] SPF help needed



Dear ALL

I have checked  that SPF record is working fine .  i am putting the
following
code above filter_begin .which is also mentioned in Wiki

died prematurely -- check your filter rules

Thanks and Regards

SD



#  %PROCEDURE: spf_query

sub spf_query ($$$$) {

      my ($ip, $sender, $helo, $guess) = @_;

      # The guess parameter needs to be set to either 0 or 1.
      if ($guess != 1) {
              $guess = 0;
      }

      # Check this sender against any SPF or Caller-ID records
      # that might be available.
      my $query = new Mail::SPF::Query ( ip           => $ip,
                                         sender       => $sender,
                                         helo         => $helo,
                                         guess        => $guess,
                                         callerid     => {
                                              "*."    => {
                                              check   => 1 } }
      );

      my ($result, $smtp_comment, $header_comment, $spf_record) =
              $query->result();

      return ($result, $smtp_comment, $header_comment, $spf_record);
}

sub filter_sender {

# Query for SPF information with guess mode off
      my ($result, $smtp_comment, $header_comment, $spf_record) =
              spf_query ($ip, $sender, $helo, 0);

      # If SPF says this sender is not coming from an authorized MTA,
      # then reject it.
      if ($result eq "fail") {
         md_syslog ('info', "Received-SPF: $result ($header_comment) " .
              "$spf_record, Helo=$helo");
         return('REJECT', "Access Denied (SPF) [$smtp_comment], " .
              "Relay=$hostname [$ip], Helo=$helo");
      } else {
              return ('CONTINUE', "ok");
      }
      }





-- WorldCALL Webmail

_______________________________________________
Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list
MIMEDefang at lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang

This Email Has Been Anti-Virus Scanned




More information about the MIMEDefang mailing list