Restricting Acess with Squid Proxy

root@ubuntu:/etc/squid/conf.d# cat local.conf
http_port 8080
cache_dir ufs /var/spool/squid 800 16 256

acl internal src 192.168.1.0/255.255.255.0
http_access allow internal


acl blocked_websites dstdomain .facebook.com .fb.com
http_access deny blocked_websites

http_access deny all

Let me explain this:

I am using the proxy via port 8080

I am using the cache directory in /var/spool/squid and 800 is the size by default with a megabyte

Now i have created the ACL, i am creating the hosts which are defined by 'internal' and then the action that will be applied on them

acl internal src 192.168.1.0/255.255.255.0
http_access allow internal

With Squid you can restrict access by domain name or regular expression

If it is a long list of domain you can use a file populated by these domain maybe you have a script that will do this for you

In this example, i'll block video streaming from domains inserted into a file

acl video_streaming dstdomain "/etc/squi/streaming.list"

http_access deny video_streaming

You can view a full list of ACL TYPES on this page

Last updated