关闭端口的奇怪 iptables 模式

关闭端口的奇怪 iptables 模式

这个问题让我很困惑...我使用 Shields Up 代理到我刚刚用 Rackspace 设置的服务器。这是我的 iptables 配置:

*filter

#  Allow all loopback (lo0) traffic and drop all traffic to 127/8 that doesn't use lo0
-A INPUT -i lo -j ACCEPT
-A INPUT ! -i lo -d 127.0.0.0/8 -j REJECT

#  Accept all established inbound connections
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

#  Allow all outbound traffic - you can modify this to only allow certain traffic
-A OUTPUT -j ACCEPT

#  Allow HTTP and HTTPS connections from anywhere (the normal ports for websites and SSL).
-A INPUT -p tcp --dport 80 -j ACCEPT
-A INPUT -p tcp --dport 443 -j ACCEPT

#  Allow SSH connections
-A INPUT -p tcp -m state --state NEW --dport 22 -j ACCEPT

#  Allow ping
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT

#  Reject all other inbound - default deny unless explicitly allowed policy
-A INPUT -j REJECT
-A FORWARD -j REJECT

COMMIT

我已将其保存到配置文件中,并使用 iptables-restore 加载。我的端口扫描如下所示:

在此处输入图片描述

什么可能导致这种端口关闭模式?

编辑: iptables -L 的输出

Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere
REJECT     all  --  anywhere             127.0.0.0/8          reject-with icmp-port-unreachable
ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:http
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:https
ACCEPT     tcp  --  anywhere             anywhere             state NEW tcp dpt:ssh
ACCEPT     icmp --  anywhere             anywhere             icmp echo-request
REJECT     all  --  anywhere             anywhere             reject-with icmp-port-unreachable

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
REJECT     all  --  anywhere             anywhere             reject-with icmp-port-unreachable

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere

答案1

什么可能导致这种端口关闭模式?

一个蹩脚的扫描仪。您正在添加一个

-A INPUT -j REJECT

规则将导致您的主机响应ICMP type 3 / code 3消息(目标不可达-端口不可达),除了之前接受的端口 22、80 和 443(后者也没有出现在扫描中)。无论如何,这不应该导致“隐形”端口。

吉布森不可信其他人也对臭名昭著的“护盾升起!” 几年前

GRC 的“纳米探针”勤奋地 connect() 到服务器,然后继续游荡。但是,端口测试告诉我我的 HTTP 端口已关闭。奇怪。非常奇怪。查看我从此连接嗅探到的日志显示我的 Web 服务器已响应 - 但测试程序仍报告它已关闭。我对基于 Windows 和 Unix 的 Web 服务器重复了此练习,得到的总体命中率不到百分之三十,换句话说,测试程序通常无法检测到我打开的 Web 服务器。

看起来,有些事情永远不会改变。

作为替代方案,请恢复使用公开可用的开源工具。网络地图是一款通用扫描器,几乎任何发行版都可以在每月 5 美元的 VPS 主机上使用。如果您只需要偶尔扫描,您可以使用在线 nmap 服务,例如来自 Online Domain Tools 的一个

相关内容