Kafka "Failed authentication due to: SSL handshake failed"
Codemia Knowledge Hub ·
Kafka reports "SSL handshake failed" when the client and broker cannot complete the TLS handshake. The usual causes are an invalid or expired certificate, a misconfigured keystore or truststore, incompatible TLS versions, or no shared cipher suite. Fix the one that applies and the connection goes through.
What happens during the handshake
With SSL configured, the client and broker must complete a handshake before any data is sent. During it they exchange encryption keys, authenticate each other and agree on session security parameters. If any step fails, the connection is terminated and Kafka logs an error such as "SSL handshake failed". (TLS is the successor to SSL; Kafka's settings still use the SSL name.)
Causes and fixes
- Invalid or expired certificates. Certificates prove each party's identity, so an untrusted or expired one fails the handshake. Make sure certificates are valid and trusted by both sides, and check the expiry date and issuer.
- Incompatible protocol versions. If the client and broker are set to SSL or TLS versions that do not overlap, the handshake cannot succeed. Configure both to use compatible TLS versions.
- Incorrect SSL configuration. Wrong keystore or truststore paths, passwords or types break the handshake. Review them on both sides.
- Cipher suite mismatch. If client and broker have no cipher suite in common, the handshake fails. Make sure their enabled suites overlap.
Example: bad_certificate from the broker
A client fails to connect, and the log points to the certificate:
To resolve it:
- Check the certificates used by the client and the broker. Renew or reissue any that are invalid or expired.
- Review the configuration in the broker's
server.propertiesand the client's configuration so every SSL-related setting is correct. - Raise logging for SSL events on both client and broker to get detailed errors.
- Test the connection by hand with
openssl s_client -connect <broker>:<port>for more diagnostic information.
| Issue | Potential Causes | Resolution Steps |
| SSL Handshake Failure | - Expired certificates - Incompatible SSL/TLS versions - Misconfiguration - Cipher mismatch | - Verify and renew certificates - Ensure protocol compatibility - Review configurations - Confirm and adjust cipher suites |
SSL/TLS encrypts traffic between Kafka clients and brokers, which matters most where the cluster handles sensitive data. When a handshake fails, work through certificates, protocol versions, keystore and truststore configuration, and cipher suites, raising SSL logging on both sides until the failing step is clear.
Related reading
- Kafka failed to change state for partition from OnlinePartition to OnlinePartition
- Kafka failed to map 1073741824 bytes for committing reserved memory
- KAFKA Failed to update metadata after 60000 ms
- Kafka Fetch offset is out of range for partition. How to avoid data loss?
- Kafka java consumer SSL handshake Error java.security.cert.CertificateException No subject alternative names present
- Kafka SASL zookeeper authentication
- Kafka FETCH_SESSION_ID_NOT_FOUND often seen in logs
- Kafka Find Controller ID in a cluster using Kraft protocol
System design interview problems on this topic
- Design a Distributed Messaging System: solution and walkthrough
- Design a Log Collection and Analysis System: solution and walkthrough
- Design an Ad Click Aggregation System: solution and walkthrough
- Design a Webhook Notification Service: solution and walkthrough

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseSystem Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.