IPNAT+Ipfilter+Squid Transparent Proxy 超級防…

2009-05-13 13:10:32来源:未知 阅读 ()

新老客户大回馈,云服务器低至5折

Description :
安裝完防火牆之後感覺好像欠缺某些東西似的,對了!少了 HTML 的過濾機智,ipfilter 只有針對各試各樣的通訊協定 ( tcp/udp/icmp...) 過濾,似乎不能滿足我們的需求,因此我們需要在防火牆內再加裝 Squid,以達到擁有 Transparent Proxy 的能力,這樣的防火牆才能真正稱的上是超級防火牆。
Setp 1.
安裝squid:
#cd /usr/ports/www/squid
#make install clean
設定squid.conf  #vi /usr/local/etc/squid/squid.conf 內容如下:
http_port 3128cache_mem 8 MBmaximum_object_size 4096 KBcache_dir ufs /usr/local/squid/cache 100 16 256cache_access_log /usr/local/squid/logs/access.logcache_log /usr/local/squid/logs/cache.logcache_store_log /usr/local/squid/logs/store.log#cache_mgr admin@ntut.idv.twcache_effective_user nobodycache_effective_group nogroup#acl all src 0.0.0.0/0.0.0.0acl manager proto cache_objectacl localhost src 127.0.0.1/255.255.255.255acl SSL_ports port 443 563acl Safe_ports port 80 21 70 1025-65535acl Valid_ports port 80 21 3128 8080 70 151 1-1024acl CONNECT method CONNECTacl lan-a src 10.10.10.0/24acl hotmail dstdomain .hotmail.comacl msn dstdomain .msn.com#http_access deny msnhttp_access deny hotmailhttp_access allow manager localhosthttp_access deny managerhttp_access allow lan-ahttp_access deny all#httpd_accel_host virtualhttpd_accel_port 80httpd_accel_with_proxy onhttpd_accel_uses_host_header on
squid.conf 設定說明:
http_port 3128 # squid Listen於3128這個port。也就是說,只要將Client端browser內的proxy指向,指向這台的 IP,port 為 3128,Client即可透過這台Squid Server上網。
cache_mem 8 MB  # 設定squid所使用的記憶體最大為8 MB。您可以依自己的須求,調整其大小。如:您的實體記憶體為256 MB,您可將此調整為64 MB
cache_dir ufs /usr/local/squid/cache 100 16 256  # 設定 cache 要放在/usr/local/squid/cache 之下,最多佔 100 MB 的硬碟容量,第一層子目錄的 最大數量為 16 個,第二層子目錄的最大數量為 256 個。
cache_access_log /usr/local/squid/logs/access.log # 哪些 IP 去過哪些網址,記錄在/usr/local/squid/logs/access.log 檔內 . ( 此檔會很大 , 若無需要 , 可將之轉向到 /dev/null 內。
cache_log /usr/local/squid/logs/cache.log  # 把 cache 內,檔案的增減,記錄在/usr/local/squid/logs/cache.log 檔案之內。
cache_store_log /usr/local/squid/logs/store.log  # 把從哪些網址捉下哪些檔案,記錄在/usr/local/squid/logs/store.log 的檔案之內。
reference_age 1 week  # 設定網頁留在cache內最多可以保留多久。時間越長,效果越顯著,但看到過期網頁的機會越大。可改成:reference_age 8 hours、reference_age 1 day、reference_age 3 week、reference_age 5 months、reference_age 1 year。
cache_mgr admin@ntut.idv.tw  # 設定管理者的E-Mail信箱。
acl lan-a src 10.10.10.0/24   # 宣告一個名為lan-a的群組,範圍屬於10.10.10.0/24這個網段。
http_access allow lan-a  # 設定lan-a 這個群組可以使用 Squid Proxy Server。
http_access deny all  # (有先後順序)除了前面設定allow或deny的群組之外,其它的全部都不能使用 Squid Proxy Server。
httpd_accel_host virtualhttpd_accel_port 80httpd_accel_with_proxy onhttpd_accel_uses_host_header on   #  這四行為Transparent proxy 設定

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:多用pax命令,甚至建议取代tar

下一篇:IPNAT+Ipfilter+Bridge 超級防火牆