[Exim] procmail with .forward

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Jason Ostrom
Date:  
À: exim-users
Sujet: [Exim] procmail with .forward
Hello all,

I'm running Exim 4.12 with RH 7.2, trying to use SpamBouncer
(procmail) as a spam filter for ONLY users who have a .procmailrc in
their home directory. I'm wondering the best way to do this overall
and any implementation advice.

Here are the issues:
* I can configure procmail to run from .forward and use the exim
redirect router. But I've decided not to do this, for reasons below.

* There are some users who will put external forwarding email
addresses in their .forward, after the procmail line. For these
users, mail will still get forwarded to a remote system. I want
procmail/exim to stop the message from getting forwarded on if it is
marked as spam.

* I could use procmail across the board for local mail delivery, but
not everyone will be using .procmailrc. For users who do
not, I would like the localuser/local_delivery router/transport to
deliver mail.

The best way I can think to do this is to run a procmail pipe for all users
who have a .procmailrc, and run it before the userforward router.
I've been able to do this, but once procmail delivers, it doesn't hit
the userforward router after that, which might be necessary for users
who want to use .forward to forward to external hosts.

I basically want exim to be able to filter and deliver mail locally
for users who have a .procmailrc, and still forward the mail on if the
user has a .forward in their home directory. But not run the
router/transport that will do $home/.forward if SpamBouncer has marked
the header as containing spam. SpamBouncer
marks the header with "X-SBClass: OK" and other classifications if the
mail has been marked for spam. Would there be a better way, or should
I do a conditional check for spam before running the .forward?

For users who don't have a .procmailrc, I would like
localusers/local_delivery to deliver mail.

Any help appreciated.

Here are my relevant routers/transports:

Routers:
procmail:
driver = accept
check_local_user
require_files = ${home}/.procmailrc
transport = procmail_pipe

userforward:
driver = redirect
check_ancestor
check_local_user
no_expn
file = $home/.forward
file_transport = address_file
pipe_transport = address_pipe
reply_transport = address_reply
no_verify
# filter

# This director matches local user mailboxes.
localuser:
driver = accept
check_local_user
transport = local_delivery

Transports:
local_delivery:
driver = appendfile
delivery_date_add
envelope_to_add
file = /var/mail/$local_part
group = mail
mode = 0660
return_path_add

#procmail
procmail_pipe:
driver = pipe
delivery_date_add = true
envelope_to_add = true
return_path_add = true
command = /usr/bin/procmail -f
user = ${local_part}
group = mail