procmail
[Top] [All Lists]

procmail and executing binaries

1996-09-25 21:51:05
I like to get access to my Sun at work from my home Linux machine, via
dialup ISP with dynamic IP addressing. The problem is, telnet is firewalled at
work. Here's how I work around it:

I dialup my ISP, fire up X, set "xhost +", and get my dynamic IP, say
it's 111.222.333.444 for that session. I mail my work machine a
message that looks like:

#---
To: me(_at_)work(_dot_)machine(_dot_)com
Subject: X-SEND

IP: 111.222.333.444:0.0
#---

Then, up until recently, I used a procmail recipe like...

#---
:b
^Subject: X-SEND
| cat > in_msg; $HOME/dScripts/send_xterm
#---

and a /dScripts/send_xterm like...

#---
#!/bin/sh
XX=`cat in_msg | grep "^IP: .*" | sed "s/IP: \(.*\)/\1/"`
xterm -display $XX -e login &
#---

and in about 30 seconds to a minute, an xterm login shell would pop up
on my machine at home, the display redirected to my dynamic IP. Up
until about a week ago that is.

(I actally have the body of the message pgp encrypted, so the security
risks are almost, but not quite as bad as they appear.)

The version of procmail that is installed at work is 2.70 thus the
old-style recipe.

When it failed recently, I examined the log and found that the various
binaries in the shell script were being interpreted by the shell as
shell scripts instead of binaries! hmmm. magic number is wrong? After
much playing I broke down and asked the system manager what's up with
the mail? "Oh yeah, due to automounting NFS problems on the alphas I
re-aliased everyone's mail to run through an ultrix machine. I'm not
sure exactly what he's talking about, but I'm guessing that what
happened as a result of this was that the procmail process that
scanned my home directory for the .procmailrc file was running on an
ultrix machine. It interpreted the send_xterm script with an ultrix
/sh/bin (they messed with the NFS directories too), and this sh tried
to execute the Sun binaries, grep, sed, and xterm. Much havoc and
confusion on my part ensued.

I have so far fixed this by changing the .procmailrc to look like:

#---
:b
^Subject: X-SEND
| cat > in_msg; rsh bpbsn $HOME/dScripts/send_xterm
#---


My questions are:

- First, does this seem to be a reasonable explanation of what is
  happening?

- Is it normal for sites with multi-platform unix boxes all hooked
  up with NFS, to run only one procmail binary to process all user's
  .procmailrc files, regardless of their platforms? (i think i know
  the answer to this one).

- When procmail starts a program as the result of a "|" action line
  what determines and where does it find the shell to interpret the
  remaining shell commands? /usr/bin/sh contains ultrix binaries on
  ultrix machines, Sun binaries on Sun machines. (i think i know this
  one too.)

- If it does use a /bin/sh on the same platform that procmail is on,
  why does it try to run Sun binaries when it sees them in my
  send_xterm script file? (this one i have no clue, it seems just as
  likely that it would run the ultrix binaries of these.)
  
Thanks and C Ya!

-- 
     brad baker
     bbaker(_at_)digital(_dot_)net

<Prev in Thread] Current Thread [Next in Thread>
  • procmail and executing binaries, Bradley Baker <=