aspose file tools*
The moose likes Security and the fly likes Using ssh pub/pri key implement port22 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Security
Bookmark "Using ssh pub/pri key implement port22 " Watch "Using ssh pub/pri key implement port22 " New topic
Author

Using ssh pub/pri key implement port22

Diego Bowen
Ranch Hand

Joined: Aug 19, 2003
Posts: 50
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???
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

I'll move this over to Security, see if there are any responses ready and waiting there.


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
Lewin Chan
Ranch Hand

Joined: Oct 10, 2001
Posts: 214

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.
Pankaj Kr
Author
Ranch Hand

Joined: Sep 09, 2003
Posts: 80
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 ]

Pankaj Kumar
Home - WebLog - J2EE Security
Diego Bowen
Ranch Hand

Joined: Aug 19, 2003
Posts: 50
Thanks guys, however is there a way I can use ssh tunneling via port 22 and java rmi technology??? Do you know of any sources I get investigate??? Thanks in advance!!
Adrian Yan
Ranch Hand

Joined: Oct 02, 2000
Posts: 688
hmm... so you want your server sitting on top of SSH, I don't think that would work. However, you can remote execute thru SSH. ssh -l user@remote <command>. Hope that helps.
Pankaj Kr
Author
Ranch Hand

Joined: Sep 09, 2003
Posts: 80
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.
Diego Bowen
Ranch Hand

Joined: Aug 19, 2003
Posts: 50
Thank you so very much for replying so throughly a manner. Keep up the great work!!
Mr. C Lamont Gilbert
Ranch Hand

Joined: Oct 05, 2001
Posts: 1170

Yea its old. Just wanted to say its a good article and still relevant. Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using ssh pub/pri key implement port22