我想让服务使用一些凭据向 ZooKeeper 进行身份验证,以便它们可以访问配置信息。
Digest authentication对于我的要求来说不够安全:“通过以明文形式发送用户名:密码来完成身份验证”。
是否有简单且安全的替代方案可用?我能够使用 Curator,并且该项目是基于 Java 的。
如果没有,创建我自己的身份验证方法将涉及哪些步骤?实现 AuthenticationProvider ,在服务器上设置 zookeeper.authProvider.1
以使用此提供程序,然后将任何身份验证 token (可能是用户名/密码哈希)传递给 CuratorFrameWorkFactory
构建器作为 byte[]
参数?
最佳答案
通过 HTTPS 使用摘要(甚至基本身份验证)。让传输层加密解决您的安全问题。尝试推出自己的应用程序层加密既困难又很可能导致安全漏洞。
更新:
关于zookeeper和SSL。根据动物园管理员网站:
New in 3.4: Netty is an NIO based client/server communication framework, it simplifies (over NIO being used directly) many of the complexities of network level communication for java applications. Additionally the Netty framework has built in support for encryption (SSL) and authentication (certificates). These are optional features and can be turned on or off individually.
zookeeper 文档在配置方面有点稀疏,我建议您查看 Netty 文档。
关于java - ZooKeeper 摘要式身份验证 - 安全替代方案?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18963302/