"Roman V. Isaev" <rm(_at_)techno(_dot_)ru> writes:
First of all, DROPPRIVS doesn't work (or I'm unable to understand
documentation). I have a mailer:
Mhalyava,P=/usr/local/bin/procmail.halyava, F=qSpPls89DFMhun, S=10/30,
R=20/40, M=100000, T=DNS/RFC822/X-Unix, U=halyava, A=procmail -p -Y -f $g -a
$u $h halyava
Why aren't you just using the procmail mailer created via the
line in your .mc file? You *are* creating your sendmail.cf from a .mc file,
Anyway, if nothing else you should change the A= directive in the above to
A=procmail -Y -m $h $f $u
The -p is pointless (sendmail always flushes the environment), and the
"-f $g" bit should be replaced with the 'f' flag in the F= directive.
As for the -m, well, check the manpage. This should take care of your
"running as root" problem, if nothing else.
Also note that the 'p' flag in the F= directive won't do anything,
because a) you're not talking SMTP, and b) the 'l' flag is present.
a record in the mailertable:
and /etc/procmailrcs/halyava with
in the begin of this file. Well. Anyway, this damn thing runs as root :(
And I want to run it only as user halyava...
This is what the -m flag is for.
Second problem: I have a recepie:
You should be checking the envelope recipient, passed in on the command
line as $1 (with your mailer definition) or $2 (with mine or the 'real'
procmail mailer definition):
RCPT = $2 # or maybe $1
* RCPT ?? ^^request@
That'll handle Bcc's and subscriptions to mailing lists properly, which
your recipe can't.
Usually, this works. But sometimes script halyava.pl fails for unknown
reasons (dunno why... it works fine when I run it maually and feed
the failing message into its stdin):
procmail: Matched "request(_at_)halyava(_dot_)ru"
procmail: Match on "((^((Original-)?(Resent-)?(To|Cc|Bcc)|(X-Envelope|Apparent
procmail:  Tue May 20 19:35:14 1997
procmail: Executing "/u/halyava/bin/halyava.pl"
procmail:  Tue May 20 19:35:16 1997
procmail: Error while writing to "/u/halyava/bin/halyava.pl"
The perl script isn't reading all of the message. This causes procmail
to think something is wrong, so it considers the recipe a failure. If
the perl script isn't supposed to be reading the entire message, then
you should put the 'i' flag on the recipe.
I'm going to skip (and elide) your next question, because I don't know
the answer, though once again you should be testing RCPT instead of
looking at the headers.
Glitch #4: ^MAILER_DAEMON is a good thing, but it kills mails from root@, and
it's bad... we have several recepients who write from root (don't tell me
"it's wrong" -- yes it is, but tell it to THEM). BTW, sometimes some blasted
old PC software, designed for UUCP uses root as standard name. How to
use MAILER_DAEMON and still accept mail from roots?
I've never heard of "^MAILER_DAEMON". Perhaps you mean "^FROM_MAILER" or
"^FROM_DAEMON"? Either way, you can replace the condition:
* ! ^FROM_DAEMON
* -1^0 ^FROM_DAEMON
* 2^0 ^(((Resent-)?(From|Sender)|X-Envelope-From):|>?From ).*root
and you'll get the desired effect (beware if you have other scoring
condition on that recipe!). The same thing works for ^FROM_MAILER.
(And to anyone who thinks the ".*root" will accept too much, think
*really* hard before you say so...)
Last thing can be avoided, but simply annyoing: when I use
BOZOS=`echo \`cat /u/halyava/.bozos\`|tr ' ' '|'`
* !^X-Loop: request(_at_)halyava(_dot_)ru
$MATCH is empty :(
Because you should be using something like:
BOZOS=`perl -0777 -pe 's:\n+:|:g;s:[\s|]+$::;' /u/halyava/.bozos`