在Debian下对Redis进行安全设置,可以遵循以下步骤:
首先,通过以下命令在Debian系统上安装Redis:
sudo apt update
sudo apt install redis-server -y
redis.conf
)放置在非系统默认目录,如/usr/local/redis/etc/
。redis.conf
文件:rename-command FLUSHDB ""
rename-command FLUSHALL ""
rename-command CONFIG ""
rename-command SHUTDOWN SHUTDOWN_MYREDIS
bind 192.168.1.100 127.0.0.1
sudo ufw allow from 192.168.1.0/24 to any port 6379
requirepass "sTr0ngP@ssw0rd!2023"
protected-mode yes
redis.conf
文件,修改port
字段的值为你想要的新端口号,然后重启Redis服务。openssl genrsa -out redis.key 2048
openssl req -x509 -new -key redis.key -days 365 -out redis.crt
redis.conf
:tls-port 6380
tls-cert-file /path/redis.crt
tls-key-file /path/redis.key
tls-ca-cert-file /path/ca.crt
tls-auth-clients optional
appendfsync
选项。遵循以上步骤,可以显著提升Debian下Redis的安全性。但请注意,安全是一个持续的过程,需要定期审查和更新安全策略。