Distinguish explicit and inferred TLS host names useful when cluster shards exposed using TLS/SNI - #3250
Conversation
Signed-off-by: Sandeep Kunusoth <sandeepkunsoth000@gmail.com>
Signed-off-by: Sandeep Kunusoth <sandeepkunsoth000@gmail.com>
Signed-off-by: Sandeep Kunusoth <sandeepkunsoth000@gmail.com>
|
I'm concerned that as written this is a break to many scenarios - it stops using the sslhost as an override in some DNS scenarios that work today. Question: are you actually specifying the sslhost in your scenario? |
|
I wonder if the real fix here is for the library to never infer sslhost on your behalf, so it only applies if the caller means it, I.e. change this: So:
|
|
Thanks for quick reply.
No, in our case we are not explicitly setting SslHost. It is being inferred from the single seed endpoint via:
I agree your suggested direction is safer and preserves the existing override behavior: explicit SslHost always wins That should solve our single-dns cluster case without changing behavior for callers that intentionally set SslHost. I can update the PR in that direction and adjust the tests accordingly. |
Signed-off-by: Sandeep Kunusoth <sandeepkunsoth000@gmail.com>
Signed-off-by: Sandeep Kunusoth <sandeepkunsoth000@gmail.com>
I was about to do that from this side ;p Yes, there's some annoying flakes, but if you let me deal with that: I can do it more granularly Changes look good, thanks |
please feel freee to update anything if u want. |
Only consulted for non-DnsEndPoint connections now that SslHost resolution no longer infers a host for endpoints that already carry their own.
|
Hi @mgravell, thanks for merging this! Could you let me know approximately when the next version containing this fix is expected to be released? Also, is there a way to use a build/tag from main in a .NET project in the meantime, so we can start using and testing the fix before the official release? |
|
I don't object to doing a build for it, which would be 3.3.1 - however, GitHub is failing to load /releases for me, which makes that hard |
Fixes TLS SNI selection for hostname-routed clusters from a single DNS endpoint.
For clusters behind a shared load balancer that routes by SNI, every discovered node consequently reused the initial endpoint’s SNI name and could be routed to the wrong backend.
this change distinguishes an explicitly configured
SslHostfrom an inferred fallback and applies this precedence:SslHostalways wins.DnsEndPointuses its ownHost.GetSslHostFromEndpoints(EndPoints)value is used.This preserves existing behavior for callers that deliberately configure
SslHost, while allowing each discovered DNS cluster endpoint to present its own SNI name.The resolution logic is centralized and applied consistently to:
LoggingTunnelTlsOptions.ResolveHostConfigurationOptions.SslHostnow reports only an explicitly configured value rather than an inferred one.Related to #2826, specifically:
#2826 (comment)
Testing
Added and updated coverage for:
SslHostoverriding a DNS endpointSslHostTlsOptions.ResolveHostTesting
Validated against a hostname-routed Valkey cluster using a single seed hostname, shared VIP, and per-node SNI routing.
Checklist