赞
踩
通常,我们会给Kafka增加SASL以加强对kafka的安全访问,以满足漏扫对于kafka的访问安全漏扫要求。但漏扫的时候也会同样会对Kafka集群中的zk集群进行扫描。所以zk集群同样涉及到要配置kafka的安全认证。
以此路径/opt/soft/kafka/kafka_2.12-2.5.1/config/zk.jaas为例:
Server {
org.apache.kafka.common.security.plain.PlainLoginModule required
user_super="adminsecret"
user_zkclient="12345678";
};
Client {
org.apache.kafka.common.security.plain.PlainLoginModule required
username="zkclient"
password="12345678";
};
增加以下配置
authProvider.1=org.apache.zookeeper.server.auth.SASLAuthenticationProvider
requireClientAuthScheme=sasl
添加以下内容(# Launch mode上一行添加):
export KAFKA_OPTS="-Djava.security.auth.login.config=/opt/soft/kafka/kafka_2.12-2.5.1/config/zk.jaas"
增加以下配置
zookeeper.client.sasl=true
进入bin目录,执行:
./zookeeper-shell.sh <本机IP>:2181
输入:
setAcl / ip:<希望有权限访问的IP>:cdrwa
使用一台非集群内的zk节点上的zk软件,来模拟入侵。也就说这个节点的ip并没有被设置getAcl
执行zkCli.sh
工具连接Zookeeper:
zkCli.sh -server <想要入侵的zk节点ip>:2181
ls /
Insufficient permission :
出现“Insufficient permission :”表明没有权限访问。
也可以使用内置的zk命令尝试:
zookeeper-shell.sh <想要入侵的zk节点ip>:2181
ls /
Insufficient permission :
```bash
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。