Redis TLS client certificate hostname verification configuration missing
0 reputation · 26 Jun 2022, 09:37 UTC
0 reputation · 26 Jun 2022, 09:37 UTC
Administrators want Redis to reject TLS connections when the client certificate does not match the hostname used to reach the server, ensuring that a certificate issued for one service cannot be reused for another.
Currently, with tls-auth-clients set to yes, Redis validates the certificate chain and expiration but relies on the underlying OpenSSL library to perform only basic validity checks; it does not compare the presented certificate’s SAN or CN against the server‑address hostname, leaving a configurable gap in multi‑tenant environments. The documentation notes that hostname verification is left to the client side, and there is an open discussion about adding a tls-verify-hostname option, but no definitive resolution has been merged in the latest stable release.
Should Redis introduce a tls-verify-hostname directive to enforce hostname checking? What impact would enabling this check by default have on existing deployments that rely on client‑side verification? How can operators mitigate the risk until a server‑side option is available?
34275 reputation · 26 Jun 2022, 15:43 UTC
Redis currently does not offer a server‑side hostname verification flag. The tls-auth-clients setting only checks that the presented client certificate is signed by a trusted CA and that it is not expired. It deliberately leaves hostname matching to the client, as documented in the 7.2 release notes.
Adding a tls-verify-hostname option would provide the desired safety for multi‑tenant setups, but it would also be a breaking change for many existing deployments that rely on client‑side checks or that connect to Redis using a hostname that does not match the certificate’s SAN. In practice, this means a lot of real‑world clusters would experience connection failures immediately after the option is enabled.
Until a stable, backwards‑compatible server‑side feature is merged, operators should:
tls-auth-clients=yes is enabled and that no tls-verify-hostname directive is present.openssl s_client -connect redis.example.com:6379 \
-cert client.crt -key client.key \
-servername redis.example.com
When the hostname in -servername does not match the certificate, the connection should fail with a verification error.
The Redis core team has explicitly stated that hostname verification is a client responsibility. The current tls-auth-clients implementation uses OpenSSL’s SSL_VERIFY_PEER flag, which validates chain and expiry but not hostnames. Adding a new flag would require a careful compatibility review and a clear deprecation path, which has not yet been agreed upon.
Deployments that:
will experience connection failures if a server‑side check is enabled by default. The change would also introduce duplicate verification logic for those that already perform it client‑side, potentially adding latency.
openssl s_client as shown above.frontend redis_front
bind *:6379 ssl crt /etc/haproxy/redis.pem verify required
mode tcp
default_backend redis_back
backend redis_back
mode tcp
server redis1 127.0.0.1:6380 check
redis.example.com and only allow that hostname in connection strings.Operators should:
tls-verify-hostname directive is introduced in a future Redis release.Until such a directive lands, the safest path is to enforce hostname checks on the client side or via an external TLS terminator.
Use comments to ask for clarification. Post a solution as an answer.
34,275 reputation · 26 Jun 2022, 10:53 UTC
Redis cannot verify a client certificate’s hostname because the server only sees the SNI name the client sends, which is not tied to the certificate and can be spoofed. The tls-auth-clients flag validates the chain and expiry but leaves hostname matching to the client. A server‑side tls-verify-hostname option would therefore not solve the intended multi‑tenant isolation; instead, operators should issue a distinct intermediate CA (or separate certificate) per service and rely on tls-auth-clients=yes to reject cross‑tenant certificates, or map certificate subjects to ACL users for finer control.