[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Exim4 Cyrus21 SA



On Tue, Jan 06, 2004 at 01:36:20PM -0800, Quenten Griffith wrote:
> Hello all I am looking for suggestions on how to best
> implement a Exim4 with Cyrus IMAP mail boxes (virtual
> users) with spamassassian where users prefs. are
> stored in mysql.  Currently I have tried amavisd-new
> but it does not use spamd/spamc so it will not connect
> to mysql to retrieve users preferences.  I then tried
> to use sa-exim, but that connects to the mysql server
> as the debian-exim4 user instead of the user in the
> from field of the email. Does anyone have a working
> example or suggestion they can give me for me to
> achieve this?

I designed and built a similar system a few months ago.  On my system,
however, I elected to store only user preferences in a database, and to
keep bayes and awl data in the filesystem.  Because of this, my users
have /etc/passwd entries, though they're limited to a form similar to
foo:x:15493:15493::/home/virtualusers/foo:/bin/false

In spamassassin, database connections don't need to be made as
individual users, but instead should be made as something like
debian-exim4 or spamassassin or something like that.  Spamassassin with
then issue db queries such as "SELECT preference, value FROM userpref
WHERE username='<recipient>'".

I decided not to pursue the possibility of having bayes and AWL in an
SQL database for a couple of reasons.  The real reason to use a
database, IMO, is that it makes it much easier to provide a web frontend
for updating user configurations.  But you don't need such a thing for
bayes and AWL.  Those work just fine in flat files, and I would bet
actually perform better there due to their being less overhead.

The relevant router and transport in my exim configuration look like
this:
spamtest:
  driver = accept
  # OK, it's still better than sendmail, but not by much...
  # Translated to english, the following condition is true iff
  # the message did not originate via local-bsmtp (because that's
  # what spamassassin uses to resubmit the filtered message) and
  # the local-part is present in /etc/mail/filterusers
  condition = ${if and \
                        { \
                                { ! eq{$received_protocol}{local-bsmtp} }\
                                { == { ${lookup{$local_part} \
                                          dbmnz{/etc/mail/filterusers}{1}}} \
                                     {1}\
                                }\
                        } \
               {yes}{no}}
  check_local_user
  transport = spamcheck

spamcheck:
  driver = pipe
  batch_max = 1000
  use_bsmtp
  command = /usr/sbin/exim -bS
  transport_filter = /usr/local/bin/spamc -u $local_part

Somewhere after the spamtest router you should have another router that
feeds you mail to Cyrus via LMTP, or, in my case, to another machine via
SMTP, since I wanted to keep the spamassassin processes, anti-virus
software, etc running on a different machine than the one that runs
Cyrus.

HTH.  Let me know if you have any questions.

noah

Attachment: pgpsDldhplwgD.pgp
Description: PGP signature


Reply to: