通过https请求到我的域超时。尽管我试过,防火墙还是关闭了。
运行Debian
Distributor ID: Debian
Description: Debian GNU/Linux 7.11 (wheezy)
Release: 7.11
Codename: wheezy
sudo netstat -ntlp
...
tcp6 0 0 :::443 :::* LISTEN 2224/apache2
...我现在的iptables规则:
# Generated by iptables-save v1.4.14 on Sat Jan 13 23:32:19 2018
*filter
:INPUT ACCEPT [1718:285832]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [1521:341387]
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
COMMITApache conf:
ServerAdmin contact@domain.com
ServerName domain.com
ServerAlias www.domain.com
SSLEngine on
SSLCertificateFile "/etc/apache2/cert/domain.crt"
SSLCertificateKeyFile "/etc/apache2/cert/domain.key"
SSLCACertificateFile "/etc/apache2/cert/domain.ca-bundle"
Options FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
ErrorLog ${APACHE_LOG_DIR}/domain.err
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/domain.log combined发布于 2018-01-16 14:20:11
首先,您的"-A INPUT -p tcp tcp -dport 443 -j ACCEPT“规则不起任何作用,因为您的默认策略是接受一切。
为了只接受HTTPS <#>,您的规则应该如下:
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -p tcp -m state --state NEW,ESTABLISHED -m tcp --dport https -j ACCEPT
COMMIT也就是说,使用iptables保存的保存规则的内容并不真正反映计算机上的活动规则。使用以下命令查找活动规则:
iptables -t filter -nL # main command to exec
iptables -t mangle -nL
iptables -t nat -nL为了应用您保存的规则(in /etc/iptables/rues.v4),请使用以下命令(如果尚未安装,请在安装iptables-持久包之前安装它)。
service iptables-persistent restarthttps://serverfault.com/questions/892364
复制相似问题