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