views:

446

answers:

6

Is it possible to connect to an SSH server through a Telnet connection?

I am trying to connect to an SSH server from Flash, but there is no OpenSSH implementation available in ActionScript. I can successfully connect to a Telnet server and execute commands.

I am not able to make any changes on the machine with the SSH server. The machine I am connecting with is running Windows XP SP3. I am willing to get whatever software for the Windows machine that is necessary.

A: 

I guess it would be possible theoretically. But you'd have to do the SSL handshake and of course de- and encryption "manually" in actionscript. Prepare for a long development roadmap.

innaM
ie. That's basically the equivalent of implementing ssh yourself.
Martin Beckett
That's what I was trying to say.
innaM
+3  A: 

To connect a SSH server you need a SSH client. Just like connecting to Telnet server a Telnet client is needed.

Maybe you could set up a SSH tunnel between you machine and machine with SSH server, and make the ActionScript to use the remote machine via the SSH tunnel?

Juha Syrjälä
+1: From both a security and simplicity standpoint, I believe this is the best solution.
Dathan
+2  A: 

In practical terms, no. Possible alternative:

You could telnet to a proxy server that you operate and that then establishes SSH connections to where you want. But that would of course be defeating the security purpose of using SSH in the first place.

Carl Smotricz
If telnet proxy works on client machine this won't create any security risk.
Maciek Sawicki
I like the idea of proxy on client machine. Is there a pre-existing software solution that does this?
Jeremy White
Sort of. If you have a telnet daemon running on the proxy host, then you can telnet to it and ask it to `ssh user@host` and you'll get your SSH connection piped through your telnet connection.
Carl Smotricz
Similarly, if you can run the SSH executable from your script, that would do it too.
Carl Smotricz
Oh, and in lieu of a regular daemon, you could use **netcat** to run the SSH client for you. netcat is very versatile that way; Google for it!
Carl Smotricz
+1  A: 

I suppose there is http server on machine with ssh server. You can use php script to execute commands (use ssl to secure connection)

if you have control over client machine you can write (for example in C) ssh proxy to telnet proxy. I think that will be much easier then writing ssh client in actionscript

Maciek Sawicki
I ended up using Mongoose web server with PHP's ssh2 extension.
Jeremy White
A: 

I think you are getting mixed up, and the question itself is misleading as telnet and ssh are two very different things from the tcp/ip viewpoint - SSH uses the defined internet standard port no of 22 (depending on the installation, this may be bumped up to another port by configuration to prevent hackers getting in, generally 2222 is used but it varies!) Telnet on the other hand uses port 23. See here for the clarification of the ports used... In short I am not 100% sure if you can do this but it's worth a shot as I have not tried it...Look here for more details on how to tunnel the POP3 protocol across ssh.

When you connect to port 9999 on the localhost, i.e. 127.0.0.1, you are thereby tunnelling the pop3 server across ssh. As in the example on the securityfocus site, can you forward the telnet port port over to some other port as an example, in your case I think:

ssh -L 9999:telnet:23 somehost

so when you telnet to 9999 you are effectively tunnelled through the SSH.

As a matter of interest what system is running the SSH service? Is it Linux/Unix? The parameter switches to use is -L for local forwarding, likewise for remote forwarding it is -R, the rest of the command parameters remains the same. The essential keyword here is port forwarding.

Hop this helps giving you a hint or two, Best regards, Tom.

tommieb75
If I run ssh -L 9999:telnet:23 localhost on my machine and then run telnet localhost 9999 on the same machine, I don't get into the command line...
Jeremy White
@Jeremy White: Ok! At least you tried, thanks for reading my answer. I am out of ideas on this one...sorry for lack of further input!!!
tommieb75
A: 

You can setup Putty or Tunnelier for the SSH connection and use a local port for you flash socket. See http://www.bitvise.com/port-forwarding

Rinie