sa_userconf_maps and sa_username_maps syntax question

Matt Goodman matt at
Wed Sep 7 03:04:36 CEST 2011

Thank you for the insight. I examined the patch file that was presented and
I have to go a different direction. Since required_score is somewhat handled
already via the policy system (although users cannot specify their own
'score' they can indeed change policies, which in turn affects score), I
think I'm going to focus on per-user Bayes.

What part of amavisd-new goes and checks per-user bayes? I see nothing in
earlier examples nor in the patch which address having amavisd-new handle
per-user Bayes classification. Or is that solely done through SA's
configuration? If no changes are required in amavisd-new to get per-user
Bayes working, then I apologize. I can get SA's /etc/spamassassin/
to use the per-user Bayes. I'm just new to amavis and assume that amavis has
to handle checking against the per-user Bayes database. Is this correct?

So I will abandon sa_userconf_maps and sa_username_maps and go straight to
per-user Bayes. That should be enough, when combined with the flexibility of
the amavisd-new policies via SQL to accomplish what I need. I just have to
figure out whether anything is required on the amavis side of things.



-----Original Message-----
From: Renato Botelho [mailto:rbgarga at] 
Sent: Friday, September 02, 2011 12:07 AM
To: Matt Goodman
Cc: amavis-users at
Subject: Re: sa_userconf_maps and sa_username_maps syntax question

Hello Matt

On Fri, Sep 2, 2011 at 1:51 AM, Matt Goodman <matt at> wrote:
> Thank you very much for your reply. I understand a little bit better now.
> However, in example one below you listed a single domain name using 
> the method ‘sql’. What if I have dozens of domains, with them being 
> added/removed somewhat regularly by Postfix Admin (I can perceive 
> adding at least 1-2 domains per month) to this system. Isn’t there a 
> way to tell amavisd-new that all domains in the lookup_sql_dsn? The 
> table is actually called ‘domain’ inside the ‘postfixadmin’ db.

If all domains are using sql, you can have:

@sa_userconf_maps = (
      '.*' => 'sql:',

> For @sa_username_maps – I do not understand the syntax of that at all. 
> Could you explain it in just a little more detail so I actually 
> understand what’s being done, as opposed to just copying your example.
Many thanks.

In this case, since it is a single domain, i have personal userprefs set
just for uset, without domain, i mean, if email is user at prefs on SQL
is set just for user, so, this map says exactly it, for user at, look
just for user at SQL database.

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

> Thank you for the link to the patch, that will be helpful. And yes I 
> have followed the SpamAssassin SQL README and have my db schema as-per 
> those documents. A table called ‘userpref’ with one line per SA 
> preference. I have even tested this using spamc and validated that the 
> SQL configuration is good.

What that patch does is making amavis respect personal required_score
setting instead of use a global value for everyone, and the version sent to
this thread has a small issue if you use it with spamassassin < 3.0.

> I am just a little lost as to the @sa_username_maps syntax (looks like 
> regex to me), and I will read through the patch to try and determine 
> what amavisd-new is looking for. In the meantime, if someone can help 
> me understand how one might use all the domains in the postfixadmin 
> table instead of one domain per line of @sa_userconf_maps, that would be

Renato Botelho

More information about the amavis-users mailing list