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 2019/07/05 15:08:59 UTC

svn commit: r1862620 - in /spamassassin: branches/3.4/UPGRADE branches/3.4/lib/Mail/SpamAssassin/Plugin/RelayCountry.pm trunk/UPGRADE trunk/lib/Mail/SpamAssassin/Plugin/RelayCountry.pm

Author: hege
Date: Fri Jul  5 15:08:59 2019
New Revision: 1862620

URL: http://svn.apache.org/viewvc?rev=1862620&view=rev
Log:
More Bug 7731 tweaks, rename MUA to X-Relay-Countries-Auth

Modified:
    spamassassin/branches/3.4/UPGRADE
    spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/RelayCountry.pm
    spamassassin/trunk/UPGRADE
    spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/RelayCountry.pm

Modified: spamassassin/branches/3.4/UPGRADE
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.4/UPGRADE?rev=1862620&r1=1862619&r2=1862620&view=diff
==============================================================================
--- spamassassin/branches/3.4/UPGRADE (original)
+++ spamassassin/branches/3.4/UPGRADE Fri Jul  5 15:08:59 2019
@@ -47,7 +47,7 @@ Note for Users Upgrading to SpamAssassin
 - Add tflags domains_only/ips_only to DNSEval.pm functions
 
 - RelayCountry: Added new metadata: X-Spam-Countries-External (_RELAYCOUNTRYEXT_),
-  X-Spam-Countries-MUA (_RELAYCOUNTRYMUA_), X-Spam-Countries-All (_RELAYCOUNTRYALL_)
+  X-Spam-Countries-Auth (_RELAYCOUNTRYAUTH_), X-Spam-Countries-All (_RELAYCOUNTRYALL_)
 
 Note for Users Upgrading to SpamAssassin 3.4.2
 ----------------------------------------------

Modified: spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/RelayCountry.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/RelayCountry.pm?rev=1862620&r1=1862619&r2=1862620&view=diff
==============================================================================
--- spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/RelayCountry.pm (original)
+++ spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/RelayCountry.pm Fri Jul  5 15:08:59 2019
@@ -31,10 +31,24 @@ to the message metadata.
 
 Following metadata headers and tags are added:
 
- X-Relay-Countries           _RELAYCOUNTRY_     all untrusted relays
- X-Relay-Countries-External  _RELAYCOUNTRYEXT_  all external relays
- X-Relay-Countries-MUA       _RELAYCOUNTRYMUA_  all relays after first MSA
- X-Relay-Countries-All       _RELAYCOUNTRYALL_  all relays
+ X-Relay-Countries           _RELAYCOUNTRY_
+   All untrusted relays. Contains all relays starting from the
+   trusted_networks border. This method has been used by default since
+   early SA versions.
+
+ X-Relay-Countries-External  _RELAYCOUNTRYEXT_
+   All external relays. Contains all relays starting from the
+   internal_networks border. Could be useful in some cases when
+   trusted/msa_networks extend beyond the internal border and those
+   need to be checked too.
+
+ X-Relay-Countries-All       _RELAYCOUNTRYALL_
+   All possible relays (internal + external).
+
+ X-Relay-Countries-Auth      _RELAYCOUNTRYAUTH_
+   Auth will contain all relays starting from the first relay that used
+   authentication. For example, this could be used to check for hacked
+   local users coming in from unexpected countries.
 
 =head1 REQUIREMENT
 
@@ -335,17 +349,16 @@ sub extract_metadata {
     push @cc_external, $cc;
   }
 
