I have a rmi application that uses a socket factory to encrypt communication between the client/server. There is no dynamic class loading the stub is with the client. Everything works fine. Now I want to my my server code to a machine that only has port 22 open for communication to the outside world. It has implement a ssh public/private scheme. Is there any way I can use that existing port???
Now I want to my my server code to a machine that only has port 22 open for communication to the outside world.
I assume this to mean that the firewall protecting this machine only allows ssh access from the outside world, and this server has sshd installed. The quick answer is to say use a SSH tunnel. It is supported by all ssh implementations (mindterm springs to mind if you want a java implementation that you can use programatically). Details about ssh tunneling can be found on the web
I have no java certifications. This makes me a bad programmer. Ignore my post.
BTW, if want to know the command to forward pt1 of local machine to pt2 of remote machine rm_name, then the command is:
You can have multiple -L options, but I don't think you can have a wild card for port number. So, you will have to specify a fixed port no. in the constructor of the RMI Implementation class. [ September 24, 2003: Message edited by: Pankaj Kr ]
Check out this article for some detailed discussion on how to setup RMI over SSH. I should mention that the motivation for the article came from the discussion in this thread (And I acknowledge it in the article ). One thing I discovered after sending out the article is that there exists an elegant way to specify the hostname string that gets associated with remote stubs for locally created remote objects. This is done by setting the Java system property to the desired value (which should be "localhost" for SSH tunneling), as explained in the official RMI documentation. This capabilitiy actually makes SSH tunneling for RMI much more elegant and easy to setup.