Yassen,

> I want amavisd-new/spamassassin use a different Spamassassin Bayes database
> for each separate domain hosted on my mail server. That is, if the first
> "To:" recipient is us...@firstdomain.com, then I want Bayes tests (and
> learning) to be done against SA Bayes databse #1; if the first "To:"
> recipient is us...@seconddomain.com, then Bayes tests (and learning)
> should be done against SA Bayes databse #2, and so on. If there is no
> "To:" recipient, Bayes tests (and learning) should be done against a
> default Bayes database.

This is a wrong approach for anything but a toy or a SOHO setup.
Two things wrong with it:

- the "To" header field bears no relationship with recipients to which mail
  is to be delivered. Think of a message send through a mailing list and
  delivered to your recipients: the "To" claims "x...@lists.sourceforge.net",
  yet mail is delivered to your address. Or, a "To:" specifying a recipient
  in another local domain, yet you are receiving the message being on a
  "Cc" list - it would be wrong to apply a foreign policy to your delivery.

- a mail message may have multiple recipients. For any serious per-domain
  policy (that can be backed up with a SLA) it is unacceptable that a policy
  of an unrelated local domain can influence another policy, merely by a fact
  that one of the recipients of a message happened to belong to another local
  domain, and happened to be specified first in the list of recipients,
  perhaps by virtue of alphabetization by a sending MUA.
  
> [...] Then I can use policy banks to tune amavisd-new the way I want it
> tuned for that specific domain,

Policy banks apply to an entire message. They are an inappropriate
mechanism for controlling per-recipient behaviour. Policy banks are
typically associated with a sender or their IP address or authenticity,
and not associated with recipients (one policy bank, multiple recipients).

> but I still don't know how to get it tell SA to look for it's bayes db
> at a domain-specific location. Anyone's help is highly appreciated.
> 
> My current plan is to introduce $sa_bayes_path in amavisd-new config
> file(s), have amavisd-new patched to honor that argument when calling SA,
> and also have it listen on a separate port for each domain. I will then
> use policy banks to tune that same $sa_bayes_path argument differently for
> each of the different ports (=domains).

The 2.7.0-pre7 has a new infrastructure in place which makes it possible
to call SpamAssassin more than once per message, and even to load
different SpamAssassin config files based on a recipient address (or domain),
or based on a policy bank. It provides all the necessary internal support
for per-recipient SpamAssassin processing. If you are doing any work
in this area, the 2.7.0 is the codebase on which to ground any
development work.

As it happens, the switching of SpamAssassin configurations between
messages (or even within a processing of a single mail message with
multiple recipients) is a rather costly operation. For the purpose
of switching a username used for Bayes SQL lookups it suffices to
tell SpamAssassin to switch a username without loading his preferences
config file. Such username switching is a fairly inexpensive operation.

What remains to be done is to map a recipient address to a (virtual)
username, then to group recipients (of a multirecipient mail) into
sets or recipients with a common username (such as his domain name),
then call SpamAssassin once for each username, and distribute
resulting scores back to each recipient as appropriate.

This is a fairly straightforward change from the current 2.7.0-pre7,
based on all the already laid-down supporting mechanisms, and I guess
I can make it into 2.7.0-pre8 without too much trouble, if someone
is interested.

  Mark

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
AMaViS-user mailing list
AMaViS-user@lists.sourceforge.net 
https://lists.sourceforge.net/lists/listinfo/amavis-user 
 Please visit http://www.ijs.si/software/amavisd/ regularly
 For administrativa requests please send email to rainer at openantivirus dot 
org

Reply via email to