加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby – 如何在所有Zookeeper连接上强制使用SASL

发布时间:2020-12-17 02:18:22 所属栏目:百科 来源:网络整理
导读:我最近有一个zookeeper build(版本= 3.4.3-1240972,建于02/06/2012 10:48 GMT),并且很难强制SASL用于所有客户端连接. 使用该版本的本地conf /目录,我有以下配置(在Ubuntu 12.04上运行): CONF / zoo.cfg tickTime=2001initLimit=10syncLimit=5dataDir=/tmp/z
我最近有一个zookeeper build(版本= 3.4.3-1240972,建于02/06/2012 10:48 GMT),并且很难强制SASL用于所有客户端连接.

使用该版本的本地conf /目录,我有以下配置(在Ubuntu 12.04上运行):

CONF / zoo.cfg

tickTime=2001
initLimit=10
syncLimit=5
dataDir=/tmp/zookeeper
clientPort=2181
authProvider.1=org.apache.zookeeper.server.auth.SASLAuthenticationProvider

的conf /的Jaas.conf

Server {
    org.apache.zookeeper.server.auth.DigestLoginModule required
    user_super="1adminsecret";
};
Client {
    org.apache.zookeeper.server.auth.DigestLoginModule required
    username="super"
    password="1adminsecret";
};

CONF / java.env

export JVMFLAGS="-Djava.security.auth.login.config=`pwd`/conf/jaas.conf"

当我从zkCli.sh脚本连接时,它将正确验证,并且更改jaas.conf文件将导致它无法查询.这是预期的行为.

但是,当我使用ruby“zookeeper”gem时,运行(使用irb):

require 'zookeeper'
z = Zookeeper.new("localhost:2181")
z.get_children(:path => "/")
z.create(path:'/asdf',data:'test')

它会正确返回结果.如果我要求SASL登录,那么ruby客户端如何绕过安全性.我知道它不仅仅是一个读取与写入问题,因为我也可以创建密钥.

解决方法

在conf / zoo.cfg中,添加行,

requireClientAuthScheme=sasl

从服务器配置部分here,

requireClientAuthScheme=sasl is optional: if it is set to any value,it will only allow non-authenticated clients to ping,create session,close session,or sasl-authenticate.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读