You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by na...@riconcorp.com on 2004/03/02 01:20:30 UTC

I need to write a rule with a 'greater than or equal to' evaluati on.

I've been using Messagewall for a while now, and I decided to throw
SpamAssassin into the mix.  Messagewall is great, but it's not dynamic
enough.

Problem is that I eventually want messagewall to tag messages only, then
pass them on to SA.
Messagewall always adds the header "X-MessageWall-Score: <score>
(<host.domain.tld>)".  I want to write a rule for SpamAssassin that
basically says, "if <score> is greater than or equal to 15, then it's a
match."  Note that <score> can be more than two digits.

This is how far I've gotten in local.cf:

header MW_SPAM X-MessageWall-Score: =~ /^[>=15].*/
score MW_SPAM 1.00

Something's wrong with the expression syntax, and I know nothing of perl so
I haven't been able to figure it out.
Anybody know how to do this sorta thing?

TIA,

Nate

Re: I need to write a rule with a 'greater than or equal to' evaluati on.

Posted by "Adam D. Lopresto" <ad...@pubcrawler.org>.
On Mon, 1 Mar 2004 nate@riconcorp.com wrote:

> I've been using Messagewall for a while now, and I decided to throw
> SpamAssassin into the mix.  Messagewall is great, but it's not dynamic
> enough.
>
> Problem is that I eventually want messagewall to tag messages only, then
> pass them on to SA.
> Messagewall always adds the header "X-MessageWall-Score: <score>
> (<host.domain.tld>)".  I want to write a rule for SpamAssassin that
> basically says, "if <score> is greater than or equal to 15, then it's a
> match."  Note that <score> can be more than two digits.
>
> This is how far I've gotten in local.cf:
>
> header MW_SPAM X-MessageWall-Score: =~ /^[>=15].*/
> score MW_SPAM 1.00

There's no direct way to do that.  The regexp syntax is for text matching, not
numbers.

But you can cheat a little.

header MW_SPAM X-MessageWall-Score: =~ /^(?:1(?:[5-9]|\d\d)|[2-9]\d)/

should do it.  (Untested).

>
> Something's wrong with the expression syntax, and I know nothing of perl so
> I haven't been able to figure it out.
> Anybody know how to do this sorta thing?
>
> TIA,
>
> Nate
>

-- 
Adam Lopresto
http://cec.wustl.edu/~adam/

If you can spend a perfectly useless afternoon in a perfectly useless
manner, you have learned how to live. -Lin Yutang

Re: I need to write a rule with a 'greater than or equal to' evaluati on.

Posted by Bob George <ma...@ttlexceeded.com>.
nate@riconcorp.com wrote:

>I've been using Messagewall for a while now, and I decided to throw
>SpamAssassin into the mix.  Messagewall is great, but it's not dynamic
>enough.
>
>Problem is that I eventually want messagewall to tag messages only, then
>pass them on to SA.
>Messagewall always adds the header "X-MessageWall-Score: <score>
>(<host.domain.tld>)".
>
I'm doing something similar, using bogofilter to cross-check SA scoring. 
Just make sure you add a "bayes_ignore_header X-MessageWall-Score" to 
your SA config if you're using bayes, lest it learn to associate that 
header (regardless of score) with spam.

>I want to write a rule for SpamAssassin that
>basically says, "if <score> is greater than or equal to 15, then it's a
>match."  Note that <score> can be more than two digits.
>
>This is how far I've gotten in local.cf:
>
>header MW_SPAM X-MessageWall-Score: =~ /^[>=15].*/
>score MW_SPAM 1.00
>  
>
Er, hmm. How downright clever of you! I pass incoming messages through 
virus scanning and bayes scripts before spamassassin, but hadn't thought 
about letting good ol' spamassassin do all that hard math stuff for me. 
And it opens up possibilities with metas. Not to mention simplifying 
procmailrc, and scoring recipes.

Good stuff.

- Bob



Re: spamd running but not scanning

Posted by Matthias Fuhrmann <Ma...@stud.uni-hannover.de>.
On Tue, 2 Mar 2004, James Nelson wrote:

