使用zkCli.cmd对Zookeeper进行ACL控制

4月 12, 2016 |

zkCli提供如下操作ACL的方法
create [-s] [-e] path data acl
创建节点时设置权限

setAcl path acl
对已经存在的节点设置权限

getAcl path
查询已有节点的权限

addauth scheme auth
对当前连接添加凭证

使用zkCli时,ACL的格式为schema:certificate:privileges
采用ip认证,那么ACL就为ip:192.168.1.110:cdwra
cdwra分别表示create, delete,write,read, admin
遗憾的是,zookeeper-3.4.6版本是不支持ip:192.168.1.0/24:cdwra这种子网模式的

采用digest认证,那么ACL为digest:root:qiTlqPLK7XM2ht3HMn02qRpkKIE=:cdwra
遗憾的是,这个地方需要经过编码的密码 ,可是使用org.apache.zookeeper.server.auth.DigestAuthenticationProvider的main方法产生。

添加认证信息时,IP认证对客户端是透明的,digest认证,执行addauth digest username:password 对当前的session添加凭证

Posted in: Zookeeper

Comments are closed.