Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2005

Tip: Looking for answers? Try searching our database.

RMI Registry Creation - How to set interface?

Thread view: 
Neo_0815@gmx.net - 17 Jun 2005 15:24 GMT
Hello,

i got following Problem.

If i create a Registry with the LocateRegistry Object,

LocateRegistry.createRegistry("PORT");

a Registry is successfully created.

I then can rebind to this factory like registry.rebind(
//127.0.0.1:PORT/Service, server) .

All is working fine, but a look at netstat shows that the registry is
listening on all interfaces, the server too as all client connections
also.
How can i forbidd this, the registry should only listen to localhost
interface, and only to that, no to all like it is now.

I searched a little bit but the only thing i've found is the second
methd:

LocateRegistry.createRegistry(int port, RMIClientSocketFactory csf,
RMIServerSocketFactory ssf)

This SocketFactory is only an abstract class, do i really have to
implement my own factory, to reach my goal, or are there some
properties i missed or how do u solve this problem?

best regards

Torsten
Neo_0815@gmx.net - 17 Jun 2005 18:02 GMT
I respond to myself.

I got it, but its really  pain design.

U have to implement your own RMISocketFactory and have to overwrite the
createServerSocket Method.

The java interface restricts u, that u can only submit a port, so u
have to "hardcode" the network interface in the creation of the socket
in your method, best choice to do it as a property from a ressource
bundle.

In creation of the Factory, the ServerSocket Method is called
automatically at instantiation, so you cant set hostname and port
afterwards.
You arent able to have one factory with a changeable interface per
parameter, you have to write an implementation for every new Interface.

If i am wrong and its possible, any help is welcome.

best regards

Torsten
Esmond Pitt - 18 Jun 2005 10:00 GMT
> I respond to myself.
>
[quoted text clipped - 15 lines]
>
> If i am wrong and its possible, any help is welcome.

You are correct, if you want for some reason to listen at only one
interface you have to supply an RMIServerSocketFactory which creates
ServerSockets which do so. The circumstances under which you want to do
this are pretty rare.
Neo_0815@gmx.net - 22 Jun 2005 10:14 GMT
Rare - hm imagine an root server environment, perhapt a VPN too, web
interface & Co, where RMI is needed but not on all interfaces to listen
to all people of the net.

I think it quite common to set the interface, not really in programmers
view, but in admins view of making the server secure, its imho a mus
thave feature.

thx for answer.

best regards

Torsten


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.