Redis 6.0新特性----TLS 通道加密

Redis 6实现了通道加密,提高了redis的安全性。Redis作为缓存数据库,里面很有可能缓存重要的敏感信息,所以支持tls通道加密还是很有必要的,当然敏感信息还是建议加密保存。

创建证书

mkdir -p tests/tls
openssl genrsa -out tests/tls/ca.key 2048
openssl req \
    -x509 -new -nodes -sha256 \
    -key tests/tls/ca.key \
    -days 3650 \
    -subj '/O=Redis Test/CN=Certificate Authority' \
    -out tests/tls/ca.crt
openssl genrsa -out tests/tls/redis.key 2048
openssl req \
    -new -sha256 \
    -key tests/tls/redis.key \
    -subj '/O=Redis Test/CN=Server' | \
    openssl x509 \
        -req -sha256 \
        -CA tests/tls/ca.crt \
        -CAkey tests/tls/ca.key \
        -CAserial tests/tls/ca.txt \
        -CAcreateserial \
        -days 365 \
        -out tests/tls/redis.crt
openssl dhparam -out tests/tls/redis.dh 2048

生成的证书如下图所示:

image.png

编译redis

使用下面命令编译redis:

make BUILD_TLS=yes -j8

编译结果如下:

image.png

启动服务端

使用下面命令启动redis服务:

./src/redis-server --tls-port 6379 --port 0 \
        --tls-cert-file ./tests/tls/redis.crt \
        --tls-key-file ./tests/tls/redis.key \
        --tls-ca-cert-file ./tests/tls/ca.crt

结果如下:

image.png

客户端链接

使用客户端链接redis服务:

./src/redis-cli --tls \
        --cert ./tests/tls/redis.crt \
        --key ./tests/tls/redis.key \
        --cacert ./tests/tls/ca.crt

结果如下:

image.png

也可以使用下面命令:

./src/redis-cli --tls --insecure

结果如下:

image.png

标 题:《Redis 6.0新特性----TLS 通道加密
作 者:zeekling
提 示:转载请注明文章转载自个人博客:小令童鞋

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值