Squid Rules Block Files URL

From MS Computech
Jump to: navigation, search
#============================================================$
#                      DELAY_POOLS
#============================================================$

acl allow_client src 192.168.1.100
#acl limit_downloads url_regex -i .exe .rar .tar .zip .iso .avi .001 .002 .003 .004 .005 .006 .007 .008 .009 .010
#delay_pools 1
#delay_class 1 1
#delay_parameters 1 204800/51240
#delay_access 1 allow limit_downloads !allow_client

#============================================================$
#                      Bypass Squid
#============================================================$

#acl url_bypass url_regex -i "/etc/squid/bypass_squid_domain"
#http_access allow url_bypass

#============================================================$
#                 Block Domain + Time Frame
#============================================================$

#acl block1 dstdomain "/etc/squid/domain_block"
#http_access deny block1 !allow_client

acl breaktime1 time MTWHFA 09:00-09:30
acl breaktime2 time MTWHFA 13:00-13:30
acl blockdomain dstdomain "/etc/squid/denied_domains.acl"
http_access deny blockdomain !breaktime1 !breaktime2
deny_info http://www.mscomputech.net/ breaktime1 breaktime2 blockdomain

#============================================================$
#                       ACL BT
#============================================================$

acl bittorrent_announce url_regex -i http://.+announce.+info_hash=
http_access deny bittorrent_announce !allow_client

acl bit url_regex -i bit.com torrent.com
http_access deny bit !allow_client

#============================================================$
##                 Block Files extension
#============================================================$

acl blockfiles urlpath_regex "/etc/squid/blocks_files"
http_access deny blockfiles !allow_client

#============================================================$

File extension

\.[Ee][Xx][Ee]$
\.[Aa][Vv][Ii]$
\.[Tt][Oo][Rr][Rr][Ee][Nn][Tt]$
\.001$
\.002$
\.003$
\.004$
\.005$
\.006$
\.007$
\.008$
\.009$
\.010$

URL extension

.wujie.net
.seawjung.com
.mahamodo.com
.youtube.com
.ro89.com
.3feel.com
.sex.com
.nusde.com
.video.xnxx.com
.ultrareach.com
.camfrog.com
.camfrog.in.th
.watch.net.ua
.video.sanook.com
.video.mthai.com

เพิ่มเติม

url_regex :: ให้พิจารณาทั้ง url แบบ regular expression ว่ามีส่วนของคำที่กำหนดหรือไม่ เช่น

acl hi5 url_regex -i hi5.com
# เมื่อผู้ใช้เข้าเว็บ www.nobody-freedom.hi5.com  squid ก็จะเซิร์ทหาคำว่า hi5.com ใน url ว่ามีหรือไม่ แล้วเอาไปเก็บไว้ในตัวแปล hi5 ..
http_access deny hi5
# สั่งให้บล็อกเว็บที่มีคำว่า hi5.com ..ประมาณนี้

urlpath_regex :: ใช้จับคู่ URL โดยไม่สนใจ protocol และ hostname เช่น

acl aclpath urlpath_regex cooking
# จะหาคำว่า cooking สมมุติถ้า URL เป็น http://www.visolve.com/folder/subdir/cooking/first.html  มันจะไม่เอา protocal กับhostname คือ http://www.visolve.com  จะเอาแค่ path ซึ่งผลลัพธ์จะได้เป็น /folder/subdir/cooking/first.html
** สามารถเข้าหน้าหลัก http://visolve.com/  ได้ แต่ไม่สามารถเข้า path ไหนต่อไม่ได้เลย

Note :: -i คือ case-sensitive หมายความว่า C กับ c แตกต่างกัน เช่น
acl aclurl url_regex cooking --> aclurl จะอ้างถึง url มีคำว่า "cooking" ไม่สนใจ "Cooking"
แต่ถ้า acl aclurl url_regex -i cooking --> aclurl จะอ้างถึงทั้ง "cooking" และ "Cooking" ด้วย .. น่าจะประมาณนี้ (",)