Home   >>   Squid Proxy   >>   How To Block/Deny Websites To Specific IP/Users/Time Using Squid Proxy
How To Block/Deny Websites To Specific IP/Users/Time Using Squid Proxy PDF Print E-mail
( 2 Votes )
How To - Squid Proxy
Written by Christian Foronda   
Friday, 21 January 2011 11:50

This howto assume you already have a working squid installation.

Requirements:

  • Some websites will only be blocked during office hours (8am to 12pm and 1:30pm to 6pm).
  • Websites will be only blocked for specific IPs.
  • Deny websites using keywords.

Edit /etc/squid/squid.conf

	# vi /etc/squid/squid.conf

 

Find the line "INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS" and add the following:

	acl morning_hours time M T W H F 8:00-12:00
	acl evening_hours time M T W H F 13:30-18:00

	acl deniedDomains url_regex src "/etc/squid/deniedDomains"
	acl blacklistIP src "/etc/squid/blacklistIP"

	http_access deny deniedDomains morning_hours blacklistIP
	http_access deny deniedDomains evening_hours blacklistIP

	acl myNetwork src "/etc/squid/acl"
	http_access allow myNetwork

 

Create the list of domain name separated by line to be blocked:

	# vi /etc/squid/deniedDomains 

 

	friendster
	metacafe
	myspace
	videos.google
	youtube
	facebook
	chatenabled.mail.google.com

 

Create the list of users IP who's having rescticted access:

	# vi /etc/squid/blacklistIP

 

	192.168.1.54
	192.168.1.221
	192.168.1.236
	172.16.70.0/24

 

Create the list of IP who can access your squid proxy:

	# vi /etc/squid/acl

 

	192.168.1.0/24
	172.16.70.0/24
	213.44.2.126

 

Restart squid:

	# /etc/init.d/squid reload

 




blog comments powered by Disqus