Google
 

Squid - Restricting Access to specific Web sites

Restricting Access to specific Web sites

Squid is also capable of reading files containing lists of web sites and/or domains for use in ACLs.

Create a file under /etc/squid: /usr/local/etc/allowed-sites.squid
http://howtonixnux.blogspot.com
http://jeffersonbriones.blogspot.com

Create a file under /etc/squid: /usr/local/etc/restricted-sites.squid
www.porn.com
illegal.com
www.xxx.com

These can then be used to always block the restricted sites and permit the allowed sites during working hours.
This can be illustrated by expanding our previous example slightly.

#
# Add this to the bottom of the ACL section of squid.conf
#
acl home_network src 192.168.0.0/24
acl business_hours time M T W H F 9:00-17:00
acl GoodSites dstdomain "/etc/squid/allowed-sites.squid"
acl BadSites dstdomain "/etc/squid/restricted-sites.squid"

#
# Add this at the top of the http_access section of squid.conf
#
http_access deny BadSites
http_access allow home_network business_hours GoodSites