You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@issues.apache.org on 2010/06/01 22:03:32 UTC

[Bug 6443] New: RelayCountry rules in local.cf no longer work

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6443

           Summary: RelayCountry rules in local.cf no longer work
           Product: Spamassassin
           Version: 3.3.1
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Plugins
        AssignedTo: dev@spamassassin.apache.org
        ReportedBy: kalebh@accessdeniedinc.com


After upgrading to SpamAssassin 3.3.1, The custom score that's set per country
no longer works. 

In my local.cf file, I have:
add_header all Relay-Country _RELAYCOUNTRY_
header   RELAYCOUNTRY_CN X-relay-countries =~ /CN/
describe RELAYCOUNTRY_CN Relayed through China
score    RELAYCOUNTRY_CN 3.0

In my message headers, it will list the countries like so:
X-Spam-Relay-Country: CN

It will not however add 3 points to the spam score.


I am running CentOS 5.5 on VMware ESX 3.5.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6443] [review] Metadata Headers are Case-Sensitive

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6443

Kevin A. McGrail <km...@pccc.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Status Whiteboard|needs 0 votes               |RTC

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6443] RelayCountry rules in local.cf no longer work

Posted by bu...@issues.apache.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6443

Kaleb <ka...@accessdeniedinc.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kalebh@accessdeniedinc.com

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6443] [review] Metadata Headers are Case-Sensitive

Posted by bu...@issues.apache.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6443

Kevin A. McGrail <km...@pccc.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kmcgrail@pccc.com

--- Comment #8 from Kevin A. McGrail <km...@pccc.com> 2010-06-03 16:59:36 EDT ---
(In reply to comment #7)
> Created an attachment (id=4767)
 --> (https://issues.apache.org/SpamAssassin/attachment.cgi?id=4767) [details]
> Proposed patch to make metadata header fields case-insensitive
> 
> trunk:
>   Bug 6443: Metadata header field names should not be case-sensitive,
>   for consistency with regular (in-message) header field names.
> Sending lib/Mail/SpamAssassin/Conf.pm
> Sending lib/Mail/SpamAssassin/Message.pm
> Sending lib/Mail/SpamAssassin/PerMsgStatus.pm
> Committed revision 951105.

+1.  Definitely RFC compliant to treat headers as case-insensitive as I
understand.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6443] [review] Metadata Headers are Case-Sensitive

Posted by bu...@issues.apache.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6443

Kevin A. McGrail <km...@pccc.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Status Whiteboard|needs 2 votes               |needs 1 votes

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6443] RelayCountry rules in local.cf no longer work

Posted by bu...@issues.apache.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6443

John Hardin <jh...@impsec.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jhardin@impsec.org

--- Comment #1 from John Hardin <jh...@impsec.org> 2010-06-01 16:12:28 EDT ---
(In reply to comment #0)
> header   RELAYCOUNTRY_CN X-relay-countries =~ /CN/

> X-Spam-Relay-Country: CN

Does it work if you use the header it's actually generating in your custom
rule?

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6443] RelayCountry rules in local.cf no longer work

Posted by bu...@issues.apache.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6443

Karsten Bräckelmann <gu...@rudersport.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME

--- Comment #4 from Karsten Bräckelmann <gu...@rudersport.de> 2010-06-01 17:41:16 EDT ---
On second thought, I believe this is not a bug. WORKSFORME.

As I just said, an X-Foo header rule actually matching an X-foo lower-case
header is not documented (not that I could find it), and really is useful only
with headers we do not have control over. That is, even work with headers that
have been added by external relays and *might* be improperly lower-cased.

The X-Relay-Countries header, however, is generated by us and guaranteed to be
upper-cased. No need being liberal about what to accept.

Please feel free to re-open this bug report (and adjusting the Summary), if you
disagree strongly.


(In reply to comment #0)
> After upgrading to SpamAssassin 3.3.1, The custom score that's set per country
> no longer works. 
  ^^^^^^^^^
> header   RELAYCOUNTRY_CN X-relay-countries =~ /CN/

FWIW, this statement is incorrect. This rule as-is did *not* work with 3.2.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6443] [review] Metadata Headers are Case-Sensitive

Posted by bu...@issues.apache.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6443

Henrik Krohns <he...@hege.li> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hege@hege.li

