QNAP上でSquidを稼働させている記事は以前書きましたが、今回はSquid+SquidGuardを使ってフィルタとして稼働させてみます。
raspiのシステムは、microsd cardに入っているので、ガリガリ書き込みしたくないので、squidについては、NOCACHEにて運用しよう。
$ sudo apt-get update $ sudo apt-get upgrade $ sudo apt-get install squid
squidのインストールが完了すれば、confを書いていく
$ cd /etc/squid $ sudo cp squid.conf squid.conf.org $ sudo vi squid.conf # Example rule allowing access from your local networks. # Adapt to list your (internal) IP networks from where browsing # should be allowed #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 localnet src 192.168.0.0/16 acl homenet src 192.168.10.0/16 # # INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS # # Example rule allowing access from your local networks. # Adapt localnet in the ACL section to list your (internal) IP networks # from where browsing should be allowed #http_access allow localnet http_access allow localhost http_access allow localnet http_access allow homenet # And finally deny all other access to this proxy http_access deny all # キャッシュを無効にする。下記を最下部に追記。 acl NOCACHE src all cache deny NOCACHE
別のターミナルを立ち上げ、logファイルを垂れ流しておく
***terminal 2*** $ sudo tail -f /var/log/squid/access.log
configを編集したターミナルでsquidを再起動する。
$ sudo service squid restart
クライアントのブラウザでproxyの設定を行い、logを確認する。
このような感じでlogが流れていく。
1538618882.922 15 192.168.0.230 TCP_MISS/200 1208 GET http://image.itmedia.co.jp/enterprise/images/icon_rss_s.gif - HIER_DIRECT/52.193.116.243 image/gif 1538618882.925 16 192.168.0.230 TCP_MISS/200 991 GET http://image.itmedia.co.jp/images/ulli_mail2.gif - HIER_DIRECT/52.193.116.243 image/gif 1538618882.928 18 192.168.0.230 TCP_MISS/200 916 GET http://image.itmedia.co.jp/enterprise/images/ulli_document1.gif - HIER_DIRECT/52.193.116.243 image/gif 1538618882.974 20 192.168.0.230 TCP_MISS/200 2777 GET http://api.popin.cc/searchbox/itmedia_enterprise.js - HIER_DIRECT/192.229.144.139 text/javascript 1538618883.188 12 192.168.0.230 TCP_MISS/200 38980 GET http://api.popin.cc/popin_discovery5-min.js - HIER_DIRECT/192.229.144.139 text/javascript 1538618883.209 120 192.168.0.230 TCP_MISS/503 367 GET http://ipv6.beacon.itmedia.jp/1.gif? - HIER_DIRECT/2406:da14:a0b:8101:6857:a45e:4b75:c2d text/html 1538618883.241 155 192.168.0.230 TCP_MISS/200 343 GET http://ipv4.beacon.itmedia.jp/1.gif? - HIER_DIRECT/52.193.116.243 image/gif 1538618883.284 197 192.168.0.230 TCP_MISS/200 343 GET http://dualstack.beacon.itmedia.jp/1.gif? - HIER_DIRECT/13.115.214.152 image/gif 1538618883.626 9 192.168.0.230 TCP_MISS/200 13263 GET http://api.popin.cc/td_js_sdk_171.js - HIER_DIRECT/192.229.144.139 text/javascript 1538618883.880 11 192.168.0.230 TCP_MISS/200 27989 GET http://api.popin.cc/media_search-min_v2.js - HIER_DIRECT/192.229.144.139 text/javascript 1538618885.428 44 192.168.0.230 TCP_MISS/200 5909 GET http://cdn.pardot.com/pd.js - HIER_DIRECT/151.139.109.8 text/javascript 1538618885.574 17 192.168.0.230 TCP_MISS/200 1536 GET http://www.itmedia.co.jp/favicon.ico - HIER_DIRECT/54.95.197.12 image/vnd.microsoft.icon 1538618892.359 35 192.168.0.230 TCP_MISS/200 380 GET http://rlog.popin.cc/s.gif? - HIER_DIRECT/54.248.244.173 image/gif