首页 > 技术文章 > Redis 安全配置

xzlive 2018-08-21 11:30 原文

1.禁止一些高危命令

修改 redis.conf 文件,添加

rename-command FLUSHALL ""
rename-command FLUSHDB  ""
rename-command CONFIG   ""
rename-command KEYS     ""

来禁用远程修改 DB 文件地址

2.以低权限运行 Redis 服务

为 Redis 服务创建单独的用户和家目录,并且配置禁止登陆

3.为 Redis 添加密码验证

修改 redis.conf 文件,添加

requirepass mypassword

redis 登录时需要指明密码
redis-cli -a mypassword

4.禁止外网访问 Redis

修改 redis.conf 文件,添加或修改

bind 127.0.0.1

使得 Redis 服务只在当前主机可用

推荐阅读