有什么东西正在关闭 443 端口?

有什么东西正在关闭 443 端口?

我安装了 Ubuntu 12.04 Server,并使用 Apache 和 Passenger 提供 Ruby on Rails 应用程序。我使用 iptables 来控制流量。昨天,我设置了 Apache 以对网站使用 SSL。设置完成后,我意识到我无法访问该网站,因为端口 443 已关闭,尽管我特意打开了它。奇怪的是,如果我将以下规则重新加载到 iptables 中,端口会突然打开,我可以从 https 访问该网站。但是,如果我重新启动服务器,端口将保持关闭状态,直到我再次重新加载规则。我已尽我所能尝试对 Apache 进行故障排除,并将我的规则移至打开 443 以消除任何冲突。但没有任何效果,没有错误,我不知道还能去哪里查找。我希望这里有人能回答。以下是我的 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 -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 traffic for Nagios
-A INPUT -p tcp --dport 5666 -j ACCEPT

# Allow traffic for Munin
-A INPUT -p tcp --dport 4949 -j ACCEPT

#  Allow SSH connections
#
#  The -dport number should be the same port number you set in sshd_config
#
-A INPUT -p tcp -m state --state NEW --dport 22 -j ACCEPT

#  Allow ping
-A INPUT -p icmp -j ACCEPT

#  Log iptables denied calls
-A INPUT -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7

#  Drop all other inbound - default deny unless explicitly allowed policy
-A INPUT -j DROP
-A FORWARD -j DROP

COMMIT

答案1

启动规则文件中的规则就是启动规则。启动后,您或任何其他具有 root 权限的进程都可以更改规则。在问题发生时,从控制台运行iptables-save(或者iptables -L如果您没有 -save)以查看当前的规则,您会发现一条规则阻止了您的流量。确定该规则来自何处是一项艰巨得多的任务。在最简单的层面上,可能只是iptables -I ... port 443 DENY在您的 init 脚本中的某个地方。

相关内容