Redis TLS client certificate rejected: which identity field does tls-auth-clients actually match?
0 reputation · 22 Jun 2025, 09:49 UTC
0 reputation · 22 Jun 2025, 09:49 UTC
I'm configuring mutual TLS on Redis 6.2+ using the documented directives: tls-port, tls-cert-file, tls-key-file, tls-ca-cert-file, and tls-auth-clients yes. The goal is to have the server reject client certificates whose identity does not match the connecting peer.
The uncertainty is the exact matching rule. The documentation does not clearly state whether Redis compares the client certificate's Common Name, its Subject Alternative Name, or both, nor whether the comparison is against the peer's IP address, a reverse-DNS result, or an expected hostname. This matters because behavior may also differ between OpenSSL-linked and wolfSSL-linked builds, and between Redis 6.2 and 7.x.
Before troubleshooting any handshake failure, I plan to rule out the obvious causes: an untrusted or self-signed CA not present in tls-ca-cert-file, and expired certificates. I can verify the baseline with openssl s_client and the Redis log.
Specifically:
tls-auth-clients yes is set, which certificate field (CN or SAN) does Redis use for client identity checks, and against what value is it compared?31775 reputation · 22 Jun 2025, 16:55 UTC
When tls-auth-clients yes is enabled, Redis does not perform identity matching against the Common Name (CN), Subject Alternative Name (SAN), IP address, or hostname. It only verifies that the client certificate is cryptographically valid and signed by the CA specified in tls-ca-cert-file.
In other words, tls-auth-clients is a requirement for authentication (proving the client is trusted by your CA), not authorization (verifying the client is a specific identity).
tls-auth-clients directive simply toggles the SSL_VERIFY_PEER (or equivalent) flag in the TLS library.Users often expect mTLS to act as a firewall or identity-based access control list. However, in Redis, the TLS layer handles the encrypted tunnel and trust, while the ACL (Access Control List) system handles identity and permissions. Redis does not automatically map a certificate's CN to a specific Redis ACL user.
To confirm your configuration is working as intended (rejecting untrusted clients), use these scoped commands:
openssl s_client -connect your-redis-host:port -cert client.crt -key client.key -CAfile ca.crt
Attempt to connect using a certificate signed by a different, unrelated CA. The connection should be terminated during the handshake.
Monitor the Redis log file. A rejected certificate will typically trigger a TLS handshake failed error, though the logs will not specify which field (CN/SAN) caused the failure, as no field matching is performed.
If you require the server to reject certificates based on a specific identity (e.g., only allowing client-01.example.com), please specify if you are using a TLS-terminating proxy (like HAProxy or Nginx) in front of Redis. If so, the identity matching must be configured at the proxy level via ssl-verify-client and header forwarding.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.