Koozali.org: home of the SME Server

Spamassassin: RejectLevel not taken into account if it equals TagLevel?

Offline Michail Pappas

  • *
  • 351
  • +1/-0
I am operating spamassassin in custom mode. Up till today I had TagLevel set at 6 and RejectLevel at 12, in order to complete the training.

Today I wanted to set the system in "operational" mode, that is simply delete anything that has a SA score of at least 6. For that purpose I set RejectLevel also at 6:
Code: [Select]
# config show spamassassin
spamassassin=service
    DNSAvailable=yes
    MessageRetentionTime=90
    OkLanguages=en el
    OkLocales=en el gr
    RejectLevel=6
    ReportSafe=0
    Sensitivity=custom
    SkipRBLChecks=0
    SortSpam=enabled
    Subject=[SPAM]
    SubjectTag=enabled
    TagLevel=6
    TrustedNetworks=127/8 192.168/16
    UseAutoWhitelist=0
    UseBayes=1
    status=enabled

However, /etc/mail/spamassassin/local.cf did not include this change, in fact there was no info on the reject level at all. Searching around in the templates, I came upon references in /etc/e-smith/templates/var/service/qpsmtpd/config/plugins/70spamassassin and /etc/e-smith/templates/var/service/qpsmtpd/config/peers/0/70spamassassin:
Code: [Select]
# cd /etc/e-smith/templates
# grep -R RejectLevel *
var/service/qpsmtpd/config/plugins/70spamassassin:      if ($spamassassin{RejectLevel} > $spamassassin{TagLevel})
var/service/qpsmtpd/config/plugins/70spamassassin:          push @options, "reject_threshold", $spamassassin{RejectLevel};
var/service/qpsmtpd/config/peers/0/70spamassassin:      if ($spamassassin{RejectLevel} > $spamassassin{TagLevel})
var/service/qpsmtpd/config/peers/0/70spamassassin:          push @options, "reject_threshold", $spamassassin{RejectLevel};

If I understand correctly, RejectLevel is inserted in the SA config files only if it is larger than TagLevel. But in this way, RejectLevel is effectively not used at all. Should perhaps ">" be ">=" or is would that break something else?

Bug or feature?

Offline Michail Pappas

  • *
  • 351
  • +1/-0
Stranger and stranger, I've changed RejectLevel to 7 (from web admin) and I can see that the change was propagated to the SME db, but I can not see any change in /etc/mail/spamassassin/local.cf:

Code: [Select]
# 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.2
lock_method flock
ok_languages en el
ok_locales en el gr
bayes_path /var/spool/spamd/.spamassassin/bayes
bayes_file_mode 750
report_safe 0
required_score 5.99
rewrite_header Subject [SPAM]
skip_rbl_checks 0
clear_trusted_networks
trusted_networks 192.168.1.2 127/8 192.168/16

use_bayes 1

DB:
Code: [Select]
# config show spamassassin
spamassassin=service
    DNSAvailable=yes
    MessageRetentionTime=90
    OkLanguages=en el
    OkLocales=en el gr
    RejectLevel=7
    ReportSafe=0
    Sensitivity=custom
    SkipRBLChecks=0
    SortSpam=enabled
    Subject=[SPAM]
    SubjectTag=enabled
    TagLevel=6
    TrustedNetworks=127/8 192.168/16
    UseAutoWhitelist=0
    UseBayes=1
    status=enabled