> I am having a weird problem where at some point spamd just quits scanning
> email.  There is no particular reason why... any clues?  A restart of the
> daemon gets it back on track.

we have those trouble sometimes if the load of our machine gets way too
high. so its a matter of timeouts. had to set timing higher, so there is
enough time for spamd checking the mail in time.
made due to timing tweaking of the milter app (miltrassassin) within
sendmail.mc

regards,
Matthias

Re: Custom Rule Help

Posted by Matt Kettler <mk...@evi-inc.com>.
At 12:58 PM 3/2/2004, James Nelson wrote:
>Greetings,
>         I am trying to create a custom rule that will take away x pts if an
>email is sent from a particular domain.  Can someone please let me know if
>this is correct syntax?  If not, please correct me.
>
>describe DOMAIN_CHECK   Mail from a particular domain
>header  DOMAIN_CHECK   From =~ /\@domain\.com/i
>score    DOMAIN_CHECK   -2.0

That should work... Of course, there's no forgery protections so any 
spammer knowing you've added that can take advantage of it, but it should work.




Re: Custom Rule Help

Posted by Loren Wilton <lw...@earthlink.net>.
Looks to me like it should work.

Note you could also use whitelist_from, but that subtracts a whole lotta
points.

        Loren

> I am trying to create a custom rule that will take away x pts if an
> email is sent from a particular domain.  Can someone please let me know if
> this is correct syntax?  If not, please correct me.
>
> describe DOMAIN_CHECK   Mail from a particular domain
> header  DOMAIN_CHECK   From =~ /\@domain\.com/i
> score    DOMAIN_CHECK   -2.0


Re: Custom Rule Comparions

Posted by Matt Kettler <mk...@evi-inc.com>.
At 11:09 AM 3/10/2004, James Nelson wrote:
>What comparison operators can be used when making meta rules?  For instance
>the following is using the && operator for testing that both tests are
>passed.  I am assuming then that there is NOTs and ORs, but I can find no
>specific references to the syntax.
>
>
>meta       VALID_PAYPAL_EMAIL          (ONLY_PAYPAL_FROM &&
>MSGID_FROM_MTA_PAYPAL )


See man Mail::SpamAssassin::Conf. It's very well detailed in the section 
describing "meta".


In 2.4x and higher there are 3 operators:
         && - boolean and
         ! - boolean not
         || - boolean or

in 2.5x and higher there are arithmetic operators allowing you to do 
addition, subtraction, multiplication, greater-than, less-than, etc.




Re: [spa] Custom Rule Comparions

Posted by Charles Gregory <cg...@hwcn.org>.
On Wed, 10 Mar 2004, James Nelson wrote:
> What comparison operators can be used when making meta rules? 

Take a look at 

    man Mail::SpamAssassin::Conf 

(Or use 'perldoc' in place of 'man'.....)
The whole document is a trasure-trove of config ideas. 
Search for 'meta' press '/' for the search function, and it will go right
where you want to go.....

- C


Custom Rule Comparions

Posted by James Nelson <ja...@kcnet.com>.
What comparison operators can be used when making meta rules?  For instance
the following is using the && operator for testing that both tests are
passed.  I am assuming then that there is NOTs and ORs, but I can find no
specific references to the syntax.


meta       VALID_PAYPAL_EMAIL          (ONLY_PAYPAL_FROM &&
MSGID_FROM_MTA_PAYPAL )

james


Re: Custom Rule Help

Posted by Dan Bullock <da...@aspitel.com>.
James Nelson wrote:

>Greetings,
>	I am trying to create a custom rule that will take away x pts if an
>email is sent from a particular domain.  Can someone please let me know if
>this is correct syntax?  If not, please correct me.
>
>describe DOMAIN_CHECK   Mail from a particular domain
>header  DOMAIN_CHECK   From =~ /\@domain\.com/i
>score    DOMAIN_CHECK   -2.0
>
>james
>  
>
Someone else on the list helped me with an identical rule.

This should get you what you are looking for.  It will subtract points 
if the mail is from the domain and the message is delivered my an MTA of 
the same domain.  Change the message-id to the correct domain name if it 
isn't the same domain name as the email address.

