Re: [Exim] procmail with .forward

Top Page
Delete this message
Reply to this message
Author: Jason Ostrom
Date:  
To: exim-users
Subject: Re: [Exim] procmail with .forward
I'm a step closer to resolving this problem. With Exim, anything can
be done. I know how to do the conditional check with SpamBouncer, but
the main problem is after the procmail router/transport runs, how do I
get the routing process to continue?

procmail:
driver = accept
check_local_user
require_files = ${home}/.procmailrc
transport = procmail_pipe
### Need to continue to route the message so that userforward can be
### checked

# run userforward only if SpamBuster marks SBClass OK; that is,
# message does not contain spam
userforward:
condition = ${if eq {$header_X-SBClass:}{OK} {1}{0} }
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

# This director matches local user mailboxes.
# Will have a condition here to check if the header_X-SBClass exists
# If it has, no need to run localuser; If it hasn't user doesn't have
# a .procmailrc, procmail has not delivered so it still needs to be
# delivered
localuser:
driver = accept
check_local_user
transport = local_delivery


#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

Jason Ostrom> Hello all,

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

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

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

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

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

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

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

Jason Ostrom> Any help appreciated.

Jason Ostrom> Here are my relevant routers/transports:

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

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

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

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

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


Jason Ostrom> --

Jason Ostrom> ## List details at http://www.exim.org/mailman/listinfo/exim-users Exim details at http://www.exim.org/ ##