无法通过 HTTPS Squid 代理访问 HTTP 站点

无法通过 HTTPS Squid 代理访问 HTTP 站点

我有在 Squid 4.4 和 RHEL8 上进行 SSL 提升的有效配置。但我发现,少数未设置 SSL 的网站(例如http://squidguard.org) 不起作用。

我不得不使用几个不同的来源拼凑我的配置,因为似乎没有一个提供设置 SSL 碰撞的明确方法。我可能错过了一些可以让 Squid 处理 HTTP 和 HTTPS 流量的东西吗?

这是我在日志中看到的内容:

1624658033.150  59887 10.108.0.18 TCP_MISS/503 4300 GET http://squidguard.com/favicon.ico - HIER_DIRECT/3.223.115.185 text/html
1624658042.966  60608 10.108.0.18 TCP_MISS/503 4392 GET http://squidguard.com/ - HIER_DIRECT/3.223.115.185 text/html

浏览器页面上的错误显示

The following error was encountered while trying to retrieve the URL: http://squidguard.com/
Connection to 3.223.115.185 failed.
The system returned: (110) Connection timed out
The remote host or network may be down. Please try the request again.

但远程主机或网络并未关闭。无需通过代理,我便可以访问它。

我的squid.conf:

acl vdi src 10.108.0.0/20

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

acl intermediate_fetching transaction_initiator certificate-fetching
http_access allow intermediate_fetching

http_access deny !Safe_ports

http_access allow localhost manager
http_access deny manager

http_access allow vdi

http_access deny all

http_port 0.0.0.0:3128
http_port 0.0.0.0:3129 ssl-bump cert=/etc/squid/ssl_cert/myCA.pem generate-host-certificates=on
https_port 0.0.0.0:3130 intercept ssl-bump generate-host-certificates=on dynamic_cert_mem_cache_size=20MB cert=/etc/squid/ssl_cert/myCA.pem

sslcrtd_program /usr/lib64/squid/security_file_certgen -s /var/lib/squid/ssl_db -M 20MB
ssl_bump stare all
ssl_bump bump all

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

shutdown_lifetime 1 second

我没有运行 iptables,所以没有任何 REDIRECT 规则。我怀疑这是问题所在。

答案1

这个问题没有意义。问题的根源不在 Squid 的范围之内,甚至不在运行它的服务器上。防火墙阻止了端口 80。

答案2

你可以通过下面的方法解决这个问题

http_port 0.0.0.0:3129 ssl-bump cert=/etc/squid/ssl_cert/myCA.pem generate-host-certificates=on

删除其他

http_port 0.0.0.0:3128
https_port 0.0.0.0:3130 intercept ssl-bump generate-host-certificates=on dynamic_cert_mem_cache_size=20MB cert=/etc/squid/ssl_cert/myCA.pem

相关内容