Cassandra TLS Troubleshooting
This section covers common TLS configuration issues and their resolution.
Diagnostic Tools
Section titled “Diagnostic Tools”OpenSSL Commands
Section titled “OpenSSL Commands”# Test TLS connectionopenssl s_client -connect cassandra-node:9042 -tls1_2
# Show server certificateopenssl s_client -connect cassandra-node:9042 2>/dev/null | \ openssl x509 -noout -text
# Test specific cipher suiteopenssl s_client -connect cassandra-node:9042 \ -cipher ECDHE-RSA-AES256-GCM-SHA384
# Verify certificate chainopenssl verify -CAfile ca-chain.pem server-cert.pem
# Check certificate expirationopenssl x509 -in cert.pem -noout -dates
# View certificate SANsopenssl x509 -in cert.pem -noout -ext subjectAltNameKeytool Commands
Section titled “Keytool Commands”# List keystore contentskeytool -list -v -keystore keystore.jks -storepass changeit
# Check specific aliaskeytool -list -v -keystore keystore.jks -storepass changeit -alias node1
# Export certificate from keystorekeytool -exportcert -keystore keystore.jks -storepass changeit \ -alias node1 -file exported-cert.pem -rfc
# Verify keystore passwordkeytool -list -keystore keystore.jks -storepass wrongpasswordCassandra Logs
Section titled “Cassandra Logs”Check logs for TLS-related errors:
# Grep for SSL/TLS errorsgrep -i "ssl\|tls\|certificate\|keystore\|truststore" /var/log/cassandra/system.log
# Recent errorstail -1000 /var/log/cassandra/system.log | grep -i "error\|exception"Common Errors
Section titled “Common Errors”Keystore/Truststore Not Found
Section titled “Keystore/Truststore Not Found”Error:
java.io.FileNotFoundException: /etc/cassandra/certs/keystore.jks (No such file or directory)Causes:
- Incorrect file path in cassandra.yaml
- File does not exist
- Cassandra user lacks read permission
Resolution:
# Verify file existsls -la /etc/cassandra/certs/keystore.jks
# Check permissionsstat /etc/cassandra/certs/keystore.jks
# Fix permissionschown cassandra:cassandra /etc/cassandra/certs/keystore.jkschmod 400 /etc/cassandra/certs/keystore.jksIncorrect Keystore Password
Section titled “Incorrect Keystore Password”Error:
java.io.IOException: Keystore was tampered with, or password was incorrectCauses:
- Wrong password in cassandra.yaml
- Keystore corrupted
- Wrong keystore type specified
Resolution:
# Test passwordkeytool -list -keystore keystore.jks -storepass your_password
# If password is correct but error persists, check keystore typekeytool -list -keystore keystore.jks -storetype PKCS12 -storepass your_passwordCertificate Chain Validation Failed
Section titled “Certificate Chain Validation Failed”Error:
sun.security.validator.ValidatorException: PKIX path building failedsun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested targetCauses:
- CA certificate missing from truststore
- Intermediate CA certificate missing
- Certificate chain incomplete
Resolution:
# Verify certificate chainopenssl verify -CAfile ca-chain.pem server-cert.pem
# Check truststore contains CAkeytool -list -keystore truststore.jks -storepass changeit
# Add missing CA certificatekeytool -import -file ca-cert.pem -keystore truststore.jks \ -storepass changeit -alias ca -noprompt
# If intermediate CA is missing, add it tookeytool -import -file intermediate-ca.pem -keystore truststore.jks \ -storepass changeit -alias intermediate-ca -nopromptCertificate Expired
Section titled “Certificate Expired”Error:
javax.net.ssl.SSLHandshakeException: PKIX path validation failed: java.security.cert.CertPathValidatorException: validity check failedCauses:
- Server certificate expired
- CA certificate expired
Resolution:
# Check certificate expirationopenssl x509 -in cert.pem -noout -dates
# Check all certificates in chainopenssl x509 -in server-cert.pem -noout -datesopenssl x509 -in intermediate-ca.pem -noout -datesopenssl x509 -in root-ca.pem -noout -dates
# Generate and deploy new certificatesHostname Verification Failed
Section titled “Hostname Verification Failed”Error:
javax.net.ssl.SSLPeerUnverifiedException: Hostname cassandra-node-1 not verifiedjava.security.cert.CertificateException: No subject alternative names matching IP address 10.0.1.1 foundCauses:
- Certificate CN/SAN does not match connection hostname
- Connecting via IP but certificate only has DNS names
- Connecting via hostname not in SAN list
Resolution:
# Check certificate SANsopenssl x509 -in cert.pem -noout -ext subjectAltName
# Check what hostname is being usednslookup 10.0.1.1
# Options:# 1. Regenerate certificate with correct SANs# 2. Connect using hostname that matches certificate# 3. Disable hostname verification (not recommended for production)Regenerate certificate with IP SAN:
# In san.cnf[alt_names]DNS.1 = cassandra-node-1DNS.2 = cassandra-node-1.example.comIP.1 = 10.0.1.1IP.2 = 192.168.1.1No Cipher Suites in Common
Section titled “No Cipher Suites in Common”Error:
javax.net.ssl.SSLHandshakeException: no cipher suites in commonCauses:
- Server and client have incompatible cipher suites
- TLS version mismatch
- Weak ciphers disabled on one side
Resolution:
# Check server's supported ciphersnmap --script ssl-enum-ciphers -p 9042 cassandra-node
# Check client's available ciphersopenssl ciphers -v
# Update cassandra.yaml to include compatible ciphers# Or update client configurationExample fix in cassandra.yaml:
server_encryption_options: cipher_suites: - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 - TLS_RSA_WITH_AES_256_GCM_SHA384 # Fallback if neededProtocol Version Mismatch
Section titled “Protocol Version Mismatch”Error:
javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)Causes:
- Client requires TLS 1.3 but server only supports TLS 1.2
- Server requires TLS 1.2 but client only supports TLS 1.0
Resolution:
# Test supported protocolsopenssl s_client -connect cassandra-node:9042 -tls1_2openssl s_client -connect cassandra-node:9042 -tls1_3
# Update cassandra.yamlserver_encryption_options: accepted_protocols: - TLSv1.2 - TLSv1.3Private Key Does Not Match Certificate
Section titled “Private Key Does Not Match Certificate”Error:
java.security.UnrecoverableKeyException: Cannot recover keyCauses:
- Private key in keystore does not match certificate
- Keystore corrupted during creation
Resolution:
# Verify key matches certificateopenssl x509 -noout -modulus -in cert.pem | openssl md5openssl rsa -noout -modulus -in key.pem | openssl md5# Both should output identical hashes
# Recreate keystore with matching key and certificateopenssl pkcs12 -export \ -in cert.pem \ -inkey key.pem \ -out keystore.p12 \ -name alias \ -password pass:changeitInternode Connection Failures
Section titled “Internode Connection Failures”Error in logs:
ERROR [MessagingService-Outgoing] OutboundConnection.java: Failed to connectjavax.net.ssl.SSLHandshakeException: Received fatal alert: certificate_unknownCauses:
- Peer node’s certificate not trusted
- Truststore missing CA certificate
- Certificate CN/SAN mismatch
Resolution:
# Test internode connectionopenssl s_client -connect other-node:7000 -CAfile truststore.pem
# Verify both nodes have same truststoremd5sum /etc/cassandra/certs/truststore.jks # Run on both nodes
# Check certificate is signed by trusted CAopenssl verify -CAfile ca-chain.pem peer-cert.pemClient Connection Failures
Section titled “Client Connection Failures”cqlsh Error:
Connection error: ('Unable to connect to any servers', {'cassandra-node': error(...)})Resolution:
# Test with OpenSSL firstopenssl s_client -connect cassandra-node:9042 -CAfile ca-cert.pem
# Check cqlshrc configurationcat ~/.cassandra/cqlshrc
# Try with explicit certificatecqlsh --ssl --ssl-certfile=/path/to/ca-cert.pem cassandra-nodeNode Startup Failures
Section titled “Node Startup Failures”Node Fails to Start After Enabling TLS
Section titled “Node Fails to Start After Enabling TLS”Diagnostic Steps:
- Check logs for specific error:
tail -100 /var/log/cassandra/system.log- Verify keystore/truststore accessible:
sudo -u cassandra cat /etc/cassandra/certs/keystore.jks > /dev/null- Test keystore password:
keytool -list -keystore /etc/cassandra/certs/keystore.jks -storepass $(grep keystore_password cassandra.yaml | awk '{print $2}')- Validate configuration syntax:
python3 -c "import yaml; yaml.safe_load(open('/etc/cassandra/cassandra.yaml'))"Rolling Back
Section titled “Rolling Back”If TLS configuration prevents cluster operation:
# Temporarily disable encryptionsed -i 's/internode_encryption: all/internode_encryption: none/' /etc/cassandra/cassandra.yamlsed -i 's/enabled: true/enabled: false/' /etc/cassandra/cassandra.yaml
# Restart nodesystemctl restart cassandra
# Fix certificates, then re-enablePerformance Issues
Section titled “Performance Issues”High CPU Usage
Section titled “High CPU Usage”TLS adds CPU overhead. If experiencing performance degradation:
# Check if AES-NI is availablegrep aes /proc/cpuinfo
# Use AES-GCM ciphers (hardware accelerated)cipher_suites: - TLS_AES_256_GCM_SHA384 - TLS_AES_128_GCM_SHA256Connection Latency
Section titled “Connection Latency”TLS handshake adds latency. Mitigations:
- Enable TLS session resumption
- Use TLS 1.3 (faster handshake)
- Monitor handshake times
Debug Logging
Section titled “Debug Logging”Enable SSL Debug Output
Section titled “Enable SSL Debug Output”Add to jvm.options:
# Full SSL debug (verbose)-Djavax.net.debug=ssl
# Handshake only-Djavax.net.debug=ssl:handshake
# Certificate chain-Djavax.net.debug=ssl:trustmanagerWarning: SSL debug output is extremely verbose. Enable temporarily for troubleshooting only.
Interpret Debug Output
Section titled “Interpret Debug Output”Key messages to look for:
# Successful handshake"ServerHello" with cipher suite"Certificate chain" showing peer's certificates"Finished" indicating successful handshake
# Failures"alert: fatal" indicates handshake failure"certificate_unknown" means cert not trusted"handshake_failure" general failureRelated Documentation
Section titled “Related Documentation”- Encryption Overview - Why encryption is essential
- Certificate Types - Certificate generation
- Cassandra Configuration - Server configuration
- Enterprise Recommendations - Best practices