Redis 6.0新特性----TLS 通道加密
Redis 6實(shí)現了通道加密,提高了redis的安全性。Redis作為緩存數據庫,里面很有可能緩存重要的敏感信息,所以支持tls通道加密還是很有必要的,當然敏感信息還是建議加密保存。
創(chuàng )建證書(shū)
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
生成的證書(shū)如下圖所示:
編譯redis
使用下面命令編譯redis:
make BUILD_TLS=yes -j8
編譯結果如下:
啟動(dòng)服務(wù)端
使用下面命令啟動(dòng)redis服務(wù):
./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
結果如下:
客戶(hù)端鏈接
使用客戶(hù)端鏈接redis服務(wù):
./src/redis-cli --tls \
--cert ./tests/tls/redis.crt \
--key ./tests/tls/redis.key \
--cacert ./tests/tls/ca.crt
結果如下:
也可以使用下面命令:
./src/redis-cli --tls --insecure
結果如下:
??
??
mark
靜態(tài)的可以用cdn的
??
學(xué)習了
學(xué)習了
想給博客套個(gè)緩存,奈何是靜態(tài)站!
技術(shù)文章,學(xué)習了。
80% WordPress/Typecho,都是在講開(kāi)發(fā)