6

sudo ufw status在我的 Debian 服务器上最初显示以下配置:

Status: active

To                         Action      From
--                         ------      ----
OpenSSH                    ALLOW       Anywhere
OpenSSH (v6)               ALLOW       Anywhere (v6)

我已经能够成功地允许 http 连接,通过sudo ufw allow http它产生以下结果:

Status: active

To                         Action      From
--                         ------      ----
OpenSSH                    ALLOW       Anywhere
80                         ALLOW       Anywhere
OpenSSH (v6)               ALLOW       Anywhere (v6)
80                         ALLOW       Anywhere (v6)

扭转这个的命令是什么?我试过sudo ufw deny http了,但现在sudo ufw status与原来不同(它现在明确列出了 http 被拒绝):

Status: active

To                         Action      From
--                         ------      ----
OpenSSH                    ALLOW       Anywhere
80                         DENY        Anywhere
OpenSSH (v6)               ALLOW       Anywhere (v6)
80                         DENY        Anywhere (v6)

这与我的初始配置相同,还是有不同的命令可以恢复sudo ufw allow http

4

1 回答 1

7

从 ufw 的手册页,它支持“删除”命令

   delete RULE|NUM
          deletes the corresponding RULE

他们还举了一个例子:

   To delete a rule, simply prefix the original rule with delete with or without the rule comment. For example, if the original rule was:

     ufw deny 80/tcp

   Use this to delete it:

     ufw delete deny 80/tcp

   You may also specify the rule by NUM, as seen in the status numbered output. For example, if you want to delete rule number '3', use:

     ufw delete 3
于 2016-06-03T17:41:21.650 回答