小编rmm*_*oul的帖子

来自 ip 的 ufw deny 似乎不起作用

今天工作时,我一直在跟踪服务器的访问日志,并注意到我客户的一个 wordpress 站点受到来自国外 IP 的登录尝试的打击。

我想拒绝来自这个 IP 地址的访问,并尝试了以下 ufw 命令:

sudo ufw deny from xx.xx.xx.xx to any
Run Code Online (Sandbox Code Playgroud)

我看到规则已添加并且防火墙处于活动状态,但我仍然看到大量帖子从该 IP 地址发送到登录页面。

我也尝试过使用 iptables,虽然我对这个工具不是很熟悉:

sudo iptables -A INPUT -s xx.xx.xx.xx -j DROP
Run Code Online (Sandbox Code Playgroud)

我做错了吗?我认为在拒绝访问 ip 地址后,它不会显示在我的 apache 访问日志中,并且登录页面的帖子状态为 200 ok。

编辑:正如我所提到的,ufw 处于活动状态并且规则已经到位,这是 ufw 状态的输出(ip 被阻止):

root@mel:~# ufw status
Status: active

To                         Action      From
--                         ------      ----
22                         ALLOW       Anywhere
80                         ALLOW       Anywhere
1723                       ALLOW       Anywhere
8080                       ALLOW       Anywhere
6273                       ALLOW       Anywhere
36728                      DENY        Anywhere
Anywhere                   DENY        xx.xx.xx.xx
22                         ALLOW       Anywhere (v6)
80                         ALLOW …
Run Code Online (Sandbox Code Playgroud)

ufw apache-2.4

12
推荐指数
1
解决办法
8698
查看次数

标签 统计

apache-2.4 ×1

ufw ×1