Monday, November 19, 2012

Squid

Before Install Squid
# iptables -F ; iptables -X ; service iptables save
# yum update -y
Install Squid
# yum install squid
Start Squid Service
# service squid start
-------------------------------------------------------------------------
Configre Squid for localnet , default is only for localhost.
# vi /etc/squid/squid.conf
Add Line acl localnet src 172.16.1.0/24 Before http_access allow localnet
Configre Squid Admin Email , Show it Up when Can't Retrieve the URL
# vi /etc/squid/squid.conf
Add Line cache_mgr admin@email.address
Configre Squid for Deny clients access Facebook.com , allow others domains.
# vi /etc/squid/squid.conf
Add Line acl dropFackbook dstdomain .facebook.com Before http_access allow localnet
Add Line http_access deny dropFackbook Before http_access allow localnet
Configre Squid for Deny clients access A LOT OF domains
# vi /etc/squid/squid.conf
Add Line acl dropDomains dstdomain "/etc/squid/dropDomainsList.txt" Before http_access allow localnet

# vi /etc/squid/dropDomainsList.txt
Add Line  .limited_domain1.com
Add Line  .limited_domain2.com
Configre Squid for Deny clients access Some domains , and allow Some domains
# vi /etc/squid/squid.conf
Add Line acl authGoogleGroup src "/etc/squid/allowGoogle.ip.list"
Add Line acl authPCHOMEGroup src "/etc/squid/allowPCHOME.ip.list"
Add Line acl google dstdomain .google.com
Add Line acl pchome dstdomain .pchome.com.tw
Add Line http_access allow authGoogleGroup google
Add Line http_access allow authPCHOMEGroup pchome
Add Line http_access deny google
Add Line http_access deny pchome
# vi /etc/squid/allowGoogle.ip.list
Add Line 172.16.1.185
# vi /etc/squid/allowPCHOME.ip.list
Add Line 172.16.1.184
Client,172.16.185 , could access www.google.com , but www.pchome.com.tw
Client,172.16.184 , could access www.pchome.com.tw , but www.google.com
Configre Squid for Deny clients access Youtube Videos
# vi /etc/squid/squid.conf
Add Line acl youtube_domains dstdomain .youtube.com .googlevideo.com .ytimg.com
Add Line http_access deny youtube_domains
Refers:
http://wiki.squid-cache.org/CategoryConfigExample

Modify Default Deny_info Content
 , ex: ACCESS_DENIED
# vi /usr/share/squid/errors/zh-tw/ERR_ACCESS_DENIED

Customize Your Deny_info Content
# vi /usr/share/squid/errors/templates/MSG_DENY
# vi  /etc/squid/squid.conf
Add Line deny_info MSG_DENY all Before http_access deny all

No comments: