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

- **ID:** `kafka/sasl-authentication-failure`
- **领域:** kafka
- **类别:** auth_error
- **验证级别:** ai_generated
- **修复率:** 88%

## 根因

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

## 解决方案

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. ```
   检查代理日志以查找认证失败，确定确切的凭证不匹配。
   ```

## 无效尝试

- **** — Re-adding the same credentials in JAAS file without verifying against the broker's credential store will fail. (90% 失败率)
- **** — Disabling SASL entirely removes security, which is not acceptable in production. (95% 失败率)
