SSH Port Forwarding (Tunneling) in Squeak (was: SSH)

Rob Withers reefedjib at yahoo.com
Tue Jan 29 05:41:12 UTC 2008


hi David,

> So my questions are:
> 1. Can you use this to forward a port? If so, do you have an example?

You would need to do some work to get this working.   One of the Messages in 
the SSH-Messages category would be the thing you are looking for but the 
specs could guide you as to which one.  It is probably an 
SSHChannelRequestMessage.  You would need to provide the interface on SSH to 
implement this and somehow remember to do it after your UserAuth is 
completed.  See SSHConnectionPipe>>#makeClient to see what is done for 
having an interactive pty.  This implementation is not very flexible for 
supporting other types of usage like port forwarding.

> 2. Where to set password if the server is expecting one (non-interactive).

I never finished the non-interactive case.  I was thinking that the 
SocketEndpoint could know this (#socket from the perspective of the 
SSHUserAuthPipe) and so SSHUserAuthPipe>>#password would grab it from the 
socket.

Rob

----- Original Message ----- 
From: "David Mitchell" <david.mitchell at gmail.com>
To: "The general-purpose Squeak developers list" 
<squeak-dev at lists.squeakfoundation.org>
Sent: Monday, January 28, 2008 2:17 PM
Subject: SSH Port Forwarding (Tunneling) in Squeak (was: SSH)


> Picking up an old thread...
>
> Would like to use this to do a port forward. Today, I have a little
> Squeak app that talks to a MySQL database on the other side of a
> forwarded SSH port. I'm on windows, so I use plink (command line
> PuTTY):
>
> C:\bin\plink.exe -ssh -P 22 -l username -pw password -L
> 3306:mySqlServerIpAddress:3306 -N sslServerIpAddress
>
> (with placeholders for username, password, and the 2 IP addresses)
>
> This works, but I'd like to get an all Squeak solution (easier for me
> to deploy). Hopefully easier to keep up (plink goes away
> periodically).
>
> I started with:
>
> SSH runBy: 'username' to: 'sslServerIPAddress' port: 22
>
> The first issue was the server wanted a password and I hadn't
> specified one. I couldn't find the appropriate place to hook in a
> password, so I hardcoded my password into this method:
>
> SSHUserAuthClientWaitingForResponse>>#sendPasswordUserAuthRequest
>
> | requestMsg |
> requestMsg := SSHUserAuthRequestMessage new
> userName: self connection userName;
> serviceName: 'ssh-connection';
> methodName: 'password';
> subMsg: (SSHUserAuthPasswordRequestSubMessage new
> "------>"          password: 'password'; "was  password: self
> connection password"
>                     yourself);
> yourself.
> self machine sendMsg: requestMsg.
>
> That worked (I get the banner from the server), but I know I need to
> find where the connection is set up to provide the password.
>
> Even with that hack in place,I get errors every time I type any
> character into the Teletype Morph. I suspect this is because the
> server isn't expecting a shell (-N).
>
> So my questions are:
> 1. Can you use this to forward a port? If so, do you have an example?
> 2. Where to set password if the server is expecting one (non-interactive).
>
>
>
> On Oct 13, 2007 1:48 PM, Robert Withers <reefedjib at yahoo.com> wrote:
>> Thanks for the reminder, Lex.  I published the following packages to
>> Universes, with dependencies, in the System category:
>>         Cryptography Team Package
>>         SSL (depends on Cryptography Team Package)
>>         SSH (depends on Telnet, Cryptography Team Package, SSL)
>> I tested this in my image successfully.  However, my image has two
>> fixes applied in order to successfully load Telnet.  I posted these
>> fixes in an earlier email in this thread:  1 is new and the other is
>> listed somewhere in Mantis.  These need to be applied to the update
>> stream to allow forward progress.
>>
>> BTW, Lex, S/MIME is released in the Crypto Monticello repository and
>> I am done with it.  It works with the basic email client.
>>
>> Cheers,
>> Rob
>>
>>
>> On Oct 12, 2007, at 11:26 AM, Lex Spoon wrote:
>>
>> > Robert Withers <reefedjib at yahoo.com> writes:
>> >> This worked for me.  I loaded them from the Monticello repository.  I
>> >> haven't yet tried to define the package for Crypto/SSL/SSH and I
>> >> probably wont get to it before next week.  I am going on vacation.
>> >
>> > If there is anything that can be done to make the package-posting
>> > process easier, it would be nice to know.  As far as I can tell,
>> > though, you open an editor, create an account, and post your package,
>> > all using a GUI that is included right in the image.  Ideas for
>> > improving it are always welcome, though!
>> >
>> >
>> > Oh, and to second everyone else: ssh in Squeak -- very cool!
>> >
>> > -Lex
>> >
>> >
>>
>>
>>
>
> 




More information about the Squeak-dev mailing list