--- Comment #10 from Henrik Krohns <he...@hege.li> 2011-04-25 13:14:55 EDT ---
Note that this "broke" header name compresssion in Bayes.pm. Here's a fix. One
could argue that the whole compression thing is pointless, but that's for
another bug.

--- Bayes.pm  Mon Dec 13 22:10:00 2010
+++ Bayes.pm    Mon Apr 25 20:13:41 2011
@@ -198,8 +198,8 @@
   'Organization'       => '*o',
   'Organisation'        => '*o',
   'Content-Type'       => '*c',
-  'X-Spam-Relays-Trusted' => '*RT',
-  'X-Spam-Relays-Untrusted' => '*RU',
+  'x-spam-relays-trusted' => '*RT',
+  'x-spam-relays-untrusted' => '*RU',
 );

 # How many seconds should the opportunistic_expire lock be valid?

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6443] [review] Metadata Headers are Case-Sensitive

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6443

--- Comment #12 from Henrik Krohns <he...@hege.li> 2011-05-01 18:30:14 UTC ---
Added Bayes.pm fix to trunk:

Sending        lib/Mail/SpamAssassin/Plugin/Bayes.pm
Transmitting file data .
Committed revision 1098383.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6443] RelayCountry rules in local.cf no longer work

Posted by bu...@issues.apache.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6443

--- Comment #3 from Karsten Bräckelmann <gu...@rudersport.de> 2010-06-01 17:28:01 EDT ---
The RelayCountry plugin does indeed add an X-Relay-Countries metadata header.

Comment 0 is (almost) correct and as documented in the wiki page. The docs do
use a properly uppercased version, though.

Unlike real (previously existing) mail headers, which do work in header rules
even with case mis-match -- metadata headers do not. With the latter, the case
is important.

  header RELAYCOUNTRY_XX  X-Relay-Countries =~ /XX/

This uppercase version works.


I am inclined to close this INVALID or something.

I do not for now, though, because of the case-sensitivity of metaheaders unlike
real headers. This is not documented, is it? But then, header rules matching
case-insensitively isn't documented either, just being robust with headers we
have no control over...

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6443] Metadata Headers are Case-Sensitive

Posted by bu...@issues.apache.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6443

--- Comment #7 from Mark Martinec <Ma...@ijs.si> 2010-06-03 14:41:57 EDT ---
Created an attachment (id=4767)
 --> (https://issues.apache.org/SpamAssassin/attachment.cgi?id=4767)
Proposed patch to make metadata header fields case-insensitive

trunk:
  Bug 6443: Metadata header field names should not be case-sensitive,
  for consistency with regular (in-message) header field names.
Sending lib/Mail/SpamAssassin/Conf.pm
Sending lib/Mail/SpamAssassin/Message.pm
Sending lib/Mail/SpamAssassin/PerMsgStatus.pm
Committed revision 951105.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6443] [review] Metadata Headers are Case-Sensitive

Posted by bu...@issues.apache.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6443

--- Comment #9 from Mark Martinec <Ma...@ijs.si> 2010-06-04 20:41:51 EDT ---
A quick reminder (mostly to myself):
The r951354 (from trunk) quick fix needs to be applied
on top of the proposed patch when committing it to 3.3.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6443] [review] Metadata Headers are Case-Sensitive

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6443

Mark Martinec <Ma...@ijs.si> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #14 from Mark Martinec <Ma...@ijs.si> 2011-05-04 14:59:21 UTC ---
Henrik Krohns wrote:
> Note that this "broke" header name compresssion in Bayes.pm. Here's a fix.

Nice catch, thanks!

> +1 for all to 3.3... I guess we'll let Marc commit.

Ok, applied it all to 3.3:

$ svn ci -m 'Bug 6443: Metadata Headers are Case-Sensitive'
Sending lib/Mail/SpamAssassin/Conf.pm
Sending lib/Mail/SpamAssassin/Message.pm
Sending lib/Mail/SpamAssassin/PerMsgStatus.pm
Sending lib/Mail/SpamAssassin/Plugin/Bayes.pm
Committed revision 1099474.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6443] [review] Metadata Headers are Case-Sensitive

Posted by bu...@issues.apache.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6443

