kafka auth_error ai_generated true

SASL认证异常:由于无效凭证导致认证失败

org.apache.kafka.common.errors.SaslAuthenticationException: Authentication failed due to invalid credentials

ID: kafka/sasl-authentication-failure

其他格式: JSON · Markdown 中文 · English
88%修复率
86%置信度
1证据数
2024-04-05首次发现

根因分析

Kafka客户端为SASL/PLAIN或SASL/SCRAM认证提供了错误的用户名或密码。

English

Kafka client provided incorrect username or password for SASL/PLAIN or SASL/SCRAM authentication.

generic

官方文档

https://kafka.apache.org/documentation/#security_sasl

解决方案

  1. 使用正确的凭证更新JAAS配置:sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="user" password="pass";
  2. 在代理上重置SCRAM凭证:kafka-configs.sh --bootstrap-server localhost:9092 --alter --add-config 'SCRAM-SHA-256=[password=newpass]' --entity-type users --entity-name user
  3. 检查代理日志以查找认证失败,确定确切的凭证不匹配。

无效尝试

常见但无效的做法:

  1. 90% 失败

    Re-adding the same credentials in JAAS file without verifying against the broker's credential store will fail.

  2. 95% 失败

    Disabling SASL entirely removes security, which is not acceptable in production.