Redis 的 Protected Mode 解读

redis-social-1200x628-1


官方配置文件自带的注释:

Protected mode is a layer of security protection, in order to avoid that Redis instances left open on the internet are accessed and exploited.

When protected mode is on and if:

1) The server is not binding explicitly to a set of addresses using the "bind" directive.
2) No password is configured.

The server only accepts connections from clients connecting from the IPv4 and IPv6 loopback addresses 127.0.0.1 and ::1, and from Unix domain sockets.

By default protected mode is enabled. You should disable it only if you are sure you want clients from other hosts to connect to Redis even if no authentication is configured, nor a specific set of interfaces are explicitly listed using the "bind" directive.

Google 翻译结果:

保护模式是一层安全保护,以避免在互联网上开放的 Redis 实例被访问和利用。

当保护模式打开时,如果:

1) 服务器未使用“bind”指令显式绑定到一组地址。
2) 没有配置密码。

服务器只接受来自环回地址127.0.0.1(IPv4)和 ::1(IPv6)以及来自 Unix 域套接字的客户端的连接。

默认情况下启用保护模式。仅当您确定希望来自其他主机的客户端连接到 Redis,即使没有配置身份验证,也没有使用“bind”指令明确列出一组特定接口时,才应禁用它。

也就是说,会存在这两种情况:

1、当 protected-mode yes

  • # bind 192.168.56.120 - - > 注释

  • # requirepass zhurs@123 - - > 注释

    此时,redis 的保护模式生效;

    客户端只能通过本地连接,即环回地址127.0.0.1(IPv4)和 ::1(IPv6)以及来自 Unix 域套接字的客户端的连接。

  • # bind 192.168.56.120 - - > 注释

  • requirepass zhurs@123

    此时,redis 的保护模式不生效(yes 或 no 都无影响);

    客户端可指定 IP(192.168.56.120)+ 端口 + 密码来连接 redis。

  • bind 192.168.56.120

  • # requirepass zhurs@123 - - > 注释

    此时,redis 的保护模式不生效(yes 或 no 都无影响);

    客户端可指定 IP(192.168.56.120)+ 端口来连接 redis(此时无密码)。

  • bind 192.168.56.120

  • requirepass zhurs@123

    此时,redis 的保护模式不生效(yes 或 no 都无影响);

    客户端可指定 IP(192.168.56.120)+ 端口 + 密码来连接 redis。

2、当 protected-mode no

  • 无论上面的哪种场景,客户端都可以根据 bindrequirepass 实际参数来连接到 redis;
  • 然后通过指定 IP(192.168.56.120)IP(192.168.56.120) + 端口IP(192.168.56.120)+ 端口 + 密码来连接 redis。

—END

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

云计算-Security

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值