Re: Spawning a Secure Xterm



In article <1167509031.806024.164210@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
<tom.rectenwald@xxxxxxxxx> wrote:
Hello all,

I'm trying to teach myself Tcl and am focusing primary on creating an
application in ExpecTk. What I'm trying to do is spawn an Xterm and
pass it a series of commands while still maintaining some security.
Here is what I've come up with thus far:

1) spawn xterm -e "expect -f $ssh_file" &
The $ssh_file is Expect code as such:

spawn ssh -o StrictHostKeyChecking=no $s
expect \"*ssword:\"
send \"$p\\r\"
expect \"\\$ \"
interact"

This method works fine, but leaves me with a file containing the
password in clear text, and that is what I'm trying to avoid. I set
the file to have a random name via [expr rand()], set permissions to
0400, and after the xterm spawn, I wait .1 seconds (sleep .1) and
delete it. However, there is still a text file out there, that
survives for .1 seconds and I imagine that'd be easy to take advantage
of by a race condition.
.
.
.
I admire your security standards; when I have a randomized
file that is 0400, I don't call it "easy to take advantage
of ..."

How about putting
file delete $ssh_file
in the first line of $ssh_file? Expect will already have it
in memory by that time, and doing so will reduce your hazard
from 0.1 seconds by at least an order of magnitude.
.