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

Create a file under /etc/squid: /usr/local/etc/restricted-sites.squid

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
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