You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by he...@apache.org on 2018/09/24 09:53:55 UTC

svn commit: r1841821 - in /spamassassin: branches/3.4/t/dkim.t trunk/rules/25_dkim.cf trunk/rules/50_scores.cf trunk/rulesrc/sandbox/khopesh/20_khop_experimental.cf trunk/t/dkim.t

Author: hege
Date: Mon Sep 24 09:53:55 2018
New Revision: 1841821

URL: http://svn.apache.org/viewvc?rev=1841821&view=rev
Log:
Bug 7610 - Fix and move DKIM_INVALID to official rules

Modified:
    spamassassin/branches/3.4/t/dkim.t
    spamassassin/trunk/rules/25_dkim.cf
    spamassassin/trunk/rules/50_scores.cf
    spamassassin/trunk/rulesrc/sandbox/khopesh/20_khop_experimental.cf
    spamassassin/trunk/t/dkim.t

Modified: spamassassin/branches/3.4/t/dkim.t
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.4/t/dkim.t?rev=1841821&r1=1841820&r2=1841821&view=diff
==============================================================================
--- spamassassin/branches/3.4/t/dkim.t (original)
+++ spamassassin/branches/3.4/t/dkim.t Mon Sep 24 09:53:55 2018
@@ -17,7 +17,7 @@ use constant HAS_DKIM_VERIFIER => eval {
 use Test::More;
 plan skip_all => "Net tests disabled" unless conf_bool('run_net_tests');
 plan skip_all => "Needs Mail::DKIM::Verifier >= 0.31" unless HAS_DKIM_VERIFIER ;
-plan tests => 199;
+plan tests => 226;
 
 BEGIN {
   if (-e 't/test_dir') {
@@ -71,8 +71,8 @@ sub test_samples($$) {
     my $el = $patt_antipatt_list->[0];
     shift @$patt_antipatt_list if @$patt_antipatt_list > 1; # last autorepeats
     my($patt,$anti) = split(m{\s* / \s*}x, $el, 2);
-    %patterns      = map { (" $_ ", $_) } split(' ',$patt);
-    %anti_patterns = map { (" $_ ", $_) } split(' ',$anti);
+    %patterns      = map { (" $_ ", " $_ $fn ") } split(' ',$patt);
+    %anti_patterns = map { (" $_ ", " $_ $fn ") } split(' ',$anti);
     print "Testing sample $fn\n";
     my $spam_report = process_sample_file($fn);
     clear_pattern_counters();
@@ -87,6 +87,7 @@ tstlocalrules("
   dkim_minimum_key_bits 512
   score DKIM_SIGNED          -0.1
   score DKIM_VALID           -0.1
+  score DKIM_INVALID	      0.1
   score DKIM_VALID_AU        -0.1
   score DKIM_ADSP_NXDOMAIN    0.1
   score DKIM_ADSP_DISCARD     0.1
@@ -95,6 +96,7 @@ tstlocalrules("
   score DKIM_ADSP_CUSTOM_MED  0.1
   score DKIM_ADSP_CUSTOM_HIGH 0.1
   header DKIM_ADSP_SEL_TEST   eval:check_dkim_adsp('*', .spamassassin.org)
+  priority DKIM_ADSP_SEL_TEST -100
   score  DKIM_ADSP_SEL_TEST   0.1
   score RAZOR2_CHECK 0
   score RAZOR2_CF_RANGE_51_100 0
@@ -136,7 +138,7 @@ while (defined($fn = readdir(DIR))) {
 }
 closedir(DIR) or die "Error closing directory $dirname: $!";
 @patt_antipatt_list = (
-  'DKIM_SIGNED DKIM_VALID DKIM_VALID_AU / DKIM_ADSP_NXDOMAIN DKIM_ADSP_DISCARD DKIM_ADSP_ALL DKIM_ADSP_SEL_TEST'
+  'DKIM_SIGNED DKIM_VALID DKIM_VALID_AU / DKIM_INVALID DKIM_ADSP_NXDOMAIN DKIM_ADSP_DISCARD DKIM_ADSP_ALL DKIM_ADSP_SEL_TEST'
 );
 test_samples(\@test_filenames, \@patt_antipatt_list);
 
@@ -154,7 +156,7 @@ while (defined($fn = readdir(DIR))) {
   push(@test_filenames, "$dirname/$fn");
 }
 closedir(DIR) or die "Error closing directory $dirname: $!";
-@patt_antipatt_list = ( 'DKIM_SIGNED / DKIM_VALID' );
+@patt_antipatt_list = ( 'DKIM_SIGNED DKIM_INVALID / DKIM_VALID' );
 test_samples(\@test_filenames, \@patt_antipatt_list);
 
 # mail samples test-adsp* should all fail DKIM validation, testing ADSP

Modified: spamassassin/trunk/rules/25_dkim.cf
URL: http://svn.apache.org/viewvc/spamassassin/trunk/rules/25_dkim.cf?rev=1841821&r1=1841820&r2=1841821&view=diff
==============================================================================
--- spamassassin/trunk/rules/25_dkim.cf (original)
+++ spamassassin/trunk/rules/25_dkim.cf Mon Sep 24 09:53:55 2018
@@ -44,6 +44,9 @@ tflags   DKIM_VALID		net nice
 priority DKIM_VALID		-100
 reuse    DKIM_VALID
 
+meta     DKIM_INVALID		DKIM_SIGNED && !DKIM_VALID
+describe DKIM_INVALID		DKIM or DK signature exists, but is not valid
+
 full     DKIM_VALID_AU		eval:check_dkim_valid_author_sig()
 describe DKIM_VALID_AU		Message has a valid DKIM or DK signature from author's domain
 tflags   DKIM_VALID_AU		net nice

Modified: spamassassin/trunk/rules/50_scores.cf
URL: http://svn.apache.org/viewvc/spamassassin/trunk/rules/50_scores.cf?rev=1841821&r1=1841820&r2=1841821&view=diff
==============================================================================
--- spamassassin/trunk/rules/50_scores.cf (original)
+++ spamassassin/trunk/rules/50_scores.cf Mon Sep 24 09:53:55 2018
@@ -728,6 +728,7 @@ score USER_IN_DKIM_WHITELIST -100.000
 score USER_IN_DEF_DKIM_WL -7.500
 score DKIM_SIGNED 0.1
 score DKIM_VALID -0.1
+score DKIM_INVALID 0.1
 score DKIM_VALID_AU -0.1
 
 if (version >= 3.004002)

Modified: spamassassin/trunk/rulesrc/sandbox/khopesh/20_khop_experimental.cf
URL: http://svn.apache.org/viewvc/spamassassin/trunk/rulesrc/sandbox/khopesh/20_khop_experimental.cf?rev=1841821&r1=1841820&r2=1841821&view=diff
==============================================================================
--- spamassassin/trunk/rulesrc/sandbox/khopesh/20_khop_experimental.cf (original)
+++ spamassassin/trunk/rulesrc/sandbox/khopesh/20_khop_experimental.cf Mon Sep 24 09:53:55 2018
@@ -192,13 +192,15 @@ describe UPPERCASE_URI	Link protocol has
 # score	 KHOP_GREYED	0.1
 
 
+# DKIM_INVALID has been moved to 25_dkim.cf!
+#
 # This is useless while __DKIM_EXISTS continues to perform so well.
 # This is useless while ruleqa continues to lack DKIM support.
-ifplugin Mail::SpamAssassin::Plugin::DKIM
-  meta	   DKIM_INVALID	__DKIM_EXISTS && !DKIM_VALID
-  describe DKIM_INVALID	DKIM-Signature header exists but is not valid
-  # masscheck ignores ifplugins and thus always has DKIM_INVALID==__DKIM_EXISTS
-endif
+#ifplugin Mail::SpamAssassin::Plugin::DKIM
+#  meta	   DKIM_INVALID	__DKIM_EXISTS && !DKIM_VALID
+#  describe DKIM_INVALID	DKIM-Signature header exists but is not valid
+#  # masscheck ignores ifplugins and thus always has DKIM_INVALID==__DKIM_EXISTS
+#endif
 
 ifplugin Mail::SpamAssassin::Plugin::MIMEHeader # {
   # probably all over the place, indicating only a MS document is attached,

Modified: spamassassin/trunk/t/dkim.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/dkim.t?rev=1841821&r1=1841820&r2=1841821&view=diff
==============================================================================
--- spamassassin/trunk/t/dkim.t (original)
+++ spamassassin/trunk/t/dkim.t Mon Sep 24 09:53:55 2018
@@ -17,7 +17,7 @@ use constant HAS_DKIM_VERIFIER => eval {
 use Test::More;
 plan skip_all => "Net tests disabled" unless conf_bool('run_net_tests');
 plan skip_all => "Needs Mail::DKIM::Verifier >= 0.31" unless HAS_DKIM_VERIFIER ;
-plan tests => 199;
+plan tests => 226;
 
 BEGIN {
   if (-e 't/test_dir') {
@@ -71,8 +71,8 @@ sub test_samples($$) {
     my $el = $patt_antipatt_list->[0];
     shift @$patt_antipatt_list if @$patt_antipatt_list > 1; # last autorepeats
     my($patt,$anti) = split(m{\s* / \s*}x, $el, 2);
-    %patterns      = map { (" $_ ", $_) } split(' ',$patt);
-    %anti_patterns = map { (" $_ ", $_) } split(' ',$anti);
+    %patterns      = map { (" $_ ", " $_ $fn ") } split(' ',$patt);
+    %anti_patterns = map { (" $_ ", " $_ $fn ") } split(' ',$anti);
     print "Testing sample $fn\n";
     my $spam_report = process_sample_file($fn);
     clear_pattern_counters();
@@ -87,6 +87,7 @@ tstlocalrules("
   dkim_minimum_key_bits 512
   score DKIM_SIGNED          -0.1
   score DKIM_VALID           -0.1
+  score DKIM_INVALID	      0.1
   score DKIM_VALID_AU        -0.1
   score DKIM_ADSP_NXDOMAIN    0.1
   score DKIM_ADSP_DISCARD     0.1
@@ -95,6 +96,7 @@ tstlocalrules("
   score DKIM_ADSP_CUSTOM_MED  0.1
   score DKIM_ADSP_CUSTOM_HIGH 0.1
   header DKIM_ADSP_SEL_TEST   eval:check_dkim_adsp('*', .spamassassin.org)
+  priority DKIM_ADSP_SEL_TEST -100
   score  DKIM_ADSP_SEL_TEST   0.1
   score RAZOR2_CHECK 0
   score RAZOR2_CF_RANGE_51_100 0
@@ -136,7 +138,7 @@ while (defined($fn = readdir(DIR))) {
 }
 closedir(DIR) or die "Error closing directory $dirname: $!";
 @patt_antipatt_list = (
-  'DKIM_SIGNED DKIM_VALID DKIM_VALID_AU / DKIM_ADSP_NXDOMAIN DKIM_ADSP_DISCARD DKIM_ADSP_ALL DKIM_ADSP_SEL_TEST'
+  'DKIM_SIGNED DKIM_VALID DKIM_VALID_AU / DKIM_INVALID DKIM_ADSP_NXDOMAIN DKIM_ADSP_DISCARD DKIM_ADSP_ALL DKIM_ADSP_SEL_TEST'
 );
 test_samples(\@test_filenames, \@patt_antipatt_list);
 
@@ -154,7 +156,7 @@ while (defined($fn = readdir(DIR))) {
   push(@test_filenames, "$dirname/$fn");
 }
 closedir(DIR) or die "Error closing directory $dirname: $!";
-@patt_antipatt_list = ( 'DKIM_SIGNED / DKIM_VALID' );
+@patt_antipatt_list = ( 'DKIM_SIGNED DKIM_INVALID / DKIM_VALID' );
 test_samples(\@test_filenames, \@patt_antipatt_list);
 
 # mail samples test-adsp* should all fail DKIM validation, testing ADSP