Secure authentication of client over RMI

孤街醉人 提交于 2019-12-12 06:33:44

问题


I was thinking to authenticate users of my RMI service like this

interface RemoteService extends Remote { ... }
interface RemoteServiceProvider extends Remote { ... }
class RemoteServiceProviderImpl implements RemoteServiceProvider {
   RemoteService getService(String authCode) throws RemoteException {
     if (check(authCode)) return (RemoteService) UnicastRemoteObject.export(theRemoteService, 0);
     else throw ...;
   }

}

However, that's probably not really secure. I suspect that when the the real service is exported, anybody who guesses the correct port can acquire it.

How can I do this the right way?


回答1:


It looks like when the the real service is exported, anybody who guesses the correct port can acquire it.

No. They would also have to guess a remote object ID, and there is a system property that causes them to be generated via a secure RNG. They would also have to have the remote interface class, and they would also have to be able to construct a remote stub to the object with the correct IP:port, remote interface(s), and remote UID. Not easy. However you should certainly look into SSL with mutual authentication if you have serious security concerns, and maybe the full Jini/Secure JERI thing if you are totally and utterly serious about secure RMI. See also this white paper.



来源:https://stackoverflow.com/questions/7167380/secure-authentication-of-client-over-rmi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!