Date: Thu, 5 Jun 2008 08:44:13 +0200
From: Alexander Wirt <[email protected]>
To: [email protected]
> I needed the feature to change spamassassin rules on a per policy-bank base.
> So I created the attached patch, it would be nice if it can get integrated
> into the next amavisd version. Just two notes:
>
> - The file gets loaded via spamassassins read_scoreonly_config() function,
> under normal circumstances you can only add score changes here, but no new
> rules. If you need this you have to define "allow_user_rules" somewhere
> in your global config. This file can never contain any administrator
> settings.
> (I have a spamassassin module available that makes this possible, e.g. for
> defining a policy-bank based bayes db - just ask me if you need it).
>
> - Since we reuse the SA object during lifetime of the amavis child settings
> from policy-banks can leak into other policy-banks (which is normally not
> what you want). So I safe the configstate before loading the rules file
> and restore it after parsing the mail.
>
> How to use it:
> Just define another SA rulesfile in your policy-bank:
> $policy_bank{'foo'} = {
> sa_site_rules_filename = '/etc/amavis/foo.sa',
> }
Date: Thu, 9 Jul 2009 09:35:36 +0200
From: Alexander Wirt <[email protected]>
> > For a long time, we've been patching in 3 $sa_.. variables for rules. I
> > see 2.6.4 takes care of two fo the cases. We had:
> > rules_filename => $sa_rules_file,
> > site_rules_filename => $sa_site_rules_file,
> > userprefs_filename => $sa_userprefs_file,
>
> Unfortunatly that options weren't implemented as I suggested in my patch [1]
> in 2008. The patch would allow to apply the rulefiles per policybank in one
> instance. I have the patch productive since years (for example for
> lists.debian.org). Marc: are there any chances the patch will applied to
> amavisd-new?
At last. This will be in the next release. Thanks for a suggestion!
- added a configuration variable $sa_user_config_file, also member of
policy banks. It can be set to a full file name of a 'user preferences'
configuration file. Setting of $sa_user_config_file is normally done
through a policy bank, not globally. SpamAssassin will be requested to load
this configuration file through its read_scoreonly_config() method, which
otherwise (in spamd) serves to load user's .spamassassin/user_prefs file
when switching users. When $sa_user_config_file changes (through exiting
a policy bank or loading another policy bank), an initial SpamAssassin
configuration is restored through SpamAssassin's copy_config() method.
Note that saving an original SpamAssassin configuration, loading a user
configuration file, and restoring to the original configuration does not
come cheap: it can take 200 ms for a load and restore, and 370 ms for the
initial saving of the configuration (saving is only done once per child
process, and only if needed). Saved configuration can occupy additional
2 MB of virtual memory, so use the feature sparingly. No penalty occurs
until a child process does its first loading of a user config file, so
rarely activated or inactive policy banks using this feature come cheap.
According to SpamAssassin documentation, a user preferences file can
include scoring options, scores, whitelists and blacklists, etc.
If 'allow_user_rules' is enabled (local.cf), then a user preferences
file can also include rule definitions and privileged settings - but
not the administrator settings.
The feature is only available with SpamAssassin 3.3.0 (or later).
Based on a suggestion by Alexander Wirt and loosely based on his patch.
Mark
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
AMaViS-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/amavis-user
AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/howto/