Squid がウェブページを誤って読み込む

Squid がウェブページを誤って読み込む

VPSサーバーをシンプルなHTTPプロキシとして動作するように設定しようとしています。 CentOS 7.1.1503にSquid 3.3.8をインストールし、 で基本認証を設定しましたncsa_auth。 全体の仕組みは機能しているようで、別のPCからプロキシに正常に接続していますが、Webページの読み込みに問題が発生しています。 たとえば、http://mirrors.liquidweb.com/、ウェブページが正しく読み込まれず、Firefox は半分だけ読み込み、しばらく「liquidweb.com からデータを転送しています」というメッセージが表示されます。その後、何もせずに消えます。ウェブページはまだ半分読み込まれた状態で表示されます。この問題について少し調査しましたが、私が見つけた唯一の解決策は DNS の問題に関連していました。これは DNS 関連の問題ではないようですし、dns_v4_first onSquid 構成にオプションを追加しても結果は出ませんでした。特に指摘しておきたいのは、これはサイトやブラウザ関連の問題ではないということです。なぜなら、この Web サイトを開こうとしたすべてのブラウザでこの問題が表示され、ブラウザ設定でプロキシを無効にするとすぐに問題が解決するからです。また、このプロキシ経由で平均速度約 50 Mbps でファイルをダウンロードできるため、ISP 関連の問題でもないようです。私のスクリーンショットsquid.confと、不適切に読み込まれたウェブページのスクリーンショットを以下に示します。推測をいただければ幸いです。

auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/passwd
auth_param basic childred 5
auth_param basic realm liproxy
auth_param basic credentialsttl 2 hours

#acl localnet src 10.0.0.0/8    # RFC1918 possible internal network
#acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
#acl localnet src 192.168.0.0/16    # RFC1918 possible internal network
#acl localnet src fc00::/7       # RFC 4193 local private network range
#acl localnet src fe80::/10      # RFC 4291 link-local (directly plugged) machines

acl SSL_ports port 443
acl Safe_ports port 80          # http
#acl Safe_ports port 21         # ftp
acl Safe_ports port 443         # https
#acl Safe_ports port 70         # gopher
#acl Safe_ports port 210        # wais
#acl Safe_ports port 1025-65535     # unregistered ports
#acl Safe_ports port 280        # http-mgmt
#acl Safe_ports port 488        # gss-http
#acl Safe_ports port 591        # filemaker
#acl Safe_ports port 777        # multiling http
acl CONNECT method CONNECT

http_access deny !Safe_ports

http_access deny CONNECT !SSL_ports

http_access allow localhost manager
http_access deny manager

#http_access deny to_localhost

acl ncsaauth proxy_auth REQUIRED
http_access allow ncsaauth
dns_v4_first on

http_access deny all

http_port 0.0.0.0:3128

#cache_dir ufs /var/spool/squid 100 16 256

coredump_dir /var/spool/squid

refresh_pattern ^ftp:       1440    20% 10080
refresh_pattern ^gopher:    1440    0%  1440
refresh_pattern -i (/cgi-bin/|\?) 0 0%  0
refresh_pattern .       0   20% 4320

etc/sysconfig/iptables

*filter

# Allows 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

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

# Allows all outbound traffic
# You could modify this to only allow certain traffic
-A OUTPUT -j ACCEPT

-A INPUT -p tcp --dport 3128 -j ACCEPT

# Allows SSH connections 
# The --dport number is the same as in /etc/ssh/sshd_config
-A INPUT -p tcp -m state --state NEW --dport 22 -j ACCEPT

# Now you should read up on iptables rules and consider whether ssh access 
# for everyone is really desired. Most likely you will only allow access from certain IPs.

# Allow ping
#  note that blocking other types of icmp packets is considered a bad idea by some
#  remove -m icmp --icmp-type 8 from this line to allow all kinds of icmp:
#  https://security.stackexchange.com/questions/22711
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT

# log iptables denied calls (access via 'dmesg' command)
-A INPUT -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7

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

COMMIT

ここに画像の説明を入力してください

答え1

ファイアウォールをインターネット上のどこかからコピーしましたが、どうやらそれを完全に読んで理解していないようです。

次のセクションを検討してください。

# Allow ping
#  note that blocking other types of icmp packets is considered a bad idea by some
#  remove -m icmp --icmp-type 8 from this line to allow all kinds of icmp:
#  https://security.stackexchange.com/questions/22711
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT

すべての ICMP をブロックすることが「悪い考え」である理由の 1 つは、Path MTU 検出が機能するために必要な Fragmentation Needed 応答などもブロックしてしまうことです。これが機能しない場合は、Web ページがハングしたり、ダウンロードが停止したりします。

この問題を解決するには、コメントの内容を正確に削除する必要があります。


さらに良いのは、このファイアウォールを完全に削除し、CentOS 7 に付属していたシステムに戻すことです。firewalldこれにより、不注意による罠が一切なくなる適切なファイアウォールが構成されます。

関連情報