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でFirewallDを使用するよりシンプルなアプローチhttp://docs.diladele.com/tutorials/transparently_filtering_https_centos/index.html

関連情報