Re: Troubles writing rules
Arne Hoffmann wrote: > Emmanuel Lesouef wrote: > > >> body LOCAL_DEMONSTRATION_RULE /test/ >> score LOCAL_DEMONSTRATION_RULE 1.000 >> describe LOCAL_DEMONSTRATION_RULE This is a simple test rule >> >> The problem is that the rule doesn't seems to be parsed. >> > > Yes, if you want to match 'test' in the Subject, you need a header rule: > > header LOCAL_DEMONSTRATION_RULE/test/ > score LOCAL_DEMONSTRATION_RULE1.000 > describeLOCAL_DEMONSTRATION_RULEThis is a simple test rule > First, Arne, that header rule is invalid, you forgot to specify what header to match. If you want to match subject headers, but not the body: header LOCAL_DEMONSTRATION_RULE Subject =~ /test/ If you wanted to match all headers header LOCAL_DEMONSTRATION_RULE ALL =~ /test/ Second, body rules *WILL* match the subject line of a message. Therefore you do NOT need a header rule. (99.9% of body rules are looking for common message text that could appear in either the body or the subject. Rather than forcing the ruleset to be doubled-up with both body and subject rules looking for the same text, body rules were made to match both) Finally, Emmanuel's real probem is that he didn't restart amavis after modifying his local.cf. Anyone using spamd, or a tool like amavis that uses the perl API, will need to restart it in order for local.cf to be re-parsed. This has the positive side-effect of letting you run spamassassin --lint on your rules after editing them before they "go live", but the real purpose is to save the overhead of constantly checking or re-reading this file.
Re: Troubles writing rules
Le lundi 18 juin 2007 à 03:45 -0700, Loren Wilton a écrit : > > header LOCAL_DEMONSTRATION_RULE/test/ > > score LOCAL_DEMONSTRATION_RULE1.000 > > describeLOCAL_DEMONSTRATION_RULEThis is a simple test rule > > > > AFAIK there are four different types of rules: body, rawbody, header and > > full. > > Yes, if you want to match 'test' in the Subject, you need a header rule: > > Generally true, but not in this case. The subject is prepended to the body, > so either a header rule for Subject or a body rule will hit on it. (But not > a rawbody rule, I believe.) > > > To the OP: did you restart SA so it will pick up the new rules you wrote? > In your case that would probably mean restarting Amvis, unless it has some > command to restart SA internally. > > Loren > > Great ! Works like a charm. I had to restart amavis in order to force the local.cf rules to be taken care of. Thanks all. -- Emmanuel Lesouef CRBN | DSI t : 0231069671 m : [EMAIL PROTECTED]
Re: Troubles writing rules
header LOCAL_DEMONSTRATION_RULE/test/ score LOCAL_DEMONSTRATION_RULE1.000 describeLOCAL_DEMONSTRATION_RULEThis is a simple test rule AFAIK there are four different types of rules: body, rawbody, header and full. Yes, if you want to match 'test' in the Subject, you need a header rule: Generally true, but not in this case. The subject is prepended to the body, so either a header rule for Subject or a body rule will hit on it. (But not a rawbody rule, I believe.) To the OP: did you restart SA so it will pick up the new rules you wrote? In your case that would probably mean restarting Amvis, unless it has some command to restart SA internally. Loren
Re: Troubles writing rules
Emmanuel Lesouef wrote: > So, the local.cf file is read when using the CLI but not when Amavis > invokes SA. I don't know too much about amavisd-new, but on my machines amavis does read /etc/spamassassin/local.cf. But the file has to be readable for the user that amavisd-new runs as. You could also put your rule into user_prefs. If your amavisd-new runs as user amavis and $HOME is /var/lib/amavis, then put the rule in /var/lib/amavis/.spamassassin/user_prefs. If that doesn't work, you might want to ask on [EMAIL PROTECTED]
Re: Troubles writing rules
Le lundi 18 juin 2007 à 10:49 +0200, Arne Hoffmann a écrit : > Emmanuel Lesouef wrote: > > > > Yes, if you want to match 'test' in the Subject, you need a header rule: > > > > > > header LOCAL_DEMONSTRATION_RULE/test/ > > > score LOCAL_DEMONSTRATION_RULE1.000 > > > describeLOCAL_DEMONSTRATION_RULEThis is a simple test rule > > > > > > > > > AFAIK there are four different types of rules: body, rawbody, header and > > > full. > > > > In fact, I already tested that. It doesn't work either. > > Well, I was too fast and didn't think. Sorry. It has to be: > > header LOCAL_DEMONSTRATION_RULESubject =~ /test/ > score LOCAL_DEMONSTRATION_RULE0.001 > describeLOCAL_DEMONSTRATION_RULEThis is a simple test rule > > > > I'm thinking about my local.cf is not read. > > Try with: spamassassin -D --local &1 | grep local.cf Ok, moving forward ;) Thanks for your help. Here is more infos : adele:~# spamassassin -D --local &1 | grep local.cf [1875] dbg: config: read file /etc/spamassassin/local.cf So, when invoking spamassassin from the command line, the local.cf is read. Let's try another command : adele:~# spamassassin -D --local &1 | grep LOCAL_DEMONSTRATION_RULE [1892] dbg: rules: ran header rule LOCAL_DEMONSTRATION_RULE ==> got hit: "test" [1892] dbg: check: tests=AWL,BAYES_00,LOCAL_DEMONSTRATION_RULE,NO_RECEIVED,NO_RELAYS LOCAL_DEMONSTRATION_RULE,NO_RECEIVED,NO_RELAYS autolearn=unavailable So, the local.cf file is read when using the CLI but not when Amavis invokes SA. -- Emmanuel Lesouef CRBN | DSI t : 0231069671 m : [EMAIL PROTECTED]
Re: Troubles writing rules
Emmanuel Lesouef wrote: > > Yes, if you want to match 'test' in the Subject, you need a header rule: > > > > header LOCAL_DEMONSTRATION_RULE/test/ > > score LOCAL_DEMONSTRATION_RULE1.000 > > describeLOCAL_DEMONSTRATION_RULEThis is a simple test rule > > > > > > AFAIK there are four different types of rules: body, rawbody, header and > > full. > > In fact, I already tested that. It doesn't work either. Well, I was too fast and didn't think. Sorry. It has to be: header LOCAL_DEMONSTRATION_RULESubject =~ /test/ score LOCAL_DEMONSTRATION_RULE0.001 describeLOCAL_DEMONSTRATION_RULEThis is a simple test rule > I'm thinking about my local.cf is not read. Try with: spamassassin -D --local &1 | grep local.cf
Re: Troubles writing rules
Le lundi 18 juin 2007 à 10:37 +0200, Arne Hoffmann a écrit : > Emmanuel Lesouef wrote: > > > body LOCAL_DEMONSTRATION_RULE /test/ > > score LOCAL_DEMONSTRATION_RULE 1.000 > > describe LOCAL_DEMONSTRATION_RULE This is a simple test rule > > > > The problem is that the rule doesn't seems to be parsed. > > > > For example, here are the spamassassin headers for an email that > > contains "test" in the subject : > > > > X-Spam-Score: -0.167 > > X-Spam-Level: > > X-Spam-Status: No, score=-0.167 required=5 tests=[AWL=0.386, > > BAYES_00=-2.599, RCVD_IN_SORBS_DUL=2.046] > > > > Any good advices on this ? > > Yes, if you want to match 'test' in the Subject, you need a header rule: > > header LOCAL_DEMONSTRATION_RULE/test/ > score LOCAL_DEMONSTRATION_RULE1.000 > describeLOCAL_DEMONSTRATION_RULEThis is a simple test rule > > > AFAIK there are four different types of rules: body, rawbody, header and > full. In fact, I already tested that. It doesn't work either. I'm thinking about my local.cf is not read. Does it helps if I say I'm using Amavis ? -- Emmanuel Lesouef CRBN | DSI t : 0231069671 m : [EMAIL PROTECTED]
Re: Troubles writing rules
Emmanuel Lesouef wrote: > body LOCAL_DEMONSTRATION_RULE /test/ > score LOCAL_DEMONSTRATION_RULE 1.000 > describe LOCAL_DEMONSTRATION_RULE This is a simple test rule > > The problem is that the rule doesn't seems to be parsed. > > For example, here are the spamassassin headers for an email that > contains "test" in the subject : > > X-Spam-Score: -0.167 > X-Spam-Level: > X-Spam-Status: No, score=-0.167 required=5 tests=[AWL=0.386, > BAYES_00=-2.599, RCVD_IN_SORBS_DUL=2.046] > > Any good advices on this ? Yes, if you want to match 'test' in the Subject, you need a header rule: header LOCAL_DEMONSTRATION_RULE/test/ score LOCAL_DEMONSTRATION_RULE1.000 describeLOCAL_DEMONSTRATION_RULEThis is a simple test rule AFAIK there are four different types of rules: body, rawbody, header and full.
Troubles writing rules
Dear list, I'm trying to add my own rules to spamassassin. I put them in /etc/spamassassin/local.cf as it is explained in http://wiki.apache.org/spamassassin/WritingRules I'm testing with the default "newbie" rule : body LOCAL_DEMONSTRATION_RULE /test/ score LOCAL_DEMONSTRATION_RULE 1.000 describe LOCAL_DEMONSTRATION_RULE This is a simple test rule The problem is that the rule doesn't seems to be parsed. For example, here are the spamassassin headers for an email that contains "test" in the subject : X-Spam-Score: -0.167 X-Spam-Level: X-Spam-Status: No, score=-0.167 required=5 tests=[AWL=0.386, BAYES_00=-2.599, RCVD_IN_SORBS_DUL=2.046] Any good advices on this ? Thanks. -- Emmanuel Lesouef CRBN | DSI t : 0231069671 m : [EMAIL PROTECTED]