Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Currently i have working setup of postfix with virtual users which uses amavis (with SA and clamav) to filter messages.

The problem is, i need to allow every user to be able to adjust their SA settings. So i need to store SA settings in a database. Its quite simple to do when SA runs without amavis, but is it ever possible to force SA and amavis to use database?

If not, what will be performace influence when i drop amavis and use SA directly with postfix?

share|improve this question
where exactly is your trouble for database-stored settings with amavisd-new? @sa_userconf_maps is available since 2.7.0, I have never used it myself, but suppose since 2.7.0 has been released for over a year now that it would do the job. – the-wabbit Dec 7 '12 at 8:12
Trouble is: i have to pass user to spamc daemon to be able to retrieve right settings - i cant find where amavis calls spamc to change it settings. – WombaT Dec 7 '12 at 8:23
Amavisd-new is not calling spamc or addressing spamd in any other way - it invokes the relevant Perl functionality directly from its own code. Thus, functionality unique to spamd is not available in Amavisd-new. But as I have noted in my answer, using @sa_userconf_maps should give you the ability to load per-user-configurations from a database. – the-wabbit Dec 7 '12 at 8:45

is it ever possible to force SA and amavis to use database?

It should be since the 2.7.0 version of Amavisd-new which introduces the @sa_userconf_maps configuration parameter. From the Amavisd-new release notes:

SpamAssassin will be requested to load a user preferences configuration through its read_scoreonly_config() or load_scoreonly_sql() method, which otherwise (in spamd) serves to load user's .spamassassin/user_prefs file or SQL preferences when switching users. See SpamAssassin documentation file sql/README for SQL details.



@sa_userconf_maps = (
  { '' =>
    '' => 'sql:',

If not, what will be performace influence when i drop amavis and use SA directly with postfix?

Spamassassin/spamd would be able to filter mail, but Amavisd-new does a lot more than that. Your impact would not be not so much performance-wise (since Amavisd-new does just invoke the appropriate SpamAssassin functions, similar to what spamd is doing too) but you would lose Amavisd-new specific functionality like the lovers maps, the destiny configurations, the antivirus scanner integration, the attachment file type recognition, ...

share|improve this answer
actually, amavis is installed just because it was recommended to handle SA and clamav in one of howtos for postfix. I dont think i will ever need any more functionality. – WombaT Dec 7 '12 at 9:21
i have placed in /etc/amavis/conf.d/50-user this: @sa_userconf_maps = ( { '.*' => 'sql:', } ); @sa_username_maps = new_RE ( [ qr'^([^@]+@.*)'i => '${1}' ] ); but i cant see any use of sql in debug log, and user options are ignored (defaults used) – WombaT Dec 7 '12 at 9:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.