Thursday, January 17, 2008

SSH Applet

I found myself in an training class where I was stuck on a Windows XP system that I could not modify. I wanted to SSH to one of my servers, but there was not SHH client. Since I could not install one, I needed a portable, self contained, mechanism. Sounds like a job for a Java applet.

A quick Google search located JavaSSH.org. It sounded simple enough: embed an applet in a page on the server. As the target browser has a JRE, you've got access.

Initially, I thought this might solve another problem for me, also. I've been in situations where ports 80 and 443 were the only outbound ports available. So, I figured this could get me through a firewall since it would be in a browser.

Turns out, when I deployed this, I made a few mistakes in logic. The first was that I accepted the default to connect to localhost, in other words, the server where the webpage was hosted. Didn't work. The reason is that the applet tries to connect to the Windows client, because the applet does not run on the server, but in the local browser.

I changed the host from localhost to the server's hostname, but it still failed. Java can't get to DNS. I had to configure the server's IP address. This allowed a connection.

Lets backtrack to the firewall issue. Another error in logic. The applet still uses port 22, since it's running locally.

The applet still needs a little tweaking, as the connection times out in less than a minute. If I can get a reliable connection, I'll post the good config.

No comments:

Post a Comment