Amavis / SpamAssassin ignoring userpref in SQL

Hans van Zijst apprenti at sorcier.eu
Thu Sep 16 13:04:28 CEST 2021


Thanks Damian,


On 16-09-2021 00:23, Damian wrote:
>> @sa_userconf_maps    = ({ '.*' => 'sql:' });
> 
> The left-hand-side is not a regex in a hash lookup.

Turning @sa_userconf_maps into a scalar works, although I'm not really 
sure why. It's been a long time since I did any Perl programming, but I 
thought variables that start with an @ are supposed to be arrays. Guess 
a scalar is a one-element array then.

Anyway, that bit works: every userconf is now pulled from SQL by doing this:

@sa_userconf_maps = 'sql:';


>> @sa_username_maps    = new_RE ( [  '.*' => '$GLOBAL' ] );
> 
> If you want static lookup results, use these:
> 
>> @sa_userconf_maps = 'sql:';
>> @sa_username_maps = '$GLOBAL';

I didn't really want static lookups, I wanted every user to be able to 
configure his own settings. Problem is that I don't understand exactly 
what I'm doing in Amavis, documentation is scattered and although I'm 
very good at searching the Internet, I'm not so good at actually finding ;-)

What I ended up with is this:

@sa_userconf_maps  = 'sql:';
@sa_username_maps  = new_RE ( [ qr'^([^@]+ at .*)'i => '${1}' ] );

I found that RE on this same mailinglist:

https://www.mail-archive.com/amavis-users@amavis.org/msg00868.html

Apparently $1 contains the receiving e-mail address when the RE is parsed.

Now I'll have to find a way to make sure the sa_user field in the policy 
table contains the correct value for each user.

Kind regards,

Hans van Zijst


More information about the amavis-users mailing list