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

Re: [suse-security] Per user config for SpamAssassin with amavisd-new and cyrus-imapd (SOLVED!)



OK, here I answer my own question to get that info stored in the mailing-list 
archives to be searched by Google or so...

I'm running a SuSE 9.0 based mail-server. The users on the mail-server have 
all a shell account with the same name as there mail-user and the 
authentication is done via PAM from /etc/password and /etc/shadow.

I put the following into /etc/postfix/master.cf
cyrus     unix  -       n       n       -       -       pipe
    flags=R user=cyrus argv=/usr/lib/cyrus/bin/deliver.sh ${user} ${extension}
instead of
cyrus   unix  -       n       n       -       -       pipe
  user=cyrus argv=/usr/lib/cyrus/bin/deliver -e -r ${sender} -m ${extension} 
${user}
vscan     unix  -       n       n       -       10       pipe
  user=vscan argv=/usr/sbin/amavis ${sender} ${recipient}

and into /etc/postfix/main.cf
mailbox_transport = cyrus
mailbox_command = /usr/lib/cyrus/bin/deliver.sh "$USER" "$EXTENSION"
content_filter = vscan:
(the second command ist AFAIK useless because mailbox_transport has precedence 
over mailbox_command but I quoted it just in case...)

The /user/lib/cyrus/bin/deliver.sh looks like that:
#!/bin/sh
# /usr/lib/cyrus/bin/deliver.sh
if [ "$#" -ne 2 ]; then exit 64; fi
user="$1"
extension="$2"
if grep -q "^$user:" /etc/passwd; then :; else exit 67; fi
/usr/bin/spamc -f -u "${user}" -e /usr/lib/cyrus/bin/deliver -e -r "${sender}" 
-m "${extension}" "${user}"

(The spamc-call with all its parameters should be one line)
This all is modification from 
http://www.tml.hut.fi/~pnr/spam.html.
Many thanks to Pekka Nikander.

Than I deactivated the SpamAssassin-call from Amavis to avoid double 
spam-checking. Put in/ uncomment in
/etc/amavisd.conf
the line
@bypass_spam_checks_acl  = qw( . );

Now the mail-flow is:
fetchmail->postfix->amavisd-new->deliver.sh->SpamAssassin (spamc invoked as 
user to that the mail should be delivered)->deliver->via LMTP->cyrus

Additionaly I run SpamAssassin 3.0.0 from the unofficial RPM-packages from 
Carsten Hoeger (ftp://ftp.gwdg.de/pub/linux/suse/people/choeger).


On Samstag 27 März 2004 13:58, David Huecking wrote:
> Hi folks,
>
> maybe someone could give me a hint...
> I switched from:
> fetchmail->sendmail->sendmail.milter->Amavis->.forward->procmail->spamc(Spa
>mAssasin)->INBOX which did global virus checking and per user spam checking
> with Bayes testing to
> fetchmail->postfix->amavisd-new->perl-spamassassin->cyrus-imapd
> which does global virus and global spam checking BUT NO PER USER spam
> checking, so without Bayes testing! :-(
> So the rate of unreconised spam did increase.
>
> I fiddled around with options in the /etc/mail/spamassassin/local.cf, but
> they were ignored because amavisd-new calls spamassin via perl interface
> and takes some SA parameters from the /etc/amavisd.conf (beginning with
> $sa_).
>
> I tried calling a SUIDed cyrus deliver (without SUID deliver hasn't got the
> right: deliver[3876]: connect(/var/lib/imap/socket/lmtp) failed: Permission
> denied) to user cyrus via .forward and a .procmailrc. The log said that
> lmtpd was called, but depending on the syntax of deliver in the .procmailrc
> the mail was delivered to the INBOX-file in /var/spool/mail or just
> vanished!
>
> One example for my .promailrc:
> :0 fw
> :
> |/usr/bin/spamc -f
> |/usr/lib/cyrus/bin/deliver -e -a david -m user.david
>
> and the .forward:
> "|IFS=' ' && exec /usr/bin/procmail -f- || exit 75 #user"
>
>
> Could someone give me a hint using sieve or procmail for a per user
> SpamAssassin check?
>
>
> Thanks in advance.
> --
> Eat, sleep and go running,
> David Huecking.
>
> Encrypted eMail welcome!
> GnuPG/ PGP-Key: 0x57809216. Fingerprint:
> 3DF2 CBE0 DFAA 4164 02C2  4E2A E005 8DF7 5780 9216

-- 
Eat, sleep and go running,
David Huecking.

Encrypted eMail welcome! 
GnuPG/ PGP-Key: 0x57809216. Fingerprint: 
3DF2 CBE0 DFAA 4164 02C2  4E2A E005 8DF7 5780 9216

--
Check the headers for your unsubscription address
For additional commands, e-mail: suse-security-help@xxxxxxxx
Security-related bug reports go to security@xxxxxxx, not here