/var/log/messages:
Code: [Select]
Jul 30 09:16:13 mail /etc/e-smith/web/panels/manager/cgi-bin/emailsettings[26071]: /home/e-smith/db/configuration: OLD spamassassin=service|DNSAvailable|yes|
MessageRetentionTime|90|OkLanguages|en el|OkLocales|en el gr|RejectLevel|6|ReportSafe|0|Sensitivity|custom|SkipRBLChecks|0|SortSpam|enabled|Subject|[SPAM]|Su
bjectTag|enabled|TagLevel|6|TrustedNetworks|127/8 192.168/16|UseAutoWhitelist|0|UseBayes|1|status|enabled
Jul 30 09:16:13 mail /etc/e-smith/web/panels/manager/cgi-bin/emailsettings[26071]: /home/e-smith/db/configuration: NEW spamassassin=service|DNSAvailable|yes|
MessageRetentionTime|90|OkLanguages|en el|OkLocales|en el gr|RejectLevel|7|ReportSafe|0|Sensitivity|custom|SkipRBLChecks|0|SortSpam|enabled|Subject|[SPAM]|Su
bjectTag|enabled|TagLevel|6|TrustedNetworks|127/8 192.168/16|UseAutoWhitelist|0|UseBayes|1|status|enabled
Jul 30 09:16:13 mail esmith::event[26072]: Processing event: email-update
Jul 30 09:16:13 mail esmith::event[26072]: Running event handler: /etc/e-smith/events/actions/generic_template_expand
Jul 30 09:16:13 mail esmith::event[26072]: expanding /etc/hosts.allow
Jul 30 09:16:13 mail esmith::event[26072]: expanding /etc/securetty
Jul 30 09:16:13 mail esmith::event[26072]: expanding /etc/syslog.conf
Jul 30 09:16:13 mail esmith::event[26072]: expanding /etc/services
Jul 30 09:16:13 mail esmith::event[26072]: expanding /etc/freshclam.conf
Jul 30 09:16:13 mail esmith::event[26072]: expanding /etc/crontab
Jul 30 09:16:13 mail esmith::event[26072]: expanding /etc/Muttrc
Jul 30 09:16:13 mail esmith::event[26072]: expanding /etc/fetchmail
Jul 30 09:16:13 mail esmith::event[26072]: expanding /etc/shells
Jul 30 09:16:13 mail esmith::event[26072]: expanding /etc/startmail
Jul 30 09:16:13 mail esmith::event[26072]: expanding /etc/hosts.deny
Jul 30 09:16:13 mail esmith::event[26072]: expanding /etc/mime.types
Jul 30 09:16:13 mail esmith::event[26072]: expanding /etc/clamd.conf
Jul 30 09:16:13 mail esmith::event[26072]: expanding /etc/pine.conf
Jul 30 09:16:13 mail esmith::event[26072]: expanding /etc/httpd/conf/httpd.conf
Jul 30 09:16:14 mail esmith::event[26072]: expanding /etc/rc.d/init.d/masq
Jul 30 09:16:14 mail esmith::event[26072]: expanding /etc/logrotate.d/syslog
Jul 30 09:16:14 mail esmith::event[26072]: expanding /etc/logrotate.d/clamscan
Jul 30 09:16:14 mail esmith::event[26072]: expanding /etc/sysconfig/syslog
Jul 30 09:16:14 mail esmith::event[26072]: expanding /etc/mail/spamassassin/local.cf
Jul 30 09:16:14 mail esmith::event[26072]: expanding /var/qmail/alias/.qmail-localdelivery-default
Jul 30 09:16:14 mail esmith::event[26072]: expanding /var/qmail/alias/.qmail-default
Jul 30 09:16:14 mail esmith::event[26072]: expanding /var/qmail/control/bouncefrom
Jul 30 09:16:14 mail esmith::event[26072]: expanding /var/qmail/control/virtualdomains
Jul 30 09:16:14 mail esmith::event[26072]: expanding /var/qmail/control/smtproutes
Jul 30 09:16:14 mail esmith::event[26072]: expanding /var/qmail/control/doublebounceto
Jul 30 09:16:14 mail esmith::event[26072]: expanding /var/qmail/control/defaulthost
Jul 30 09:16:14 mail esmith::event[26072]: expanding /var/qmail/control/concurrencyremote
Jul 30 09:16:14 mail esmith::event[26072]: expanding /var/qmail/control/envnoathost
Jul 30 09:16:14 mail esmith::event[26072]: expanding /var/qmail/control/bouncehost
Jul 30 09:16:14 mail esmith::event[26072]: expanding /var/qmail/control/plusdomain
Jul 30 09:16:14 mail esmith::event[26072]: expanding /var/qmail/control/defaultdomain
Jul 30 09:16:14 mail esmith::event[26072]: expanding /var/qmail/control/badmailfrom
Jul 30 09:16:14 mail esmith::event[26072]: expanding /var/qmail/control/concurrencylocal
Jul 30 09:16:14 mail esmith::event[26072]: expanding /var/qmail/control/databytes
Jul 30 09:16:14 mail esmith::event[26072]: expanding /var/qmail/control/badrcptto
Jul 30 09:16:14 mail esmith::event[26072]: expanding /var/qmail/control/helohost
Jul 30 09:16:14 mail esmith::event[26072]: expanding /var/qmail/control/locals
Jul 30 09:16:14 mail esmith::event[26072]: expanding /var/qmail/control/rcpthosts
Jul 30 09:16:14 mail esmith::event[26072]: expanding /var/qmail/control/me
Jul 30 09:16:14 mail esmith::event[26072]: expanding /var/service/sqpsmtpd/runenv
Jul 30 09:16:14 mail esmith::event[26072]: expanding /var/service/imap/config
Jul 30 09:16:14 mail esmith::event[26072]: expanding /var/service/imap/peers/0
Jul 30 09:16:14 mail esmith::event[26072]: expanding /var/service/imap/peers/local
Jul 30 09:16:14 mail esmith::event[26072]: expanding /var/service/pop3/peers/0
Jul 30 09:16:14 mail esmith::event[26072]: expanding /var/service/pop3/peers/local
Jul 30 09:16:14 mail esmith::event[26072]: expanding /var/service/clamd/env/MEMLIMIT
Jul 30 09:16:14 mail esmith::event[26072]: expanding /var/service/imaps/config
Jul 30 09:16:14 mail esmith::event[26072]: expanding /var/service/imaps/peers/0
Jul 30 09:16:15 mail esmith::event[26072]: expanding /var/service/imaps/peers/local
Jul 30 09:16:15 mail esmith::event[26072]: expanding /var/service/qpsmtpd/runenv
Jul 30 09:16:15 mail esmith::event[26072]: expanding /var/service/qpsmtpd/ssl/cert.pem
Jul 30 09:16:15 mail esmith::event[26072]: expanding /var/service/qpsmtpd/config/rhsbl_zones
Jul 30 09:16:15 mail esmith::event[26072]: expanding /var/service/qpsmtpd/config/require_resolvable_fromhost
Jul 30 09:16:15 mail esmith::event[26072]: expanding /var/service/qpsmtpd/config/memory_threshold
Jul 30 09:16:15 mail esmith::event[26072]: expanding /var/service/qpsmtpd/config/spool_dir
Jul 30 09:16:15 mail esmith::event[26072]: expanding /var/service/qpsmtpd/config/badhelo
Jul 30 09:16:15 mail esmith::event[26072]: expanding /var/service/qpsmtpd/config/badrcptto_patterns
Jul 30 09:16:15 mail esmith::event[26072]: expanding /var/service/qpsmtpd/config/norelayclients
Jul 30 09:16:15 mail esmith::event[26072]: expanding /var/service/qpsmtpd/config/goodrcptto
Jul 30 09:16:15 mail esmith::event[26072]: expanding /var/service/qpsmtpd/config/invalid_resolvable_fromhost
Jul 30 09:16:15 mail esmith::event[26072]: expanding /var/service/qpsmtpd/config/plugins
Jul 30 09:16:15 mail esmith::event[26072]: expanding /var/service/qpsmtpd/config/loglevel
Jul 30 09:16:15 mail esmith::event[26072]: expanding /var/service/qpsmtpd/config/plugin_dirs
Jul 30 09:16:15 mail esmith::event[26072]: expanding /var/service/qpsmtpd/config/smtpgreeting
Jul 30 09:16:15 mail esmith::event[26072]: expanding /var/service/qpsmtpd/config/relayclients
Jul 30 09:16:15 mail esmith::event[26072]: expanding /var/service/qpsmtpd/config/tls_before_auth
Jul 30 09:16:15 mail esmith::event[26072]: expanding /var/service/qpsmtpd/config/timeoutsmtpd
Jul 30 09:16:15 mail esmith::event[26072]: expanding /var/service/qpsmtpd/config/IP
Jul 30 09:16:15 mail esmith::event[26072]: expanding /var/service/qpsmtpd/config/dnsbl_allow
Jul 30 09:16:15 mail esmith::event[26072]: expanding /var/service/qpsmtpd/config/subject_prefix
Jul 30 09:16:15 mail esmith::event[26072]: expanding /var/service/qpsmtpd/config/signatures_patterns
Jul 30 09:16:15 mail esmith::event[26072]: expanding /var/service/qpsmtpd/config/dnsbl_zones
Jul 30 09:16:15 mail esmith::event[26072]: expanding /var/service/qpsmtpd/config/timeout
Jul 30 09:16:15 mail esmith::event[26072]: expanding /var/service/qpsmtpd/config/tls_ciphers
Jul 30 09:16:15 mail esmith::event[26072]: expanding /var/service/qpsmtpd/config/peers/0
Jul 30 09:16:15 mail esmith::event[26072]: expanding /var/service/qpsmtpd/config/peers/local
Jul 30 09:16:15 mail esmith::event[26072]: expanding /var/service/qpsmtpd/peers/0
Jul 30 09:16:15 mail esmith::event[26072]: expanding /var/service/qpsmtpd/peers/local
Jul 30 09:16:15 mail esmith::event[26072]: expanding /var/service/pop3s/peers/0
Jul 30 09:16:15 mail esmith::event[26072]: expanding /var/service/pop3s/peers/local
Jul 30 09:16:15 mail esmith::event[26072]: expanding /home/httpd/html/horde/conf.menu.apps.php
Jul 30 09:16:15 mail esmith::event[26072]: expanding /home/httpd/html/horde/turba/config/attributes.php
Jul 30 09:16:15 mail esmith::event[26072]: expanding /home/httpd/html/horde/turba/config/conf.php
Jul 30 09:16:15 mail esmith::event[26072]: expanding /home/httpd/html/horde/turba/config/prefs.php
Jul 30 09:16:15 mail esmith::event[26072]: expanding /home/httpd/html/horde/turba/config/sources.php
Jul 30 09:16:15 mail esmith::event[26072]: expanding /home/httpd/html/horde/config/mime_drivers.php
Jul 30 09:16:15 mail esmith::event[26072]: expanding /home/httpd/html/horde/config/conf.php
Jul 30 09:16:16 mail esmith::event[26072]: expanding /home/httpd/html/horde/config/prefs.php
Jul 30 09:16:16 mail esmith::event[26072]: expanding /home/httpd/html/horde/config/registry.php
Jul 30 09:16:16 mail esmith::event[26072]: expanding /home/httpd/html/horde/config/hooks.php
Jul 30 09:16:16 mail esmith::event[26072]: expanding /home/httpd/html/horde/ingo/config/conf.php
Jul 30 09:16:16 mail esmith::event[26072]: expanding /home/httpd/html/horde/ingo/config/backends.php
Jul 30 09:16:16 mail esmith::event[26072]: expanding /home/httpd/html/horde/ingo/config/prefs.php
Jul 30 09:16:16 mail esmith::event[26072]: expanding /home/httpd/html/horde/imp/config/servers.php
Jul 30 09:16:16 mail esmith::event[26072]: expanding /home/httpd/html/horde/imp/config/mime_drivers.php
Jul 30 09:16:16 mail esmith::event[26072]: expanding /home/httpd/html/horde/imp/config/trailer.txt
Jul 30 09:16:16 mail esmith::event[26072]: expanding /home/httpd/html/horde/imp/config/conf.php
Jul 30 09:16:16 mail esmith::event[26072]: expanding /home/httpd/html/horde/imp/config/prefs.php
Jul 30 09:16:16 mail esmith::event[26072]: expanding /home/httpd/html/horde/imp/config/hooks.php
Jul 30 09:16:16 mail esmith::event[26072]: expanding /home/httpd/html/horde/imp/config/header.txt
Jul 30 09:16:16 mail esmith::event[26072]: generic_template_expand=action|Event|email-update|Action|generic_template_expand|Start|1343628973 357067|End|1343628976 618422|Elapsed|3.261355
Jul 30 09:16:16 mail esmith::event[26072]: Running event handler: /etc/e-smith/events/email-update/S20qmail-update-user
Jul 30 09:16:21 mail esmith::event[26072]: S20qmail-update-user=action|Event|email-update|Action|S20qmail-update-user|Start|1343628976 618734|End|1343628981 697903|Elapsed|5.079169
Jul 30 09:16:21 mail esmith::event[26072]: Running event handler: /etc/e-smith/events/actions/adjust-services
Jul 30 09:16:21 mail esmith::event[26072]: adjusting supervised sqpsmtpd (sighup)
Jul 30 09:16:21 mail esmith::event[26072]: adjusting supervised sqpsmtpd (up)
Jul 30 09:16:21 mail esmith::event[26072]: adjusting supervised qmail (sighup)
Jul 30 09:16:21 mail esmith::event[26072]: adjusting supervised qmail (up)
Jul 30 09:16:21 mail esmith::event[26072]: adjusting supervised imap (sigusr1)
Jul 30 09:16:21 mail esmith::event[26072]: adjusting supervised imap (up)
Jul 30 09:16:21 mail esmith::event[26072]: adjusting supervised httpd-e-smith (sigusr1)
Jul 30 09:16:21 mail esmith::event[26072]: adjusting supervised httpd-e-smith (up)
Jul 30 09:16:21 mail esmith::event[26072]: adjusting supervised pop3 (sigusr1)
Jul 30 09:16:21 mail esmith::event[26072]: adjusting supervised pop3 (up)
Jul 30 09:16:21 mail esmith::event[26072]: adjusting non-supervised masq (adjust)
Jul 30 09:16:22 mail esmith::event[26072]: adjusting supervised clamd (restart)
Jul 30 09:16:22 mail esmith::event[26072]: adjusting supervised clamd (up)
Jul 30 09:16:22 mail esmith::event[26072]: adjusting supervised imaps (sigusr1)
Jul 30 09:16:22 mail esmith::event[26072]: adjusting supervised imaps (up)
Jul 30 09:16:22 mail esmith::event[26072]: adjusting supervised qpsmtpd (sighup)
Jul 30 09:16:22 mail esmith::event[26072]: adjusting supervised qpsmtpd (up)
Jul 30 09:16:22 mail esmith::event[26072]: adjusting supervised spamd (restart)
Jul 30 09:16:22 mail esmith::event[26072]: adjusting supervised spamd (up)
Jul 30 09:16:22 mail esmith::event[26072]: adjusting supervised smtp-auth-proxy (down)
Jul 30 09:16:22 mail esmith::event[26072]: adjusting supervised smtp-auth-proxy (restart)
Jul 30 09:16:22 mail esmith::event[26072]: adjusting supervised pop3s (sigusr1)
Jul 30 09:16:22 mail esmith::event[26072]: adjusting supervised pop3s (up)
Jul 30 09:16:22 mail esmith::event[26072]: adjust-services=action|Event|email-update|Action|adjust-services|Start|1343628981 698281|End|1343628982 76283|Elapsed|0.378002

