0x00 Redis配置文件

sudo find / -type f -name 'redis.conf'

我这里的路径在/etc/redis.conf

0x01 禁止root启动Redis

通常情况下通过Redis getshell都是因为redis未设置密码,且可以使用config和save命令,写入dbfilename到/var/spool/cron/或者修改了~/.ssh/authorized_keys

0x02 安全配置

vim /etc/redis.conf

*修改端口号
 port 6379 -> xxx

*修改绑定ip
 bind 0.0.0.0 -> 内网ip

*设置redis密码    
 requirepass xxxxx

*重命名“危险函数”
rename-command CONFIG ""  #禁用CONFIG命令
rename-command info info2  #重命名info为info2
rename-command flushall "" #禁用删除

0x02 限制ip

使用iptables限制ip

*xxx为redis端口号

iptables -A INPUT -s 192.168.1.0/24 -p tcp --dport xxx -j ACCEPT    

4,072 对 “Redis安全配置”的想法;