通过 RMI 进行客户端的安全身份验证
我正在考虑像这样对我的 RMI 服务的用户进行身份验证
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 ...;
}
}
但是,这可能并不真正安全。我怀疑当真正的服务被导出时,任何猜测正确端口的人都可以获取它。
我怎样才能以正确的方式做到这一点?
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 export
ed, anybody who guesses the correct port can acquire it.
How can I do this the right way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不。他们还必须猜测远程对象 UID,并且有一个系统属性导致它们通过安全 RNG 生成。他们还必须具有远程接口类,并且还必须能够使用正确的 IP:端口、远程接口和远程 UID 构造对象的远程存根。不容易。然而,如果您有严重的安全问题,那么您当然应该考虑采用相互身份验证的 SSL,如果您对安全 RMI 非常认真,也许还应该考虑完整的 Jini/Secure JERI。另请参阅我的 RMI-SSL 白皮书。
No. They would also have to guess a remote object UID, 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 my RMI-SSL White Paper.