我试图使用SaslSsl 6连接卡夫卡。我没有托管服务器,以下是提供的连接详细信息:
ssl.truststore.location=truststore.jks
ssl.truststore.password=xx
ssl.keystore.location=keystore.jks
ssl.keystore.password=xx
ssl.key.password=xx
security.protocol=SASL_SSL
sasl.mechanism=PLAIN
sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required \
username="user" \
password="xx;不幸的是,.NET中不支持JKS文件,我收到了转换后的PEM文件。(truststore.pem和keystore.pem) Truststores在.NET中也不受支持,因此我们需要使用PEM文件作为证书。
你知道在我的情况下我必须使用什么确切的设置吗?这样我就可以用相应的密码定义证书了。
ConsumerConfig config = new ConsumerConfig
{
Debug = "broker,topic,msg,security",
BootstrapServers = "xx",
GroupId = "xx",
AutoOffsetReset = AutoOffsetReset.Earliest,
EnableAutoCommit = false,
SslCaLocation = "truststore.pem",
SslCertificateLocation = "keystore.pem",
SecurityProtocol = SecurityProtocol.SaslSsl,
SaslMechanism = SaslMechanism.Plain,
SaslUsername = "user",
SaslPassword = "xx"
};我所犯的错误:
Certificate verify failed: broker certificate could not be verified, verify that ssl.ca.location is correctly configured or root CA certificates are installed发布于 2022-06-11 02:41:55
为什么同时使用证书和用户名/密码?检查代理的身份验证机制是什么。
对于我的情况,我在代理中使用基本身份验证。所以我只需要使用用户名和密码。
var config = new ConsumerConfig
{
BootstrapServers = "my broker urls",
GroupId = groupName,
AutoOffsetReset = AutoOffsetReset.Latest,
SecurityProtocol = SecurityProtocol.SaslSsl,
SaslMechanism = SaslMechanism.ScramSha512,
SaslUsername = "myusername",
SaslPassword = "mypassword",
EnableAutoCommit = false
};https://stackoverflow.com/questions/72576337
复制相似问题