ubuntu 14.04 服务器上的透明 squid 代理

ubuntu 14.04 服务器上的透明 squid 代理

我的服务器上安装了 ubuntu 14.04 LTS 服务器,我想在我的服务器上为 LAN 网络安装透明代理服务器。请帮我解决此问题。

提前致谢。

答案1

由于您已经拥有一台具有 2 个以上 NIC 的 Ubuntu 机器,因此这非常简单 - 您只需要安装或多或少较新的 Squid;网络中的所有机器都必须使用 Squid 盒作为默认网关;然后将以下内容添加到 squid 配置中:

# port configuration
http_port  3126 intercept
https_port 3127 intercept ssl-bump generate-host-certificates=on dynamic_cert_mem_cache_size=4MB cert=/opt/qlproxy/etc/myca.pem
http_port  3128 ssl-bump generate-host-certificates=on dynamic_cert_mem_cache_size=4MB cert=/opt/qlproxy/etc/myca.pem

最后使用 iptables 将传入流量从端口 80 重定向到 3126、443 重定向到 3129:

# redirect all HTTP(tcp:80) traffic coming in through eth0 to 3126
iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3126

# redirect all HTTPS(tcp:443) traffic coming in through eth0 to 3127
iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 443 -j REDIRECT --to-ports 3127

启用 NAT 即可。更多信息请访问http://blog.diladele.com/2014/04/10/transparent-ssl-https-filtering-on-centos/

更简单的方法是在 CentOS 7 上使用 FirewallDhttp://docs.diladele.com/tutorials/transparently_filtering_https_centos/index.html

相关内容