Koozali.org: home of the SME Server

Custom Spamassassin Rules Not Working: EMPTY_SUBJECT

Offline ghorst352

  • ****
  • 180
  • +0/-0
Custom Spamassassin Rules Not Working: EMPTY_SUBJECT
« on: June 13, 2012, 01:05:11 PM »
OS version 7.5.1


Hello,


I am trying to successfully make custom spamassassin rules in accordance with the documentation found here http://wiki.contribs.org/Email.  Here is the excerpt for doing so as follows:



*********************************************************************************
Custom Rule Scores

You can customize the score assigned by a specific Spamassassin rule (SARE_ADULT2 in this case) as follows:

mkdir -p /etc/e-smith/templates-custom/etc/mail/spamassassin/local.cf
cd /etc/e-smith/templates-custom/etc/mail/spamassassin/local.cf
echo "score SARE_ADULT2 20.000" >> 20localscores
signal-event email-update

You can now add additional tests and custom scores by editing the newly-created template fragment 20localscores and adding new custom scores using:

pico -w /etc/e-smith/templates-custom/etc/mail/spamassassin/local.cf/20localscores
signal-event email-update

*********************************************************************************


This does not work for me as I have tried several times.  I am simply trying to change the MISSING_SUBJECT rule to a score of 20.  My command string was as follows:

mkdir -p /etc/e-smith/templates-custom/etc/mail/spamassassin/local.cf
cd /etc/e-smith/templates-custom/etc/mail/spamassassin/local.cf
echo "score MISSING_SUBJECT 20.000" >> 20localscores
signal-event email-update

This went through with no errors but does not work.  I can edit spamassassin directly and get this to work with perl commands but not through the template system.  I am trying to ban empty or blank subject emails.  I might possibly have the wrong rule or maybe I am missing something here.  Any help is appreciated.   :D

« Last Edit: June 14, 2012, 05:51:50 PM by bhay3s »

Offline _alex

  • ***
  • 103
  • +0/-0
Re: Custom Spamassassin Rules Not Working
« Reply #1 on: June 13, 2012, 01:16:08 PM »
What about

expand-template /etc/mail/spamassassin/local.cf

Before signal-event email-update

Offline ghorst352

  • ****
  • 180
  • +0/-0
Re: Custom Spamassassin Rules Not Working
« Reply #2 on: June 13, 2012, 01:26:32 PM »
The template was updated w/ the email-update command.  Additionally, I also did a 'signal post-upgrade && signal reboot' just in case and it still does not work.

Offline Stefano

  • *
  • 10,836
  • +2/-0
Re: Custom Spamassassin Rules Not Working
« Reply #3 on: June 13, 2012, 01:46:16 PM »
The template was updated w/ the email-update command.  Additionally, I also did a 'signal post-upgrade && signal reboot' just in case and it still does not work.

in that case it should be investigated.. please file a bug in bugzilla, thank you

Offline mmccarn

  • *
  • 2,626
  • +10/-0
Re: Custom Spamassassin Rules Not Working
« Reply #4 on: June 13, 2012, 01:50:52 PM »
Is your custom score statement making it into /etc/mail/spamassassin/local.cf, and does it look correct there?

Offline ghorst352

  • ****
  • 180
  • +0/-0
Re: Custom Spamassassin Rules Not Working
« Reply #5 on: June 13, 2012, 02:19:51 PM »
Here is the local.cf file:

[root@mail ~]# cat /etc/mail/spamassassin/local.cf
#------------------------------------------------------------
#              !!DO NOT MODIFY THIS FILE!!
#
# Manual changes will be lost when this file is regenerated.
#
# Please read the developer's guide, which is available
# at http://www.contribs.org/development/
#
# Copyright (C) 1999-2006 Mitel Networks Corporation
#------------------------------------------------------------
dns_available yes
internal_networks 192.168.1.7
lock_method flock

ok_locales all
bayes_path /var/spool/spamd/.spamassassin/bayes
bayes_file_mode 750
auto_whitelist_path /var/spool/spamd/.spamassassin/auto-whitelist
auto_whitelist_file_mode 750
report_safe 0
required_score 5
rewrite_header Subject [SPAM]
skip_rbl_checks 0
clear_trusted_networks
trusted_networks 192.168.1.7
use_auto_whitelist 0
use_bayes 1
score MISSING_SUBJECT 20.000


Unless the syntax is incorrect this should be working?  To test this I have sent internal emails to myself with no subject and sent emails from my gmail account to my internal company account.  All emails that I have sent come through to my thunderbird email client.  Upon examination of my qpsmtpd.current log file I do see an entry for the email I sent from my gmail account however it does not process the MISSING_SUBJECT rule.  The score should of been at least 20 let alone with the MISSING_SUBJECT rule an instant failure which is the objective.