-  my @cc_mua;
-  my $found_msa;
+  my @cc_auth;
+  my $found_auth;
   foreach my $relay (@{$msg->{metadata}->{relays_trusted}}) {
-    if ($relay->{msa}) {
-      $found_msa = 1;
-      next;
+    if ($relay->{auth}) {
+      $found_auth = 1;
     }
-    if ($found_msa) {
+    if ($found_auth) {
       my $ip = $relay->{ip};
       my $cc = $self->get_country($ip, $db, $dbv6, $country_db_type);
-      push @cc_mua, $cc;
+      push @cc_auth, $cc;
     }
   }
 
@@ -364,9 +377,9 @@ sub extract_metadata {
   $msg->put_metadata("X-Relay-Countries-External", $ccstr);
   dbg("metadata: X-Relay-Countries-External: $ccstr");
 
-  $ccstr = join(' ', @cc_mua);
-  $msg->put_metadata("X-Relay-Countries-MUA", $ccstr);
-  dbg("metadata: X-Relay-Countries-MUA: $ccstr");
+  $ccstr = join(' ', @cc_auth);
+  $msg->put_metadata("X-Relay-Countries-Auth", $ccstr);
+  dbg("metadata: X-Relay-Countries-Auth: $ccstr");
 
   $ccstr = join(' ', @cc_all);
   $msg->put_metadata("X-Relay-Countries-All", $ccstr);
@@ -391,8 +404,8 @@ sub parsed_metadata {
                                  @c_list == 1 ? $c_list[0] : \@c_list);
 
   @c_list = split(' ',
-    $opts->{permsgstatus}->get_message->get_metadata('X-Relay-Countries-MUA'));
-  $opts->{permsgstatus}->set_tag("RELAYCOUNTRYMUA",
+    $opts->{permsgstatus}->get_message->get_metadata('X-Relay-Countries-Auth'));
+  $opts->{permsgstatus}->set_tag("RELAYCOUNTRYAUTH",
                                  @c_list == 1 ? $c_list[0] : \@c_list);
 
   @c_list = split(' ',

Modified: spamassassin/trunk/UPGRADE
URL: http://svn.apache.org/viewvc/spamassassin/trunk/UPGRADE?rev=1862620&r1=1862619&r2=1862620&view=diff
==============================================================================
--- spamassassin/trunk/UPGRADE (original)
+++ spamassassin/trunk/UPGRADE Fri Jul  5 15:08:59 2019
@@ -52,7 +52,7 @@ Note for Users Upgrading to SpamAssassin
   migrate to geodb_module/options.
 
 - RelayCountry: Added new metadata: X-Spam-Countries-External (_RELAYCOUNTRYEXT_),
-  X-Spam-Countries-MUA (_RELAYCOUNTRYMUA_), X-Spam-Countries-All (_RELAYCOUNTRYALL_)
+  X-Spam-Countries-Auth (_RELAYCOUNTRYAUTH_), X-Spam-Countries-All (_RELAYCOUNTRYALL_)
 
 - new plugin callback method check_cleanup
 

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/RelayCountry.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/RelayCountry.pm?rev=1862620&r1=1862619&r2=1862620&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/RelayCountry.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/RelayCountry.pm Fri Jul  5 15:08:59 2019
@@ -31,10 +31,24 @@ to the message metadata.
 
 Following metadata headers and tags are added:
 
- X-Relay-Countries           _RELAYCOUNTRY_     all untrusted relays
- X-Relay-Countries-External  _RELAYCOUNTRYEXT_  all external relays
- X-Relay-Countries-MUA       _RELAYCOUNTRYMUA_  all relays after first MSA
- X-Relay-Countries-All       _RELAYCOUNTRYALL_  all relays
+ X-Relay-Countries           _RELAYCOUNTRY_
+   All untrusted relays. Contains all relays starting from the
+   trusted_networks border. This method has been used by default since
+   early SA versions.
+
+ X-Relay-Countries-External  _RELAYCOUNTRYEXT_
+   All external relays. Contains all relays starting from the
+   internal_networks border. Could be useful in some cases when
+   trusted/msa_networks extend beyond the internal border and those
+   need to be checked too.
+
+ X-Relay-Countries-All       _RELAYCOUNTRYALL_
+   All possible relays (internal + external).
+
+ X-Relay-Countries-Auth      _RELAYCOUNTRYAUTH_
+   Auth will contain all relays starting from the first relay that used
+   authentication. For example, this could be used to check for hacked
+   local users coming in from unexpected countries.
 
 =head1 REQUIREMENT
 
@@ -104,17 +118,16 @@ sub extract_metadata {
     push @cc_external, $cc;
   }
 
-  my @cc_mua;
-  my $found_msa;
+  my @cc_auth;
+  my $found_auth;
   foreach my $relay (@{$msg->{metadata}->{relays_trusted}}) {
-    if ($relay->{msa}) {
-      $found_msa = 1;
-      next;
+    if ($relay->{auth}) {
+      $found_auth = 1;
     }
-    if ($found_msa) {
+    if ($found_auth) {
       my $ip = $relay->{ip};
       my $cc = $geodb->get_country($ip);
-      push @cc_mua, $cc;
+      push @cc_auth, $cc;
     }
   }
 
@@ -133,9 +146,9 @@ sub extract_metadata {
   $msg->put_metadata("X-Relay-Countries-External", $ccstr);
   dbg("metadata: X-Relay-Countries-External: $ccstr");
 
-  $ccstr = join(' ', @cc_mua);
-  $msg->put_metadata("X-Relay-Countries-MUA", $ccstr);
-  dbg("metadata: X-Relay-Countries-MUA: $ccstr");
+  $ccstr = join(' ', @cc_auth);
+  $msg->put_metadata("X-Relay-Countries-Auth", $ccstr);
+  dbg("metadata: X-Relay-Countries-Auth: $ccstr");
 
   $ccstr = join(' ', @cc_all);
   $msg->put_metadata("X-Relay-Countries-All", $ccstr);
@@ -158,8 +171,8 @@ sub parsed_metadata {
                                  @c_list == 1 ? $c_list[0] : \@c_list);
 
   @c_list = split(' ',
-    $opts->{permsgstatus}->get_message->get_metadata('X-Relay-Countries-MUA'));
-  $opts->{permsgstatus}->set_tag("RELAYCOUNTRYMUA",
+    $opts->{permsgstatus}->get_message->get_metadata('X-Relay-Countries-Auth'));
+  $opts->{permsgstatus}->set_tag("RELAYCOUNTRYAUTH",
                                  @c_list == 1 ? $c_list[0] : \@c_list);
 
   @c_list = split(' ',