Per user spamassassin bayes_path
Damian
amavis at arcsin.de
Wed Jan 10 15:12:06 CET 2024
> A harder way would also be highly appreciated 🙂 I'd go some lengths for avoiding a postgres/mariadb instance.
>
> I suppose just whitelisting the "bayes_path" property in the user-settings would impose a trove of new problems?
I don't know what you mean by whitelisting the property. The reason for
bayes_path "not parsing, administrator setting" seems hardcoded in
SpamAssassin. A dirty solution would be to change it into a non-admin
property, but it requires knowledge of SA internals which can change any
time, so here be dragons.
> root at e5ddc15080cb:~# cat /etc/amavis/conf.d/50-user
> use strict;
> package Amavis::SpamControl::SpamAssassin::Coderdude {
> use base 'Amavis::SpamControl::SpamAssassin';
> sub new_SpamAssassin_instance {
> my $instance = $_[0]->SUPER::new_SpamAssassin_instance(@_);
> $instance->{spamassassin_obj}{conf}{parser}{command_luts}{bayes_path}{is_admin}
> = 0;
> $instance;
> }
> }
> $sa_debug = 'all';
> @spam_scanners = (['SpamAssassin',
> 'Amavis::SpamControl::SpamAssassin::Coderdude']);
> @sa_userconf_maps = ({
> 'user1 at example.com' => '/tmp/sa_user1/user.cf',
> 'user2 at example.com' => '/tmp/sa_user2/user.cf',
> });
> 1;
>
> root at e5ddc15080cb:~# cat /tmp/sa_user1/user.cf
> bayes_path /tmp/sa_user1/bayes
> root at e5ddc15080cb:~# cat /tmp/sa_user2/user.cf
> bayes_path /tmp/sa_user2/bayes
>
> root at e5ddc15080cb:~# amavisd debug 2>&1 | grep "SA dbg" | grep
> "tie-ing to DB"
> [Testmail -> user1 at example.com]
> ... SA dbg: bayes: tie-ing to DB file R/O /tmp/sa_user1/bayes_toks
> ... SA dbg: bayes: tie-ing to DB file R/O /tmp/sa_user1/bayes_seen
> ... SA dbg: bayes: tie-ing to DB file R/W /tmp/sa_user1/bayes_toks
> ... SA dbg: bayes: tie-ing to DB file R/W /tmp/sa_user1/bayes_seen
> [Mail -> user2 at example.com]
> ... SA dbg: bayes: tie-ing to DB file R/O /tmp/sa_user2/bayes_toks
> ... SA dbg: bayes: tie-ing to DB file R/O /tmp/sa_user2/bayes_seen
> ... SA dbg: bayes: tie-ing to DB file R/W /tmp/sa_user2/bayes_toks
> ... SA dbg: bayes: tie-ing to DB file R/W /tmp/sa_user2/bayes_seen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.amavis.org/pipermail/amavis-users/attachments/20240110/feff45c6/attachment.htm>
More information about the amavis-users
mailing list