--- Comment #11 from Kevin A. McGrail <km...@pccc.com> 2011-04-25 13:27:15 EDT ---
(In reply to comment #10)
> Note that this "broke" header name compresssion in Bayes.pm. Here's a fix. One
> could argue that the whole compression thing is pointless, but that's for
> another bug.
> 
> --- Bayes.pm  Mon Dec 13 22:10:00 2010
> +++ Bayes.pm    Mon Apr 25 20:13:41 2011
> @@ -198,8 +198,8 @@
>    'Organization'       => '*o',
>    'Organisation'        => '*o',
>    'Content-Type'       => '*c',
> -  'X-Spam-Relays-Trusted' => '*RT',
> -  'X-Spam-Relays-Untrusted' => '*RU',
> +  'x-spam-relays-trusted' => '*RT',
> +  'x-spam-relays-untrusted' => '*RU',
>  );
> 
>  # How many seconds should the opportunistic_expire lock be valid?

+1 on this patch as well.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6443] [review] Metadata Headers are Case-Sensitive

Posted by bu...@issues.apache.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6443

Mark Martinec <Ma...@ijs.si> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P5                          |P3
   Target Milestone|Undefined                   |3.3.2
            Summary|Metadata Headers are        |[review] Metadata Headers
                   |Case-Sensitive              |are Case-Sensitive
  Status Whiteboard|                            |needs 2 votes

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6443] Metadata Headers are Case-Sensitive

Posted by bu...@issues.apache.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6443

Karsten Bräckelmann <gu...@rudersport.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P5
             Status|RESOLVED                    |REOPENED
          Component|Plugins                     |Libraries
         Resolution|WORKSFORME                  |
            Summary|RelayCountry rules in       |Metadata Headers are
                   |local.cf no longer work     |Case-Sensitive
           Severity|normal                      |minor

--- Comment #6 from Karsten Bräckelmann <gu...@rudersport.de> 2010-06-01 19:41:04 EDT ---
(In reply to comment #5)
> It is documented in RFC 5322 (ex RFC 2822), section 1.2.2.
> Header field names are case-insensitive.

Ah, good point.

> I'd consider case-sensitivity on meta header field names an anomaly.
> I don't claim that it should necessarily be fixed, but doing so could
> avoid surprises.

Anomaly is about what I had in mind regarding this inconsistency. Convinced.

Reopening, low priority, to be fixed eventually. Adjusting Summary.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6443] RelayCountry rules in local.cf no longer work

Posted by bu...@issues.apache.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6443

--- Comment #2 from Kaleb <ka...@accessdeniedinc.com> 2010-06-01 16:46:10 EDT ---
Please forgive my lack of experience in writing rules.

Here is what I put in my local.cf file:

header   RELAYCOUNTRY_CA X-Spam-Relay-Country =~ /\bCA\b/
describe RELAYCOUNTRY_CA Relayed through Canada
score    RELAYCOUNTRY_CA 0.1

It didn't work however this still showed up in my message headers:
X-Spam-Relay-Country: CA

I've decided to test with Canada instead of China since it's easier to due to
my geographical location.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6443] RelayCountry rules in local.cf no longer work

Posted by bu...@issues.apache.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6443

--- Comment #5 from Mark Martinec <Ma...@ijs.si> 2010-06-01 19:29:21 EDT ---
> As I just said, an X-Foo header rule actually matching an X-foo lower-case
> header is not documented (not that I could find it)

It is documented in RFC 5322 (ex RFC 2822), section 1.2.2.
Header field names are case-insensitive.


> and really is useful only
> with headers we do not have control over. That is, even work with headers that
> have been added by external relays and *might* be improperly lower-cased.
> 
> The X-Relay-Countries header, however, is generated by us and guaranteed to be
> upper-cased. No need being liberal about what to accept.

I'd consider case-sensitivity on meta header field names an anomaly.
I don't claim that it should necessarily be fixed, but doing so could
avoid surprises.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6443] [review] Metadata Headers are Case-Sensitive

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6443

Henrik Krohns <he...@hege.li> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Status Whiteboard|needs 1 votes               |needs 0 votes

--- Comment #13 from Henrik Krohns <he...@hege.li> 2011-05-01 18:35:06 UTC ---
+1 for all to 3.3... I guess we'll let Marc commit.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.