You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2004/03/22 09:16:14 UTC
svn commit: rev 9660 - in incubator/spamassassin/trunk: . lib/Mail/SpamAssassin lib/Mail/SpamAssassin/Plugin rules t
Author: jm
Date: Mon Mar 22 00:16:09 2004
New Revision: 9660
Added:
incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/SPF.pm
incubator/spamassassin/trunk/rules/25_spf.cf
incubator/spamassassin/trunk/t/spf.t (contents, props changed)
Modified:
incubator/spamassassin/trunk/MANIFEST
incubator/spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm
incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/Hashcash.pm
incubator/spamassassin/trunk/rules/25_hashcash.cf
incubator/spamassassin/trunk/rules/50_scores.cf
incubator/spamassassin/trunk/rules/70_testing.cf
incubator/spamassassin/trunk/rules/init.pre
Log:
SPF now providing no FPs or FNs for me that are bug-related; so, promoting to main ruleset. (if you're getting bug-related FPs/FNs, post them please.) also, moved into a plugin and added a test
Modified: incubator/spamassassin/trunk/MANIFEST
==============================================================================
--- incubator/spamassassin/trunk/MANIFEST (original)
+++ incubator/spamassassin/trunk/MANIFEST Mon Mar 22 00:16:09 2004
@@ -321,3 +321,6 @@
rules/init.pre
t/hashcash.t
rules/25_hashcash.cf
+lib/Mail/SpamAssassin/Plugin/SPF.pm
+rules/25_spf.cf
+t/spf.t
Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm (original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm Mon Mar 22 00:16:09 2004
@@ -3213,199 +3213,6 @@
}
###########################################################################
-
-# SPF support
-sub check_for_spf_pass {
- my ($self) = @_;
- $self->_check_spf(0) unless $self->{spf_checked};
- $self->{spf_pass};
-}
-
-sub check_for_spf_fail {
- my ($self) = @_;
- $self->_check_spf(0) unless $self->{spf_checked};
- if ($self->{spf_failure_comment}) {
- $self->test_log ($self->{spf_failure_comment});
- }
- $self->{spf_fail};
-}
-
-sub check_for_spf_softfail {
- my ($self) = @_;
- $self->_check_spf(0) unless $self->{spf_checked};
- if ($self->{spf_failure_comment}) {
- $self->test_log ($self->{spf_failure_comment});
- }
- $self->{spf_softfail};
-}
-
-sub check_for_spf_helo_pass {
- my ($self) = @_;
- $self->_check_spf(1) unless $self->{spf_helo_checked};
- $self->{spf_helo_pass};
-}
-
-sub check_for_spf_helo_fail {
- my ($self) = @_;
- $self->_check_spf(1) unless $self->{spf_helo_checked};
- if ($self->{spf_helo_failure_comment}) {
- $self->test_log ($self->{spf_helo_failure_comment});
- }
- $self->{spf_helo_fail};
-}
-
-sub check_for_spf_helo_softfail {
- my ($self) = @_;
- $self->_check_spf(1) unless $self->{spf_helo_checked};
- if ($self->{spf_helo_failure_comment}) {
- $self->test_log ($self->{spf_helo_failure_comment});
- }
- $self->{spf_helo_softfail};
-}
-
-sub _check_spf {
- my ($self, $ishelo) = @_;
-
- return unless $self->is_dns_available();
-
- # skip SPF checks if the A/MX records are nonexistent for the From
- # domain, anyway, to avoid crappy messages from slowing us down
- # (bug 3016)
- return if $self->check_for_from_dns();
-
- if ($ishelo) {
- # SPF HELO-checking variant. This isn't really SPF at all ;)
- $self->{spf_helo_checked} = 1;
- $self->{spf_helo_pass} = 0;
- $self->{spf_helo_fail} = 0;
- $self->{spf_helo_softfail} = 0;
- $self->{spf_helo_failure_comment} = undef;
- } else {
- # "real" SPF; checking the envelope-from (where we can)
- $self->{spf_checked} = 1;
- $self->{spf_pass} = 0;
- $self->{spf_fail} = 0;
- $self->{spf_softfail} = 0;
- $self->{spf_failure_comment} = undef;
- }
-
- my $lasthop = $self->{relays_untrusted}->[0];
- if (!defined $lasthop) {
- dbg ("SPF: message was delivered entirely via trusted relays, not required");
- return;
- }
-
- my $ip = $lasthop->{ip};
- my $helo = $lasthop->{helo};
- my $sender = '';
-
- if ($ishelo) {
- dbg ("SPF: checking HELO (helo=$helo, ip=$ip)");
- $helo = Mail::SpamAssassin::Util::trim_domain_to_registrar_boundary ($helo);
- dbg ("SPF: trimmed HELO down to '$helo'");
-
- } else {
- $sender = $lasthop->{envfrom};
-
- if ($sender) {
- dbg ("SPF: found Envelope-From in last untrusted Received header");
- }
- else {
- # We cannot use the env-from data, since it went through 1 or
- # more relays since the untrusted sender and they may have
- # rewritten it.
- #
- if ($self->{num_relays_trusted} > 0) {
- dbg ("SPF: relayed through one or more trusted relays, cannot use header-based Envelope-From, skipping");
- return;
- }
-
- # we can (apparently) use whatever the current Envelope-From was,
- # from the Return-Path, X-Envelope-From, or whatever header.
- # it's better to get it from Received though, as that is updated
- # hop-by-hop.
- #
- $sender = $self->get ("EnvelopeFrom");
- }
-
- if (!$sender) {
- dbg ("SPF: cannot get Envelope-From, cannot use SPF");
- return;
- }
- dbg ("SPF: checking EnvelopeFrom (helo=$helo, ip=$ip, envfrom=$sender)");
- }
-
- if (!$ip || !$helo) {
- dbg ("SPF: cannot get IP or HELO, cannot use SPF");
- return;
- }
-
- if ($self->server_failed_to_respond_for_domain($helo)) {
- dbg ("SPF: we had a previous timeout on '$helo', skipping");
- return;
- }
-
- my $query;
- eval {
- require Mail::SPF::Query;
- $query = Mail::SPF::Query->new (ip => $ip, sender => $sender, helo => $helo,
- debug => $Mail::SpamAssassin::DEBUG->{rbl},
- trusted => 1
- );
- };
-
- if ($@) {
- dbg ("SPF: cannot load or create Mail::SPF::Query module");
- return;
- }
-
- my ($result, $comment);
- my $timeout = 5;
-
- eval {
- local $SIG{ALRM} = sub { die "__alarm__\n" };
- alarm($timeout);
- ($result, $comment) = $query->result();
- alarm(0);
- };
-
- alarm 0;
-
- if ($@) {
- if ($@ =~ /^__alarm__$/) {
- dbg ("SPF: lookup timed out after $timeout secs.");
- } else {
- warn ("SPF: lookup failed: $@\n");
- }
- return 0;
- }
-
- $result ||= 'softfail';
- $comment ||= '';
- $comment =~ s/\s+/ /gs; # no newlines please
-
- if ($ishelo) {
- if ($result eq 'pass') { $self->{spf_helo_pass} = 1; }
- elsif ($result eq 'fail') { $self->{spf_helo_fail} = 1; }
- elsif ($result eq 'softfail') { $self->{spf_helo_softfail} = 1; }
-
- if ($result eq 'fail' || $result eq 'softfail') {
- $self->{spf_helo_failure_comment} = "SPF failed: $comment";
- }
- } else {
- if ($result eq 'pass') { $self->{spf_pass} = 1; }
- elsif ($result eq 'fail') { $self->{spf_fail} = 1; }
- elsif ($result eq 'softfail') { $self->{spf_softfail} = 1; }
-
- if ($result eq 'fail' || $result eq 'softfail') {
- $self->{spf_failure_comment} = "SPF failed: $comment";
- }
- }
-
- dbg ("SPF: query for $sender/$ip/$helo: result: $result, comment: $comment");
-}
-
-###########################################################################
# HTML parser tests
###########################################################################
Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/Hashcash.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/Hashcash.pm (original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/Hashcash.pm Mon Mar 22 00:16:09 2004
@@ -1,12 +1,27 @@
=head1 NAME
-Hashcash - add message metadata indicating the country code of each relay
+Mail::SpamAssassin::Plugin::Hashcash - perform hashcash verification tests
=head1 SYNOPSIS
loadplugin Mail::SpamAssassin::Plugin::Hashcash
=cut
+# <@LICENSE>
+# Copyright 2004 Apache Software Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# </...@LICENSE>
package Mail::SpamAssassin::Plugin::Hashcash;
Added: incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/SPF.pm
==============================================================================
--- (empty file)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/SPF.pm Mon Mar 22 00:16:09 2004
@@ -0,0 +1,254 @@
+=head1 NAME
+
+Mail::SpamAssassin::Plugin::SPF - perform SPF verification tests
+
+=head1 SYNOPSIS
+
+ loadplugin Mail::SpamAssassin::Plugin::SPF
+
+=cut
+# <@LICENSE>
+# Copyright 2004 Apache Software Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# </...@LICENSE>
+
+package Mail::SpamAssassin::Plugin::SPF;
+
+use Mail::SpamAssassin::Plugin;
+use strict;
+use bytes;
+
+use vars qw(@ISA);
+@ISA = qw(Mail::SpamAssassin::Plugin);
+
+# constructor: register the eval rule
+sub new {
+ my $class = shift;
+ my $mailsaobject = shift;
+
+ # some boilerplate...
+ $class = ref($class) || $class;
+ my $self = $class->SUPER::new($mailsaobject);
+ bless ($self, $class);
+
+ my $conf = $mailsaobject->{conf};
+
+ $self->register_eval_rule ("check_for_spf_pass");
+ $self->register_eval_rule ("check_for_spf_fail");
+ $self->register_eval_rule ("check_for_spf_softfail");
+ $self->register_eval_rule ("check_for_spf_helo_pass");
+ $self->register_eval_rule ("check_for_spf_helo_fail");
+ $self->register_eval_rule ("check_for_spf_helo_softfail");
+
+ return $self;
+}
+
+###########################################################################
+
+# SPF support
+sub check_for_spf_pass {
+ my ($self, $scanner) = @_;
+ $self->_check_spf ($scanner, 0) unless $scanner->{spf_checked};
+ $scanner->{spf_pass};
+}
+
+sub check_for_spf_fail {
+ my ($self, $scanner) = @_;
+ $self->_check_spf ($scanner, 0) unless $scanner->{spf_checked};
+ if ($scanner->{spf_failure_comment}) {
+ $scanner->test_log ($scanner->{spf_failure_comment});
+ }
+ $scanner->{spf_fail};
+}
+
+sub check_for_spf_softfail {
+ my ($self, $scanner) = @_;
+ $self->_check_spf ($scanner, 0) unless $scanner->{spf_checked};
+ if ($scanner->{spf_failure_comment}) {
+ $scanner->test_log ($scanner->{spf_failure_comment});
+ }
+ $scanner->{spf_softfail};
+}
+
+sub check_for_spf_helo_pass {
+ my ($self, $scanner) = @_;
+ $self->_check_spf ($scanner, 1) unless $scanner->{spf_helo_checked};
+ $scanner->{spf_helo_pass};
+}
+
+sub check_for_spf_helo_fail {
+ my ($self, $scanner) = @_;
+ $self->_check_spf ($scanner, 1) unless $scanner->{spf_helo_checked};
+ if ($scanner->{spf_helo_failure_comment}) {
+ $scanner->test_log ($scanner->{spf_helo_failure_comment});
+ }
+ $scanner->{spf_helo_fail};
+}
+
+sub check_for_spf_helo_softfail {
+ my ($self, $scanner) = @_;
+ $self->_check_spf ($scanner, 1) unless $scanner->{spf_helo_checked};
+ if ($scanner->{spf_helo_failure_comment}) {
+ $scanner->test_log ($scanner->{spf_helo_failure_comment});
+ }
+ $scanner->{spf_helo_softfail};
+}
+
+sub _check_spf {
+ my ($self, $scanner, $ishelo) = @_;
+
+ return unless $scanner->is_dns_available();
+
+ # skip SPF checks if the A/MX records are nonexistent for the From
+ # domain, anyway, to avoid crappy messages from slowing us down
+ # (bug 3016)
+ return if $scanner->check_for_from_dns();
+
+ if ($ishelo) {
+ # SPF HELO-checking variant. This isn't really SPF at all ;)
+ $scanner->{spf_helo_checked} = 1;
+ $scanner->{spf_helo_pass} = 0;
+ $scanner->{spf_helo_fail} = 0;
+ $scanner->{spf_helo_softfail} = 0;
+ $scanner->{spf_helo_failure_comment} = undef;
+ } else {
+ # "real" SPF; checking the envelope-from (where we can)
+ $scanner->{spf_checked} = 1;
+ $scanner->{spf_pass} = 0;
+ $scanner->{spf_fail} = 0;
+ $scanner->{spf_softfail} = 0;
+ $scanner->{spf_failure_comment} = undef;
+ }
+
+ my $lasthop = $scanner->{relays_untrusted}->[0];
+ if (!defined $lasthop) {
+ dbg ("SPF: message was delivered entirely via trusted relays, not required");
+ return;
+ }
+
+ my $ip = $lasthop->{ip};
+ my $helo = $lasthop->{helo};
+ my $sender = '';
+
+ if ($ishelo) {
+ dbg ("SPF: checking HELO (helo=$helo, ip=$ip)");
+ $helo = Mail::SpamAssassin::Util::trim_domain_to_registrar_boundary ($helo);
+ dbg ("SPF: trimmed HELO down to '$helo'");
+
+ } else {
+ $sender = $lasthop->{envfrom};
+
+ if ($sender) {
+ dbg ("SPF: found Envelope-From in last untrusted Received header");
+ }
+ else {
+ # We cannot use the env-from data, since it went through 1 or
+ # more relays since the untrusted sender and they may have
+ # rewritten it.
+ #
+ if ($scanner->{num_relays_trusted} > 0) {
+ dbg ("SPF: relayed through one or more trusted relays, cannot use header-based Envelope-From, skipping");
+ return;
+ }
+
+ # we can (apparently) use whatever the current Envelope-From was,
+ # from the Return-Path, X-Envelope-From, or whatever header.
+ # it's better to get it from Received though, as that is updated
+ # hop-by-hop.
+ #
+ $sender = $scanner->get ("EnvelopeFrom");
+ }
+
+ if (!$sender) {
+ dbg ("SPF: cannot get Envelope-From, cannot use SPF");
+ return;
+ }
+ dbg ("SPF: checking EnvelopeFrom (helo=$helo, ip=$ip, envfrom=$sender)");
+ }
+
+ if (!$ip || !$helo) {
+ dbg ("SPF: cannot get IP or HELO, cannot use SPF");
+ return;
+ }
+
+ if ($scanner->server_failed_to_respond_for_domain($helo)) {
+ dbg ("SPF: we had a previous timeout on '$helo', skipping");
+ return;
+ }
+
+ my $query;
+ eval {
+ require Mail::SPF::Query;
+ $query = Mail::SPF::Query->new (ip => $ip, sender => $sender, helo => $helo,
+ debug => $Mail::SpamAssassin::DEBUG->{rbl},
+ trusted => 1
+ );
+ };
+
+ if ($@) {
+ dbg ("SPF: cannot load or create Mail::SPF::Query module");
+ return;
+ }
+
+ my ($result, $comment);
+ my $timeout = 5;
+
+ eval {
+ local $SIG{ALRM} = sub { die "__alarm__\n" };
+ alarm($timeout);
+ ($result, $comment) = $query->result();
+ alarm(0);
+ };
+
+ alarm 0;
+
+ if ($@) {
+ if ($@ =~ /^__alarm__$/) {
+ dbg ("SPF: lookup timed out after $timeout secs.");
+ } else {
+ warn ("SPF: lookup failed: $@\n");
+ }
+ return 0;
+ }
+
+ $result ||= 'softfail';
+ $comment ||= '';
+ $comment =~ s/\s+/ /gs; # no newlines please
+
+ if ($ishelo) {
+ if ($result eq 'pass') { $scanner->{spf_helo_pass} = 1; }
+ elsif ($result eq 'fail') { $scanner->{spf_helo_fail} = 1; }
+ elsif ($result eq 'softfail') { $scanner->{spf_helo_softfail} = 1; }
+
+ if ($result eq 'fail' || $result eq 'softfail') {
+ $scanner->{spf_helo_failure_comment} = "SPF failed: $comment";
+ }
+ } else {
+ if ($result eq 'pass') { $scanner->{spf_pass} = 1; }
+ elsif ($result eq 'fail') { $scanner->{spf_fail} = 1; }
+ elsif ($result eq 'softfail') { $scanner->{spf_softfail} = 1; }
+
+ if ($result eq 'fail' || $result eq 'softfail') {
+ $scanner->{spf_failure_comment} = "SPF failed: $comment";
+ }
+ }
+
+ dbg ("SPF: query for $sender/$ip/$helo: result: $result, comment: $comment");
+}
+
+###########################################################################
+
+sub dbg { Mail::SpamAssassin::dbg (@_); }
+
+1;
Modified: incubator/spamassassin/trunk/rules/25_hashcash.cf
==============================================================================
--- incubator/spamassassin/trunk/rules/25_hashcash.cf (original)
+++ incubator/spamassassin/trunk/rules/25_hashcash.cf Mon Mar 22 00:16:09 2004
@@ -40,13 +40,20 @@
tflags HASHCASH_24 nice userconf
tflags HASHCASH_25 nice userconf
tflags HASHCASH_HIGH nice userconf
+describe HASHCASH_20 Contains valid Hashcash token (20 bits)
+describe HASHCASH_21 Contains valid Hashcash token (21 bits)
+describe HASHCASH_22 Contains valid Hashcash token (22 bits)
+describe HASHCASH_23 Contains valid Hashcash token (23 bits)
+describe HASHCASH_24 Contains valid Hashcash token (24 bits)
+describe HASHCASH_25 Contains valid Hashcash token (25 bits)
+describe HASHCASH_HIGH Contains valid Hashcash token (>25 bits)
# This should NOT be a high score; it's possible for this to happen if
# a mail is sent to a list, and CC'd to you. However, if it does fire,
# it'll cancel out the hashcash "bonus" rule.
#
header HASHCASH_2SPEND eval:check_hashcash_double_spend()
-describe HASHCASH_2SPEND HashCash token already spent in another mail
+describe HASHCASH_2SPEND Hashcash token already spent in another mail
tflags HASHCASH_2SPEND userconf
endif # Mail::SpamAssassin::Plugin::Hashcash
Added: incubator/spamassassin/trunk/rules/25_spf.cf
==============================================================================
--- (empty file)
+++ incubator/spamassassin/trunk/rules/25_spf.cf Mon Mar 22 00:16:09 2004
@@ -0,0 +1,59 @@
+# SpamAssassin - SPF rules
+#
+# Please don't modify this file as your changes will be overwritten with
+# the next update. Use @@LOCAL_RULES_DIR@@/local.cf instead.
+# See 'perldoc Mail::SpamAssassin::Conf' for details.
+#
+# <@LICENSE>
+# Copyright 2004 Apache Software Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# </...@LICENSE>
+#
+###########################################################################
+
+# Requires the Mail::SpamAssassin::Plugin::SPF plugin be loaded.
+
+ifplugin Mail::SpamAssassin::Plugin::SPF
+
+# SPF support. "pass" is nice, "fail" is bad, "softfail" is bad, but
+# not as bad as "fail". ;) These are more trustworthy results than
+# the SPF_HELO rules.
+
+header SPF_PASS eval:check_for_spf_pass()
+header SPF_FAIL eval:check_for_spf_fail()
+header SPF_SOFTFAIL eval:check_for_spf_softfail()
+
+# NOTE: SPF_HELO_PASS is not incredibly hard to fake, so shouldn't
+# provide much in the way of points compared to SPF_PASS et al.
+# However, a *failure* is still a very good spamsign.
+
+header SPF_HELO_PASS eval:check_for_spf_helo_pass()
+header SPF_HELO_FAIL eval:check_for_spf_helo_fail()
+header SPF_HELO_SOFTFAIL eval:check_for_spf_helo_softfail()
+
+describe SPF_PASS SPF: sender matches SPF record
+describe SPF_FAIL SPF: sender does not match SPF record (fail)
+describe SPF_SOFTFAIL SPF: sender does not match SPF record (softfail)
+describe SPF_HELO_PASS SPF: HELO matches SPF record
+describe SPF_HELO_FAIL SPF: HELO does not match SPF record (fail)
+describe SPF_HELO_SOFTFAIL SPF: HELO does not match SPF record (softfail)
+
+tflags SPF_PASS net nice
+tflags SPF_FAIL net
+tflags SPF_SOFTFAIL net
+tflags SPF_HELO_PASS net nice
+tflags SPF_HELO_FAIL net
+tflags SPF_HELO_SOFTFAIL net
+
+endif # Mail::SpamAssassin::Plugin::SPF
Modified: incubator/spamassassin/trunk/rules/50_scores.cf
==============================================================================
--- incubator/spamassassin/trunk/rules/50_scores.cf (original)
+++ incubator/spamassassin/trunk/rules/50_scores.cf Mon Mar 22 00:16:09 2004
@@ -938,3 +938,15 @@
score HASHCASH_2SPEND 0.1
endif # Mail::SpamAssassin::Plugin::Hashcash
+#
+# SPF
+#
+ifplugin Mail::SpamAssassin::Plugin::SPF
+score SPF_PASS -1.0
+score SPF_FAIL 1.0
+score SPF_SOFTFAIL 0.5
+score SPF_HELO_PASS -0.5
+score SPF_HELO_FAIL 1.0
+score SPF_HELO_SOFTFAIL 0.5
+endif # Mail::SpamAssassin::Plugin::SPF
+
Modified: incubator/spamassassin/trunk/rules/70_testing.cf
==============================================================================
--- incubator/spamassassin/trunk/rules/70_testing.cf (original)
+++ incubator/spamassassin/trunk/rules/70_testing.cf Mon Mar 22 00:16:09 2004
@@ -24,30 +24,6 @@
# limitations under the License.
# </...@LICENSE>
#
-###########################################################################
-# SPF support. "pass" is nice, "fail" is bad, "softfail" is bad, but
-# not as bad as "fail".
-
-header T_SPF_PASS eval:check_for_spf_pass()
-tflags T_SPF_PASS net nice
-score T_SPF_PASS -0.1
-header T_SPF_FAIL eval:check_for_spf_fail()
-tflags T_SPF_FAIL net
-score T_SPF_FAIL 0.2
-header T_SPF_SOFTFAIL eval:check_for_spf_softfail()
-tflags T_SPF_SOFTFAIL net
-score T_SPF_SOFTFAIL 0.1
-
-header T_SPF_HELO_PASS eval:check_for_spf_helo_pass()
-tflags T_SPF_HELO_PASS net nice
-score T_SPF_HELO_PASS -0.1
-header T_SPF_HELO_FAIL eval:check_for_spf_helo_fail()
-tflags T_SPF_HELO_FAIL net
-score T_SPF_HELO_FAIL 0.2
-header T_SPF_HELO_SOFTFAIL eval:check_for_spf_helo_softfail()
-tflags T_SPF_HELO_SOFTFAIL net
-score T_SPF_HELO_SOFTFAIL 0.1
-
########################################################################
# rules to detect certain generally unnecessary encodings in HTML
Modified: incubator/spamassassin/trunk/rules/init.pre
==============================================================================
--- incubator/spamassassin/trunk/rules/init.pre (original)
+++ incubator/spamassassin/trunk/rules/init.pre Mon Mar 22 00:16:09 2004
@@ -24,3 +24,7 @@
#
loadplugin Mail::SpamAssassin::Plugin::Hashcash
+# SPF - perform SPF verification.
+#
+loadplugin Mail::SpamAssassin::Plugin::SPF
+
Added: incubator/spamassassin/trunk/t/spf.t
==============================================================================
--- (empty file)
+++ incubator/spamassassin/trunk/t/spf.t Mon Mar 22 00:16:09 2004
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+
+use lib '.'; use lib 't';
+use SATest; sa_t_init("spf");
+use Test;
+
+use constant HAS_SPFQUERY => eval { require Mail::SPF::Query; };
+
+BEGIN {
+
+ plan tests => (HAS_SPFQUERY ? 2 : 0);
+
+};
+
+exit unless HAS_SPFQUERY;
+
+# ---------------------------------------------------------------------------
+
+%patterns = (
+ q{ SPF_HELO_PASS }, 'helo_pass',
+ q{ SPF_PASS }, 'pass',
+);
+
+sarun ("-t < data/nice/spf1", \&patterns_run_cb);
+ok_all_patterns();
+