Skip to content

fix: enable SSL for Redis Cluster nodes when sslEnable is set - #3674

Open
b84330808 wants to merge 1 commit into
alibaba:1.8from
b84330808:fix-redis-cluster-ssl
Open

b84330808 wants to merge 1 commit into
alibaba:1.8from
b84330808:fix-redis-cluster-ssl

Conversation

@b84330808

Copy link
Copy Markdown

Describe what this PR does / why we need it

With a Redis Cluster data source, withSslEnable(true) has no effect: the client connects to the nodes without TLS.

Does this pull request fix one issue?

Fixes #3533

Describe how you did it

getRedisClusterClient() read the SSL flag from each getRedisClusters() entry. Builder.build() creates those entries from host and port only, so their sslEnable is always false. The node URIs now use the data source's flag, like the standalone and Sentinel clients, and like the cluster nodes' timeout and password.

Describe how to verify it

ClusterModeRedisDataSourceSslTest points an SSL-enabled cluster data source at a local socket and checks the first byte sent: * (plain RESP) before the change, 0x16 (TLS ClientHello) after.

Special notes for reviews

None.

getRedisClusterClient() took the SSL flag of each cluster node entry.
Those entries are created by RedisConnectionConfig.Builder.build() from
host and port only, so their sslEnable is always false and the cluster
client connected without TLS even with withSslEnable(true). Use the flag
of the data source config, like the standalone and Sentinel clients and
like the timeout and password of the cluster nodes.

Fixes alibaba#3533
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] 1.8.8 使用redis集群SSL数据源开启SSL失效

1 participant