Spawning a Secure Xterm
- From: tom.rectenwald@xxxxxxxxx
- Date: 30 Dec 2006 12:03:51 -0800
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.
2) exec xterm -e "expect (expect commands above)
I found that by running an exec, I could pass the Expect commands
without having to use a file. However, in a 'ps' listing, everything
shows... including the password.
I tried to compile/obfuscate the $ssh_file code via freewrap and shc,
but it looks like one is geared towards pure Tcl and doesn't handle
Expect commands, and the other is for shell scripts. Running the
Expect within a #!/bin/sh via an exec command didn't work either, would
not execute the compiled code.
Now I'm starting to hope there may be an easier way to do this. My
goal is to spawn an Xterm, automatically SSH out to another system, and
pass the password. The environment that I'm working in does not allow
for Authenticated Keys... so this is pretty much the only way I can do
it. I just want to ensure that it is as secure as possible.
Any help would be appreciated, I'll be glad to post/send the actual
code if it helps. I do have it working, in a fashion, by using method
1, but am hoping there is a more secure way to run it. Also hoping
that it is proper etiquette to post Expect stuff in this Tcl group, if
not, please let me know.
Best Regards,
Tom
.
- Follow-Ups:
- Re: Spawning a Secure Xterm
- From: Cameron Laird
- Re: Spawning a Secure Xterm
- From: Cameron Laird
- Re: Spawning a Secure Xterm
- Prev by Date: Re: Tcl faster than Perl/Python...but only with tricks...
- Next by Date: Re: Tcl faster than Perl/Python...but only with tricks...
- Previous by thread: -type error
- Next by thread: Re: Spawning a Secure Xterm
- Index(es):
Relevant Pages
|