procmail
[Top] [All Lists]

Re: some problems...

1997-05-20 14:57:00
On Tue, May 20, 1997 at 02:01:45PM -0500, Philip Guenther wrote:
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
      MAILER(procmail)
line in your .mc file?  You *are* creating your sendmail.cf from a .mc file,
right?

        Nope :( Our sendmail.cf is tweaked to the point where everything is
standing on its head... I don't understad 99% of it and don't want to touch
working thing (how I'll repair it?!).

Anyway, if nothing else you should change the A= directive in the above to
something like:
      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.

        Well... I did that... chowned /etc/procmailrcs/halyava to 
user halyava... still it runs as root :(

Mhalyava,P=/usr/local/bin/procmail.halyava, F=qfSPls89DFMhun, S=10/30, R=20/40,
M=100000, T=DNS/RFC822/X-Unix, U=halyava, A=procmail -Y -m $h $f $u
...
:0
| touch /tmp/test
...
-rw-------   1 root     www     0 May 21 00:37 test

:0
* (^TO:|for).*\/request@(halyava|freebee.techno|homepage.techno).ru
| /u/halyava/bin/halyava.pl
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
      :0
      * RCPT ?? ^^request@
      |/u/halyava/bin/halyava.pl
That'll handle Bcc's and subscriptions to mailing lists properly, which
your recipe can't.

        Thanks! This worked (without @ at the end tho)...

procmail: [10415] Tue May 20 19:35:14 1997
procmail: Executing "/u/halyava/bin/halyava.pl"
procmail: [10415] 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.

        Thanks again. This solved a problem, but made another  problem
for me, 'cause script merely reads while(<STDIN>)... oh well. Some debugging
required...
 
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.

        Yes, it's better... but only if I'll be able to avoid running
it as root.

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"?  

        Whoops! Of couse ^FROM_DAEMON

      Either way, you can replace the condition:
      * ! ^FROM_DAEMON

with:
      * -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...)

        Hmm. I'll try this recepie if our users will complain enough 
to shift me on my chair... :)
 
BOZOS=`echo \`cat /u/halyava/.bozos\`|tr ' ' '|'`
:0
* !^FROM_DAEMON
* !^X-Loop: request(_at_)halyava(_dot_)ru
* $(^From:|by|from).*\/${BOZOS}
$MATCH is empty :(
Because you should be using something like:
      BOZOS=`perl -0777 -pe 's:\n+:|:g;s:[\s|]+$::;' /u/halyava/.bozos`

        Ahhha... got it :)

-- 
Roman V. Isaev                         Moscow, Russia
========================================================
Homepage ------------> http://accessnet.ru/lp/rm/index.html
Obscene limericks ---> http://accessnet.ru/lp/rm/eng/elim.html
Firearms in Russia --> http://accessnet.ru/lp/rm/eng/firearms.html

<Prev in Thread] Current Thread [Next in Thread>