通过 RMI 进行客户端的安全身份验证

发布于 2024-12-01 05:00:31 字数 505 浏览 0 评论 0原文

我正在考虑像这样对我的 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 exported, anybody who guesses the correct port can acquire it.

How can I do this the right way?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

毁梦 2024-12-08 05:00:31

看起来当真正的服务被导出时,任何人
猜测正确的端口可以获取它。

不。他们还必须猜测远程对象 UID,并且有一个系统属性导致它们通过安全 RNG 生成。他们还必须具有远程接口类,并且还必须能够使用正确的 IP:端口、远程接口和远程 UID 构造对象的远程存根。不容易。然而,如果您有严重的安全问题,那么您当然应该考虑采用相互身份验证的 SSL,如果您对安全 RMI 非常认真,也许还应该考虑完整的 Jini/Secure JERI。另请参阅我的 RMI-SSL 白皮书

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 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文