As a side-note, have you considered passing the domain and sender as
the first two args, then shifting them off internally? That would
look something like:
filter unix - n n - - pipe flags=
user=filter
argv=/opt/procmail/procmail -t -m
/opt/procmail/filter.rc
${nexthop} ${sender} ${recipient}
and then in the rcfile:
# Make sure there are enough args: should be at least three
# We use scoring (c.f. procmailsc(5)) to perform arithmetic for us
:0
* 3^0
* $ -$#^0
{
LOG = "Usage: procmail -m $_ domain sender recipients...
"
EXITCODE = 64 # EX_USAGE
HOST # give up processing
}
DOMAIN = $1
SENDER = $2
# Drop the first couple args so that $@ contains just the recipients
SHIFT = 2
The advantage to doing it that way is that you can then use
procmail's uid-switching capabilities: if you put the rcfile beneath
/etc/procmailrcs/ then procmail will become the user that owns the
rcfile, something which can be quite useful in many situations. If you
don't need to do that, then you should _not_ put the rcfile under there.
Whether the above change in usage makes sense then is up to you.
Hmm. I don't really need the uid-switching capabilities in this case, but
I'll definately keep it mind for further down the road. This particular
procmail script only needs to run as the user "filter". When a mail comes
in for say "user1(_at_)example(_dot_)com" it hits the postfix transport map and
sees
it needs to go to the filter transport. The filter transport is a piped
procmail script. I have only one INCLUDERC in it which takes the domain
name and looks up /opt/procmail/domains/$DOMAIN/main.rc for all thier
individual rule preferences (basically a bunch of variables set to yes or
no). The script never actually delivers it locally; depending on thier
rules it may pass it to a local second copy of postfix that has no smtpd
daemon but has a queue and smtp client and it own transport map with an
entry that will forward mail directly to another server. In a sense its a
spam-cleansing relay and I'm using procmail as a pure filter and not a
delivery agent in any way (at least for the marked domains; the local
virtual domains will each have a per-user procmail filter as the local
delivery agent).
Is there any performance or security advantage that either method of
passing (env. variable or arg) has over the other?
--
Jim Raney
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail