kafka 配置SASL验证
做一个推送kafka服务,需要支持kafka免密和SASL验证
记录一下关于kafka 配置SASL 验证的步骤
以PLAIN 为例关于SASL/PLAIN
PLAIN配置步骤
Brokers
KafkaClient { org.apache.kafka.common.security.plain.PlainLoginModule required username="admin" password="test"; user_admin ="test" user_test ="test" }; Client { org.apache.zookeeper.server.auth.DigestLoginModule required username="admin" password="test"; };
# List of enabled mechanisms, can be more than one sasl.enabled.mechanisms=PLAIN # Specify one of of the SASL mechanisms sasl.mechanism.inter.broker.protocol=PLAIN# Configure SASL_SSL if SSL encryption is enabled, otherwise configure SASL_PLAINTEXT security.inter.broker.protocol=SASL_SSL
# With SSL encryption listeners=SASL_SSL://kafka1:9092 advertised.listeners=SASL_SSL://localhost:9092 # Without SSL encryption listeners=SASL_PLAINTEXT://kafka1:9092 advertised.listeners=SASL_PLAINTEXT://localhost:9092# With SSL encryption listeners=PLAINTEXT://kafka1:9092,SASL_SSL://kafka1:9093 advertised.listeners=PLAINTEXT://localhost:9092,SASL_SSL://localhost:9093 # Without SSL encryption listeners=PLAINTEXT://kafka1:9092,SASL_PLAINTEXT://kafka1:9093 advertised.listeners=PLAINTEXT://localhost:9092,SASL_PLAINTEXT://localhost:9093# With SSL encryption listener.name.sasl_ssl.plain.sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required \ username="admin" \ password="admin-secret" \ user_admin="admin-secret" \ user_kafkabroker1="kafkabroker1-secret"; # Without SSL encryption listener.name.sasl_plaintext.plain.sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required \ username="admin" \ password="admin-secret" \ user_admin="admin-secret" \ user_kafkabroker1="kafkabroker1-secret";
写在最后
Last updated