What am I missing here...

EDIT: I am missing the fact that it is not local.cf the file that gets updated, but /var/service/qpsmtpd/config/peers/0 and /var/service/qpsmtpd/config/plugins

So, disregard this second post, but do please check the first one with regard the thread's subject.
« Last Edit: July 30, 2012, 08:33:06 AM by Michail Pappas »

Offline mmccarn

  • *
  • 2,653
  • +10/-0
Not a direct answer, but:
I suspect you can get the behavior you're looking for by setting "RejectLevel" to 6.01.

All of the spamassassin scores are rounded to tenths, so 6 and 6.01 will always match the same messages (6 matches, 6.1 doesn't).

(Here's a bug discussing this with regard to spam subject tagging: http://bugs.contribs.org/show_bug.cgi?id=5603)

Offline Michail Pappas

  • *
  • 351
  • +1/-0
Thanks Mike, that did the trick.

Do you think I should raise this as a bug though?

Offline mmccarn

  • *
  • 2,653
  • +10/-0
Do you think I should raise this as a bug though?
Only if you want to make the required changes and upload the diffs to the bug.

I don't know why the current templates use ">" instead of ">=" - if there is a reason, it might be hard to find/prove/remember...

Or, you might want to reconsider the logic entirely - perhaps set taglevel to match rejectlevel if taglevel <=rejectlevel instead of ignoring rejectlevel if it's <= taglevel.

Also, does there need to be some validation in the web panel that prevents users from setting invalid values? (etc, etc...)
« Last Edit: July 31, 2012, 01:51:49 PM by mmccarn »

Offline Michail Pappas

  • *
  • 351
  • +1/-0
Only if you want to make the required changes and upload the diffs to the bug.
s/want to/are certain of what should be changed/g ;)

Quote
I don't know why the current templates use ">" instead of ">=" - if there is a reason, it might be hard to find/prove/remember...
Definitely something I would not touch...