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...@bugzilla.spamassassin.org on 2013/04/25 13:27:49 UTC

[Bug 6929] New: rules cannot match X-Spam-ASN

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

            Bug ID: 6929
           Summary: rules cannot match X-Spam-ASN
           Product: Spamassassin
           Version: 3.3.2
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Rules
          Assignee: dev@spamassassin.apache.org
          Reporter: frank@powerweb.de
    Classification: Unclassified

Feature request
---------------

It will be useful to weight incoming mail according to
its origin Autonomous System (AS).

But currently, SA ignores all rules based on header lines
starting with "X-Spam-".

SA will not match any rule based on the
ASN.pm module, what will insert lines like

X-Spam-ASN: AS1234 1.2.3.4/16
X-Spam-Source: 1.2.3.4

because SA either strips all header lines starting
with X-Spam- before applying the rules (and ASN.pm
does run before the stripping) or
ASN.pm runs after the rules are already applied.

Any rule like

header LOCAL_AS1     X-Spam-ASN =~ /^AS1234 /
describe LOCAL_AS1   Sender IP in AS from trustful provider
score LOCAL_AS1      -0.1

is currently ignored.

I suggest that SA uses the following order instead
1) strip all header lines starting with
   X-Spam- from the incoming mail
2) run the ASN.pm module
3) apply the rules including any rule
   basing on the lines included by ASN.pm


Kind regards, Frank

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 6929] rules cannot match X-Spam-ASN

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

--- Comment #2 from Frank Gadegast <fr...@powerweb.de> ---
Would be really nice if somebody could provide a patch to ASN.pm,
which defines metadata, which could be used in a ruleset then.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 6929] rules cannot match X-Spam-ASN

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

--- Comment #5 from Frank Gadegast <fr...@powerweb.de> ---
(In reply to comment #4)
> (In reply to comment #3)
> 
> And still not in a release.

Maybe because the code does not work, tried to integrate it
in SA 3.3.2

A test message produces a header line like this
X-Spam-ASN: ASN _ASN_ _ASNCIDR_
(well, simply not filled with the right values)

and does not trigger a rule like this:

header TEST_AS1234      X-ASN =~ /^AS1234 /
describe TEST_AS1234    Sender IP in AS from friendly network
score TEST_AS1234       -0.1

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 6929] rules cannot match X-Spam-ASN

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

RW <rw...@googlemail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rwmaillists@googlemail.com

--- Comment #1 from RW <rw...@googlemail.com> ---
I don't think this is anything to do with stripping headers.

Header tests against plugins results normally run against a metadata header,
not the header in the output text that's generated from tags. As far as I can
see ASN.pm defines only the tags.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 6929] rules cannot match X-Spam-ASN

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

stef.simoens@scarlet.be changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |stef.simoens@scarlet.be

--- Comment #6 from stef.simoens@scarlet.be ---
Because I was looking for the same; this solution worked for me with
SpamAssassin 3.4.0

With the above example (on AS1234):

header TEST_AS1234      X-ASN =~ /^1234$/
describe TEST_AS1234    Sender IP in AS from friendly network
score TEST_AS1234       -0.1

Note the absence of 'AS' in the X-ASN regex

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 6929] rules cannot match X-Spam-ASN

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

Frank Gadegast <fr...@powerweb.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |frank@powerweb.de

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 6929] rules cannot match X-Spam-ASN

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

--- Comment #4 from RW <rw...@googlemail.com> ---
(In reply to comment #3)

> As far as I can tell the current (trunk) ASN.pm does provide metadata:


More than two years ago

http://svn.apache.org/viewvc?view=revision&revision=1056043

Thu Jan 6 19:53:03 2011 UTC

And still not in a release.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 6929] rules cannot match X-Spam-ASN

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

--- Comment #3 from Mark Martinec <Ma...@ijs.si> ---
(In reply to comment #2)
> Would be really nice if somebody could provide a patch to ASN.pm,
> which defines metadata, which could be used in a ruleset then.

As far as I can tell the current (trunk) ASN.pm does provide metadata:

  if ($any_asn_updates && @asn_tag_data) {
    $pms->{msg}->put_metadata('X-ASN', join(' ',@asn_tag_data));
    my $prefix = $pms->{conf}->{asn_prefix};
    if (defined $prefix && $prefix ne '') { s/^/$prefix/ for @asn_tag_data }
    $pms->set_tag($asn_tag,
                  @asn_tag_data == 1 ? $asn_tag_data[0] : \@asn_tag_data);
  }
  if ($any_route_updates && @route_tag_data) {
    $pms->{msg}->put_metadata('X-ASN-Route', join(' ',@route_tag_data));
    $pms->set_tag($route_tag,
                  @route_tag_data == 1 ? $route_tag_data[0] :
\@route_tag_data);
  }

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 6929] rules cannot match X-Spam-ASN

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

stef.simoens@scarlet.be changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|stef.simoens@scarlet.be     |

-- 
You are receiving this mail because:
You are the assignee for the bug.