redis配置
1.修改 redis.conf 文件,禁用远程修改 DB 文件地址
rename-command FLUSHALL ""
rename-command CONFIG ""
rename-command EVAL ""
2.创建redis用户组,使用redis用户登录
groupadd redis
useradd redis -g redis
chown -R redis:redis /data/redis/
chown -R redis:redis /usr/local/redis
切换到redis用户下启动redis(切换用户前要先关掉redis服务)
su redis
/usr/local/redis/4.0.12/bin/redis-server /usr/local/redis/4.0.12/redis.conf
3.保证 authorized_keys 文件的安全
chmod 400 ~/.ssh/authorized_keys
chattr +i ~/.ssh/authorized_keys
chattr +i ~/.ssh
4.增加防火墙限制
防火墙开启情况下
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="ip" port protocol="tcp" port="6377" accept"
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="ip段" port protocol="tcp" port="6377" accept"
firewall-cmd --reload