2012-06-13 07:24:37.834117500 7438 logging::logterse plugin (queue): ` 209.85.214.171   mail-ob0-f171.google.com   mail-ob0-f171.google.com   <digital.wayha@gmail.com>   <bradh@dixiemetals.com>   queued      <CAH7smHYhvAXtsfsRrHfQ6N1gXC5pPF10HqrCpRJavtukZGkxLg@mail.gmail.com>   No, hits=1.5 required=5.0 

Offline ghorst352

  • ****
  • 180
  • +0/-0
Re: Custom Spamassassin Rules Not Working
« Reply #6 on: June 13, 2012, 03:03:50 PM »
Filed under Bugzilla - Bug 6984

Offline mmccarn

  • *
  • 2,626
  • +10/-0
Re: Custom Spamassassin Rules Not Working
« Reply #7 on: June 13, 2012, 03:49:24 PM »
For convenience, a clickable link to the bug: http://bugs.contribs.org/show_bug.cgi?id=6984

Offline ghorst352

  • ****
  • 180
  • +0/-0
Re: Custom Spamassassin Rules Not Working
« Reply #8 on: June 13, 2012, 05:06:41 PM »
NOTABUG so back to the drawing board.   I am trying to figure out why its not processing the MISSING_SUBJECT rule. 

Offline ghorst352

  • ****
  • 180
  • +0/-0
Re: Custom Spamassassin Rules Not Working
« Reply #9 on: June 13, 2012, 06:32:41 PM »
Will I am at a loss here? I know spamassassin works as I use it everyday plus I check my logs and plus I just verified a couple rules by email misc stuff - attachements etc etc.  I can edit spamassassin directly minus the SME Server template system and use a perl command to make this work which is what I had done previously but the template system overwrote the change so I need to somehow get this to work with the template system.  I have no clue what to do now as spamassassin works-i can edit it directly and it works-just not with the template system????? 

Offline ghorst352

  • ****
  • 180
  • +0/-0
Re: Custom Spamassassin Rules Not Working: MISSING SUBJECT RULE
« Reply #10 on: June 14, 2012, 01:22:56 PM »
I have some interesting updated information regarding this issue.  This morning I also decided to change the score of the EMPTY_MESSAGE rule.  I passed the following command:

[root@mail ~]# pico -w /etc/e-smith/templates-custom/etc/mail/spamassassin/local.cf/20localscores
added the following::->
score EMPTY_MESSAGE 20.000
[root@mail ~]# signal-event email-update

This works??? so for whatever reason the 'score MISSING_SUBJECT 20.000' update does not so my issue is 100% in relationship to the MISSING_SUBJECT rule.  I am still trying to figure this out so if anybody has any helpful info in regards to this please give me a shout.   :grin:

Offline janet

  • ****
  • 4,812
  • +0/-0
Re: Custom Spamassassin Rules Not Working
« Reply #11 on: June 14, 2012, 03:34:38 PM »
bhay3s

Quote
I can edit spamassassin directly minus the SME Server template system and use a perl command to make this work which is what I had done previously but the template system overwrote the change so I need to somehow get this to work with the template system. I have no clue what to do now as spamassassin works-i can edit it directly and it works-just not with the template system?????

Perhaps you should tell us exactly what you did to get this working when editing directly and using perl.
It may help to illuminate matters.
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline mmccarn

  • *
  • 2,626
  • +10/-0
Re: Custom Spamassassin Rules Not Working: MISSING SUBJECT RULE
« Reply #12 on: June 14, 2012, 03:43:44 PM »
When I google for 'spamassassin MISSING_SUBJECT' I get some conversations implying that missing subjects may be different from *empty* subject.

Specifically, MISSING_SUBJECT may only trigger on the complete absence of a "Subject:" header, while I suspect you're trying to find a rule that fires on emails where the subject is empty.


Offline ghorst352

  • ****
  • 180
  • +0/-0
Re: Custom Spamassassin Rules Not Working: MISSING SUBJECT RULE
« Reply #13 on: June 14, 2012, 03:49:08 PM »
Mary,


You are correct, that is the conclusion I just came up with while skimming the internet.

Here are some rules listed below.  The EMPTY_MESSAGE rule is actually both body and subject.  I still cannot find one just for a lack of 'Text' in the subject field.


-100 USER_IN_WHITELIST From: address is in the whitelist
* 1.0 MISSING_HEADERS Missing To: header
* 2.6 BAYES_60 BODY: Bayes spam probability is 60 to 80%
* [score: 0.6742]
* 0.5 MISSING_MID Missing Message-Id: header
* 1.8 MISSING_SUBJECT Missing Subject: header
* 2.3 EMPTY_MESSAGE Message appears to have no textual parts and no
* Subject: text
* 0.8 RDNS_NONE Delivered to internal network by a host with no rDNS
* 1.0 MISSING_FROM Missing From: header
* 1.4 MISSING_DATE Missing Date: header 


Offline ghorst352

  • ****
  • 180
  • +0/-0
Re: Custom Spamassassin Rules Not Working: MISSING SUBJECT RULE
« Reply #14 on: June 14, 2012, 04:13:16 PM »
I believe I found what I need to do is create a 'custom' rule implying 'empty' subject. per example.


header EMPTY_SUBJECT Subject =~ /^\s*$/


Trying to figure out where to put this....After that then I would issue the following:

[root@mail ~]# pico -w /etc/e-smith/templates-custom/etc/mail/spamassassin/local.cf/20localscores
added the following::->
score EMPTY_SUBJECT 20.000
[root@mail ~]# signal-event email-update