美文网首页
redis.conf详解之tls-protocols

redis.conf详解之tls-protocols

作者: 小易哥学呀学 | 来源:发表于2021-12-04 20:54 被阅读0次

用法

tls-protocols  "TLSv1.2 TLSv1.3"

 

用途

tls-protocols 设置服务端支持的TLS协议版本。

注意事项:

1.默认仅支持 TLSv1.2TLSv1.3
2.多个版本用空格隔开。
3.clientserver协议版本不匹配将无法建立连接。

配置用例(本例中客户端与服务端共用一套CA证书)

redis服务端仅支持TLS1.3

tls-port 6379
tls-cert-file /Users/server.pem
tls-key-file /Users/server.key
tls-protocols "TLSv1.3"
tls-auth-clients optional

redis客户端仅支持TLS1.1

func main() {
    ctx := context.Background()

    pool := x509.NewCertPool()
    caCert, err := ioutil.ReadFile("/Users/rootCA.pem")
    if err != nil {
        fmt.Println(err)
        return
    }

    pool.AppendCertsFromPEM(caCert)

    rdb := redis.NewClient(&redis.Options{
        Addr: ":6379",
        TLSConfig: &tls.Config{
            MinVersion:         tls.VersionTLS11, // 客户端支持的最小版本
            MaxVersion:         tls.VersionTLS11, // 客户端支持的最大版本
            ClientCAs:          pool,
            InsecureSkipVerify: true,
        },
    })
    _ = rdb.Get(ctx, "stringKey")
}

报错如下

remote error: tls: protocol version not supported

 

原生注释

# By default, only TLSv1.2 and TLSv1.3 are enabled and it is highly recommended
# that older formally deprecated versions are kept disabled to reduce the attack surface.
# You can explicitly specify TLS versions to support.
# Allowed values are case insensitive and include "TLSv1", "TLSv1.1", "TLSv1.2",
# "TLSv1.3" (OpenSSL >= 1.1.1) or any combination.
# To enable only TLSv1.2 and TLSv1.3, use:
#
# tls-protocols "TLSv1.2 TLSv1.3"

 

redis.conf详解目录

redis.conf详解总纲
欢迎加v交流:maxwangnan005

相关文章

  • redis.conf详解之tls-protocols

    用法 用途 tls-protocols 设置服务端支持的TLS协议版本。 注意事项: 1.默认仅支持 TLSv1....

  • redis.conf详解之include

    1、用法: 在 $yourPath/redis.conf 文件中添加以下配置 2、用途: 模块化配置,比如所有服务...

  • redis.conf详解之module

    1、用法: 在 $yourPath/redis.conf 文件中添加以下配置 2、module制作: 准备工作 1...

  • redis.conf详解之timeout

    用法 单位是秒 用途 在timeout时间内如果没有数据交互,redis侧将关闭连接。没有数据交互:redis客户...

  • redis.conf详解之port

    用法 用途 指定redis监听的端口。 注意事项: 1.默认是63792.配置为0时将不监听任何端口(也就是服务没...

  • redis.conf详解之bind

    用法 绑定到本机的其中一个ip 绑定到本机的两个ip,如果10.0.0.1无效redis依旧可以启动。 绑定到本机...

  • redis.conf详解之daemonize

    用法 作为非守护进程运行 作为守护进程运行 注意事项: 默认情况下,Redis不作为守护进程运行。如果以守护进程运...

  • redis.conf详解之pidfile

    用法 注意事项: 如果pidfile文件创建失败,也不会影响redis启动。配置了daemonize或pidfil...

  • redis.conf详解之maxclients

    本文基于 redis_version:6.2.5 用法 设置一个redis实例支持的最大连接数。 注意事项: 默认...

  • Redis.conf 详解

    Redis.conf 详解 参考地址:https://www.cnblogs.com/zhang-ke/p/598...

网友评论

      本文标题:redis.conf详解之tls-protocols

      本文链接:https://www.haomeiwen.com/subject/kasdxrtx.html