2881099 / csredis

.NET Core or .NET Framework 4.0+ client for Redis and Redis Sentinel (2.8) and Cluster. Includes both synchronous and asynchronous clients.
MIT License
2.01k stars 414 forks source link

Redis服務使用utils/gen-test-certs.sh生成证书並啟用了TLS,new CSRedisClient(ssl=true) 后获取Key值报错 #427

Open hkszlq opened 2 years ago

hkszlq commented 2 years ago

请问CSRedis有无接口示例代码或者如何配置证书?

Code: var csredis = new CSRedisClient("192.168.8.111:6379,ssl=true"); RedisHelper.Initialization(csredis); Console.WriteLine(csredis.Get("name")); Exception error: 3)System.Exception:“【192.168.8.111:6379/0】状态不可用,等待后台检查程序恢复方可使用。One or more errors occurred. (Authentication failed because the remote party sent a ### TLS alert: 'HandshakeFailure'.)” 2)AuthenticationException: Authentication failed because the remote party sent a TLS alert: 'HandshakeFailure'. 1)Win32Exception: 接收到的消息异常,或格式不正确。

hkszlq commented 2 years ago

Redis.config TLS: tls-cert-file /etc/redis/ssl/redis.crt tls-key-file /etc/redis/ssl/redis.key tls-ca-cert-file /etc/redis/ssl/ca.crt tls-dh-params-file /etc/redis/ssl/redis.dh tls-auth-clients yes tls-replication yes

Redis login: redis-cli --tls --cert /etc/redis/ssl/redis.crt --key /etc/redis/ssl/redis.key --cacert /etc/redis/ssl/ca.crt -p 6379 127.0.0.1:6379> get "name" "namevalue"

tangehan commented 2 years ago

这个问题解决了吗,大哥,我在并发下源码也抛出了 状态不可用,等待后台检查程序恢复方可使用。One or more errors occurred.

hkszlq commented 2 years ago

检查程序恢复方可使用

沒有呢,按Redis官方的.sh生成的自簽名證書默認是雙向驗證的,貌似當前CSRedis版本並沒有相關的證書設置API