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

redis.conf详解之tls-auth-clients

作者: 小易哥学呀学 | 来源:发表于2021-11-28 21:39 被阅读0次

用法

redis建立TLS连接时默认是双向验证
开启该配置项,可控制是否验证客户端证书。

tls-auth-clients no
tls-auth-clients optional

用途

tls-auth-clients用于控制是否验证客户端证书。

注意事项:

1.默认是验证客户端证书的。
2.tls-auth-clients设置为no时,服务端将不会验证客户端证书,哪怕客户端传了证书也不去验证。
3.tls-auth-clients设置为optional时,客户端证书是可选的,如果客户端传了证书,必须保证证书的有效性,否则建连失败。
4.tls-auth-clients设置为optional时,tls-ca-cert-file或者tls-ca-cert-dir二者必须配置其一(用于验证客户端传来的证书),否则redis无法启动。

配置用例

未配置CA证书的情况:

tls-port 6379
tls-cert-file /Users/server.pem
tls-key-file /Users/server.key
#tls-ca-cert-file /Users/rootCA.pem
#tls-ca-cert-dir /etc/ssl/certs
tls-auth-clients optional

启动报错

$ /usr/bin/redis-server redis.conf
Either tls-ca-cert-file or tls-ca-cert-dir must be specified when tls-cluster, tls-replication or tls-auth-clients are enabled!

不验证客户端证书的配置方式

tls-port 6379
tls-cert-file /Users/server.pem
tls-key-file /Users/server.key
#tls-ca-cert-file /Users/rootCA.pem
#tls-ca-cert-dir /etc/ssl/certs
tls-auth-clients no

客户端可以不传自己的证书,只传CA证书(用于验证服务端)。

$ redis-cli --tls --cacert /Users/rootCA.pem
127.0.0.1:6379> set a 1
OK
127.0.0.1:6379>

客户端证书可选的配置方式

tls-port 6379
tls-cert-file /Users/server.pem
tls-key-file /Users/server.key
tls-ca-cert-file /Users/rootCA.pem
tls-auth-clients optional

客户端证书可以不传,可以建立连接。

$ redis-cli --tls --cacert /Users/rootCA.pem
127.0.0.1:6379> set a 1
OK

客户端证书也可以传,可以建立连接。

$ redis-cli --tls --cacert /Users/rootCA.pem --cert /Users/server.pem --key /Users/server.key
127.0.0.1:6379> set a 1
OK

客户端证书也可以传,但是传的是错误的,不可以建立连接。

$ redis-cli --tls --cacert /Users/rootCA.pem --cert /Users/server.pem --key /Users/none.key
Could not negotiate a TLS connection: Invalid private key
not connected>

 

原生注释

# By default, clients (including replica servers) on a TLS port are required
# to authenticate using valid client side certificates.
#
# If "no" is specified, client certificates are not required and not accepted.
# If "optional" is specified, client certificates are accepted and must be
# valid if provided, but are not required.
#
#tls-auth-clients no
#tls-auth-clients optional

 

redis.conf详解目录

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

相关文章

  • redis.conf详解之tls-auth-clients

    用法 redis建立TLS连接时默认是双向验证开启该配置项,可控制是否验证客户端证书。 用途 tls-auth-c...

  • 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-auth-clients

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