You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Michael B Allen <io...@gmail.com> on 2017/01/11 21:58:39 UTC

Keyword Whitelist?

Is there a way to add a rule that simply matches specific key words?

For example, if someone actually names my product it's basically
guaranteed not to be spam. In this case, I want to just whitelist it
(or maybe apply -10 to the score).

Any pointers would be appreciated.

Mike

Re: Keyword Whitelist?

Posted by RW <rw...@googlemail.com>.
On Wed, 11 Jan 2017 14:18:58 -0800
Alan Hodgson wrote:

> On Wednesday 11 January 2017 16:58:39 Michael B Allen wrote:
> > Is there a way to add a rule that simply matches specific key words?
> > 
> > For example, if someone actually names my product it's basically
> > guaranteed not to be spam. In this case, I want to just whitelist it
> > (or maybe apply -10 to the score).
> > 
> > Any pointers would be appreciated.
> > 
> > Mike  
> 
> https://wiki.apache.org/spamassassin/WritingRules
> 
> Add to /etc/spamassassin/local.cf (or your .spamassassin/user_prefs
> if allow_user_rules 1)
> 
> Something like:
> 
> header __LOCAL_SUBJECT_PRODUCTS Subject
> =~ /(product1|product2|product3)/i body
> __LOCAL_BODY_PRODUCTS /(product1|product2|product3)/i
> 
> meta LOCAL_WHITELIST_PRODUCTS ( __LOCAL_SUBJECT_PRODUCTS ||
> __LOCAL_BODY_PRODUCTS)
> score LOCAL_WHITELIST_PRODUCTS -10
> describe LOCAL_WHITELIST_PRODUCTS Message names one of my products

You don't need a separate header rule as the subject is treated as part
of the body, so:

body  LOCAL_WHITELIST_PRODUCTS    /product1|product2|product3/i
score LOCAL_WHITELIST_PRODUCTS    -10


in theory, since it has a negative score, you should also set 

tflags LOCAL_WHITELIST_PRODUCTS   nice


Re: Keyword Whitelist?

Posted by Alan Hodgson <ah...@lists.simkin.ca>.
On Wednesday 11 January 2017 14:31:15 John Hardin wrote:
> That's more complex than needed. The message subject is automatically
> included in body rules, so you only need __LOCAL_BODY_PRODUCTS.
> 

Cool, I did not know that. txs.


Re: Keyword Whitelist?

Posted by John Hardin <jh...@impsec.org>.
On Wed, 11 Jan 2017, Alan Hodgson wrote:

> On Wednesday 11 January 2017 16:58:39 Michael B Allen wrote:
>> Is there a way to add a rule that simply matches specific key words?
>>
>> For example, if someone actually names my product it's basically
>> guaranteed not to be spam. In this case, I want to just whitelist it
>> (or maybe apply -10 to the score).
>
> https://wiki.apache.org/spamassassin/WritingRules
>
> Add to /etc/spamassassin/local.cf (or your .spamassassin/user_prefs if
> allow_user_rules 1)
>
> Something like:
>
> header __LOCAL_SUBJECT_PRODUCTS Subject =~ /(product1|product2|product3)/i
> body __LOCAL_BODY_PRODUCTS /(product1|product2|product3)/i
>
> meta LOCAL_WHITELIST_PRODUCTS ( __LOCAL_SUBJECT_PRODUCTS ||
> __LOCAL_BODY_PRODUCTS)

That's more complex than needed. The message subject is automatically 
included in body rules, so you only need __LOCAL_BODY_PRODUCTS.

I will refrain from making more technical RE tuning suggestions... :)

> score LOCAL_WHITELIST_PRODUCTS -10
> describe LOCAL_WHITELIST_PRODUCTS Message names one of my products
>
> Reload spamassassin if you modified local.cf.

-- 
  John Hardin KA7OHZ                    http://www.impsec.org/~jhardin/
  jhardin@impsec.org    FALaholic #11174     pgpk -a jhardin@impsec.org
  key: 0xB8732E79 -- 2D8C 34F4 6411 F507 136C  AF76 D822 E6E6 B873 2E79
-----------------------------------------------------------------------
   Your mouse has moved. Your Windows Operating System must be
   relicensed due to this hardware change. Please contact Microsoft
   to obtain a new activation key. If this hardware change results in
   added functionality you may be subject to additional license fees.
   Your system will now shut down. Thank you for choosing Microsoft.
-----------------------------------------------------------------------
  6 days until Benjamin Franklin's 311th Birthday

Re: Keyword Whitelist?

Posted by Alan Hodgson <ah...@lists.simkin.ca>.
On Wednesday 11 January 2017 16:58:39 Michael B Allen wrote:
> Is there a way to add a rule that simply matches specific key words?
> 
> For example, if someone actually names my product it's basically
> guaranteed not to be spam. In this case, I want to just whitelist it
> (or maybe apply -10 to the score).
> 
> Any pointers would be appreciated.
> 
> Mike

https://wiki.apache.org/spamassassin/WritingRules

Add to /etc/spamassassin/local.cf (or your .spamassassin/user_prefs if 
allow_user_rules 1)

Something like:

header __LOCAL_SUBJECT_PRODUCTS Subject =~ /(product1|product2|product3)/i
body __LOCAL_BODY_PRODUCTS /(product1|product2|product3)/i

meta LOCAL_WHITELIST_PRODUCTS ( __LOCAL_SUBJECT_PRODUCTS ||
__LOCAL_BODY_PRODUCTS)
score LOCAL_WHITELIST_PRODUCTS -10
describe LOCAL_WHITELIST_PRODUCTS Message names one of my products

Reload spamassassin if you modified local.cf.