Re: How to enable spamassassin with user preference in LDAP when running with Mailscanner ? Anny Lei wrote:
> Dear developers,
>
> I am using Mailscanner with Spamassassin and I want Spamassassin
> lookup LDAP for user preference.  I have put user_scores_dsn,
> user_scores_ldap_username, and user_scores_ldap_password in local.cf. 
> When I test running the command 'spamd -D --ldap-config -x', then  cat
> /root/sample-spam.txt | spamc -u jndx@test.domain.com', it works
> perfectly fine.   But when Mailscanner accepts the email, Spamassassin
> doesn't lookup ldap for user preference (as observed from ldap.log
> file).   I do not know where to specify --ldap-config -x command for
> Spamassassin because  Mailscanner is not calling Spamassassin daemon,
> spamd.
>
> Could you please let me know how to instruct Spamassassin to lookup
> LDAP for user preference when running with MailScanner ?   Thanks in
> advance for your assistance.

Follow-up part 2. I just realized the tone of my message might be lost
on you. I'm correcting it to avoid misguiding you.

However, please cease this discussion on this list. This message belongs
on the users list, not the development list. This list is designed for
the discussion of development efforts within the SpamAssassin project
only. Usage questions should be directed to the users list, and the
developers do read and reply to messages posted there.

Fundamentally, MailScanner is not designed to support per-user
configurations. This isn't anything that SpamAssassin can change, but it
is also something MailScanner cannot be easily changed to do. On top of
it all, it would also change what MailScanner is, and really defeat some
of the design criteria for MailScanner.

Generally speaking, most tools that run at the MTA (mail transport
agent) layer don't support per user configuration. Those that do,
support it poorly. If you really and truly want per-user configuration,
the best place for you to call SA is at the MDA (mail delivery agent)
layer, ie: via procmail.

Calling at the MTA layer suffers from several problems if you want to
have per-user configuration:

1)  MTA layer tools must guess at what the final recipient is, because
they only have the RCPT TO: address to work from. However, that address
might be an alias. Odds are there is no "webmaster" user on your system,
it's just an alias to root's mailbox. Etc, etc, etc. While generally
there's not many aliases on a system, some sites have lots of aliases,
and MTA layer user-guessing breaks down when this happens.

2) At the MTA layer, if a message is sent to multiple users, it is one
message with multiple recipients. The MTA layer tool must make a
decision as to who's user preferences to apply. Because there's only one
message to work with, it can only use one, and most will generally use
"whoever came first" in the recipient list. There are ways around that,
such as forcing a message to be requeued separately, but this introduces
inefficiency on the MTA side, all to do something that happens naturally
at the MDA.

Of course, MDA layer tools call SA once per recipient, instead of once
per message. This results in more calls to SA, and more CPU usage, but
that's what you need to do per-user configurations properly.


