私はUbuntu 20.04でSquid 5.2を実行しています。私はこの機械を子供のためのWebフィルターに設定しました。プロキシ機能が正常に動作しているようです。少なくとも子供の一人は、自分のコンピュータからプロキシ設定を削除する方法を見つけることができると確信しています。したがって、トラフィックをサーバー経由でルーティングし、Squidがそのようにフィルタリングするようにします。
パケット転送を設定しましたが、トラフィックは正常に進行します。テストページなどを見ることができます。ただし、ポート 80 トラフィックを 3128 にリダイレクトするように PREROUTING ステートメントを変更すると、Web ブラウザに「無効な URL」というエラーが表示されます。
私のイカの構成は次のとおりです。
access_log daemon:/var/log/squid/access.log
acl localnet src 192.168.1.0/24
acl step1 at_step SslBump1
ssl_bump peek step1
ssl_bump bump all
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
error_directory /usr/local/squid/share/errors
acl me src 192.168.1.33
acl kids src 192.168.1.215 192.168.1.253
acl ksm dstdomain "/usr/local/squid/etc/kidssocialmedia.txt
acl chat dstdomain "/usr/local/squid/etc/chatdomains.txt"
acl porn dstdomain "/usr/local/squid/etc/porndomains.txt"
acl webmail dstdomain "/usr/local/squid/etc/webmaildomains.txt"
deny_info ERR_TROLL_KIDS kids ksm
http_reply_access deny kids ksm
http_access deny kids ksm
deny_info ERR_TROLL_PORN kids porn
http_reply_access deny kids porn
http_access deny kids porn
deny_info ERR_TROLL_WEBMAIL kids webmail
http_reply_access deny kids webmail
http_access deny kids webmail
deny_info ERR_TROLL_CHAT kids chat
http_reply_access deny kids chat
http_access deny kids chat
http_access allow localnet
http_access allow localhost
http_access deny all
http_port 3128 ssl-bump cert=/usr/local/squid/etc/ssl_cert/myCA.pem generate-host-certificates=on dynamic_cert_mem_cache_size=4MB
sslcrtd_program /usr/local/squid/libexec/security_file_certgen -s /usr/local/squid/var/logs/ssl_db -M 4MB
coredump_dir /usr/local/squid/var/cache/squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern \/(Packages|Sources)(|\.bz2|\.gz|\.xz)$ 0 0% 0 refresh-ims
refresh_pattern \/Release(|\.gpg)$ 0 0% 0 refresh-ims
refresh_pattern \/InRelease$ 0 0% 0 refresh-ims
refresh_pattern \/(Translation-.*)(|\.bz2|\.gz|\.xz)$ 0 0% 0 refresh-ims
refresh_pattern . 0 20% 4320
cache_dir ufs /mount/storage/squid 4096 16 256
maximum_object_size_in_memory 0
maximum_object_size 250
cache_mem 0
これは、UFW Rules.beforeファイルのフィルタセクションの前にあります。
*nat: 事前ルーティング許可 [0:0]
-A 辞書パス -i br0 -p tcp --dport 80 -j リダイレクト --to-port 3128
犯罪
サーバーのデフォルトインターフェースはbr0(192.168.1.149)です。リダイレクトステートメントがない場合、トラフィックは問題なくサーバーを介してインターネットゲートウェイ(192.168.1.1)にルーティングされます。 Webブラウザのプロキシ設定を192.168.1.149:3128に設定しても問題なく動作しました。
私もDNATステートメントを試しましたが、それも機能しませんでした。とにかくトラフィックがイカサーバーに偽装されたくないので、可能であればDNATを使用したくありません。必要に応じて、ポートリダイレクトに使用できる他のコンピュータがあります。