Dan


## PAYPAL
header     ONLY_PAYPAL_FROM            From =~ /paypal\.com\b/i
describe   ONLY_PAYPAL_FROM            FROM AN PAYPAL ADDRESS
#
header     MSGID_FROM_MTA_PAYPAL       Message-Id =~ /<.*\@\S*paypal\.com>/i
describe   MSGID_FROM_MTA_PAYPAL       Message-Id was added by an 
paypal.com relay
#
meta       VALID_PAYPAL_EMAIL          (ONLY_PAYPAL_FROM && 
MSGID_FROM_MTA_PAYPAL )
describe   VALID_PAYPAL_EMAIL          Valid address and matching sender
score      VALID_PAYPAL_EMAIL          -10.0




In my rules I've actually added a score for the from address, so the 
score will remain increased if the FROM is PAYPAL but the message-id is 
not (possible phishing).  In this case the score is +5 otherwise the 
ruleset adds (5)+(-10)=(-5).


## PAYPAL
header     ONLY_PAYPAL_FROM            From =~ /paypal\.com\b/i
describe   ONLY_PAYPAL_FROM            FROM AN PAYPAL ADDRESS
score      ONLY_PAYPAL_FROM            5.0
#
header     MSGID_FROM_MTA_PAYPAL       Message-Id =~ /<.*\@\S*paypal\.com>/i
describe   MSGID_FROM_MTA_PAYPAL       Message-Id was added by an 
paypal.com relay
#
meta       VALID_PAYPAL_EMAIL          (ONLY_PAYPAL_FROM && 
MSGID_FROM_MTA_PAYPAL )
describe   VALID_PAYPAL_EMAIL          Valid address and matching sender
score      VALID_PAYPAL_EMAIL          -10.0





Custom Rule Help

Posted by James Nelson <ja...@kcnet.com>.
Greetings,
	I am trying to create a custom rule that will take away x pts if an
email is sent from a particular domain.  Can someone please let me know if
this is correct syntax?  If not, please correct me.

describe DOMAIN_CHECK   Mail from a particular domain
header  DOMAIN_CHECK   From =~ /\@domain\.com/i
score    DOMAIN_CHECK   -2.0

james


RE: spamd running but not scanning

Posted by Matthias Fuhrmann <Ma...@stud.uni-hannover.de>.
On Tue, 2 Mar 2004, James Nelson wrote:

> This is the error I am seeing in the log when things start failing:
>
> Feb 29 23:50:09 mail3 spamc[6359]: failed sanity check, 1496 bytes claimed,
> 6188 bytes seen
>
> Any clue what is causing this?

have a look here, maybe its a character enconding problem:
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=78471

regards,
Matthias

RE: spamd running but not scanning

Posted by James Nelson <ja...@kcnet.com>.
This is the error I am seeing in the log when things start failing:

Feb 29 23:50:09 mail3 spamc[6359]: failed sanity check, 1496 bytes claimed,
6188 bytes seen

Any clue what is causing this?


-----Original Message-----
From: James Nelson [mailto:james@kcnet.com] 
Sent: Tuesday, March 02, 2004 8:40 AM
To: spamassassin-users@incubator.apache.org
Subject: spamd running but not scanning

I am having a weird problem where at some point spamd just quits scanning
email.  There is no particular reason why... any clues?  A restart of the
daemon gets it back on track.


spamd running but not scanning

Posted by James Nelson <ja...@kcnet.com>.
I am having a weird problem where at some point spamd just quits scanning
email.  There is no particular reason why... any clues?  A restart of the
daemon gets it back on track.


Two copies of perl...

Posted by James Nelson <ja...@kcnet.com>.
I have read that spamassassin has problems if there are two copies of perl
installed on the server.  When installing 2.60, I used cpan and the thing
installed a newer version of perl.  I believe this is causing both my
problems with bayes and with DNS:NET:RESOLVER.

I know this isn't the best place to ask this, but what is the easiest way to
uninstall the newer copy of perl cpan installed?  Just delete the newer perl
dir and its contents?