Web site blocking techniques
How to use Squid and squidGuard to restrict user access to undesirable web sites
Download the whole article as PDF
Short URL: http://fsmsh.com/1166
- 2005-06-25
- Server side | Intermediate
-
Write a full post in response to this!
For a variety of reasons, organizations have very strict policies regarding web site access. These policies usually mean that not all users have permission to access all web sites.
This article will explain two techniques that can be used to block web site access to specified groups of users at specified times, using Squid’s built-in mechanism and using squidGuard.
In this article, the configurations shown are taken from real files that are used by my clients. I have attempted to write the configuration and installation procedures so that they will work with any operating system. However, where there are specific procedures, I only explain how to do things using an RPM-based Linux distribution.
In the last section, I list advantages and disadvantages using each technique. I also mention common problems that you may encounter during the installation and configuration phase.
Introduction
During my work as a Linux consultant, I’m often asked to implement a mechanism that will stop internet users from accessing inappropriate sites, such as sites containing porn and other offensive or inappropriate material.
There are various reasons organizations might want such mechanisms implemented. The main reasons are:
- Limited bandwidth—Some of my clients have very limited bandwidth; they are usually connected to the internet using a dial up modem or a leased line, which allow very limited bandwidth (between 56Kbs and 128 Kbps). In such situations, management cannot permit employees to download inappropriate material as it uses up precious bandwidth.
- Organizational policy—Many organizations have very strict internet policies regarding offensive material. For this and other reasons, they don’t want employees gaining access to inappropriate sites.
- Working hours—Many organizations don’t want employees to access particular sites during certain hours.
Organizations implement web site blocking policy because of limited bandwidth, organizational policy or working hours
To implement this mechanism, I usually use Squid and squidGuard.
From an ethical point of view, before implementing this kind of policy, the users must be informed about the company’s policies—it’s even better if they are involved in the policy making process. The organization’s internet users, management, and IT (Information Technology) department must define what kind of policy will be implemented.
The organization’s internet users, management, and IT (Information Technology) department must define what policy the mechanism will implemement
Before implementing web site blocking policy, you have to ensure it conforms with any legislation.
Squid is a high-performance, proxy-caching server for web clients, supporting FTP, gopher, and HTTP data objects. Squid can also be used to implement access control.
SquidGuard is a fast and free filter, redirector and access controller for Squid. It was written by Pål Baltzersen and Lars Erik Håland.
In order to use Squid’s built-in blocking mechanism, you don’t need squidGuard, but you do need Squid to use squidGuard.
In order to use Squid’s built-in blocking mechanism, you don’t need squidGuard, but you do need Squid to use squidGuard
Squid’s built-in blocking mechanism
In my experience, Squid’s built-in blocking mechanism or access control is the easiest method to use for implementing web site blocking policy. All you need to do is modify the Squid configuration file.
Before you can implement web site blocking policy, you have to make sure that you have already installed Squid and that it works. You can consult the Squid web site_ _to get the latest version of Squid and a guide for installng it.
To deploy the web-site blocking mechanism in Squid, add the following entries to your Squid configuration file (in my system, it’s called squid.conf and it’s located in the /etc/squid directory):
acl bad url_regex "/etc/squid/squid-block.acl" http_access deny bad
The file /etc/squid/squid-block.acl contains web sites or words you want to block. You can name the file whatever you like. If a site has the URL or word listed in squid-block.acl file, it won’t be accesible to your users. The entries below are found in squid-block.acl file used by my clients:
.oracle.com .playboy.com.br sex ...
With the squid-block.acl file in action, internet users cannot access the following sites:
- Sites that have addresses ending with .oracle.com
- Sites that have addresses ending with .playboy.com.br
- Sites containing the word “sex” in its pages
You should beware that by blocking sites containing the word “sex”, you will also block sites such as Middlesex University, Sussex University, etc. To resolve this problem, you can put those sites in a special file called squid-noblock.acl:
^http://www.middlesex.ac.uk ^http://www.sussex.ac.uk
Write a full post in response to this!
Similar articles
Do you like this post?
Vote for it!
Copyright information
This article is made available under the "Attribution-NonCommercial-NoDerivs" Creative Commons License 3.0 available from http://creativecommons.org/licenses/by-nc-nd/3.0/.
Biography
Tedi Heriyanto: During the day, Tedi works as a system engineer and system analyst. He is also a contributing editor for several computer magazines in Indonesia. At night, he works as a computer programmer and security enthusiast. In his previous life, Tedi worked as a software development engineer and as a Linux training instructor.
- Login or register to post comments
- 262036 reads
- Printer friendly version (unavailable!)




Best voted contents
-
Special 301: FOSS users. Now we're all Communists and Criminals
Gary Richmond, 2010-03-05 -
Microsoft's Internet Driving Licence: stupid, unworkable and unenforceable
Gary Richmond, 2010-03-10 -
The Bizarre Cathedral - 69
Ryan Cartwright, 2010-03-12 -
Interview: Nina Paley (author of "Sita Sings the Blues" and the two "Minute Meme" animations)
Terry Hancock, 2010-03-15
Buzz authors
Free Software news
- .@bhaven Thanks for the RT Funny, the wiki used in #GCpedia is actually the #freesoftware program #MediaWiki
- When are YOU get your copy of this AWSOME FREEsoftware? Check it out at http://bit.ly/5NJCME
- RT @flourishconf: ^jh Come to flourish on Friday at 9am at #UIC at 750 South Halsted Street.See http://bit.ly/d3aHC3 for more info. #opensource #freesoftware
- ^jh Come to flourish on Friday at 9am at #UIC at 750 South Halsted Street.See http://bit.ly/d3aHC3 for more info. #opensource #freesoftware
- ^jh Come to flourish on Friday at 9am at #UIC at 750 South Halsted Street.See http://bit.ly/d3aHC3 for more info. #opensource #freesoftware
Similar entries
Other sites
- The Top 10 Everything (Dave). The good, the bad and the ugly.
- Free Software news (Dave & Bridget). All about free software -- free as in freedom!
- Book Reviews: Illiterarty (Bridget). Book reviews, blogs, and short stories.
Hot topics - last 60 days
-
Linux performance: is Linux becoming just too slow and bloated?
Mitch Meyran, 2010-01-26 -
Web code is already open - why not make it free as well
Ryan Cartwright, 2010-01-20 -
Save "Sita Sings the Blues" from the Flash format: can you convert FLA?
Terry Hancock, 2010-01-29 -
Microsoft's Internet Driving Licence: stupid, unworkable and unenforceable
Gary Richmond, 2010-03-10 -
Special 301: FOSS users. Now we're all Communists and Criminals
Gary Richmond, 2010-03-05
Hot topics - last 21 days
-
Microsoft's Internet Driving Licence: stupid, unworkable and unenforceable
Gary Richmond, 2010-03-10 -
Special 301: FOSS users. Now we're all Communists and Criminals
Gary Richmond, 2010-03-05 -
The Bizarre Cathedral - 69
Ryan Cartwright, 2010-03-12 -
Interview: Nina Paley (author of "Sita Sings the Blues" and the two "Minute Meme" animations)
Terry Hancock, 2010-03-15
Odiogo
Free Software Magazine uses Apollo, project management and CRM for its everyday activities!

Proxy
Submitted by admin on Wed, 2006-03-29 11:28.
Vote!From: DaJoMu
Url: ?
Date: 2005-06-29
Subject: Proxy
i have to admit that I've never used squid, but most proxy servers ned to be set up in transpartent mode at least or one can bypass the proxy by changing the original proxy setting with i.e. 207.248.240.118:80
Maybe this will work even if the proxy is in transparent mode.
Squid.
Submitted by Anonymous visitor on Tue, 2006-10-03 17:56.
Vote!I have doen exactly that and nothing seeems to be blocked. What now?
blocking
Submitted by Anonymous visitor on Tue, 2006-11-28 20:24.
Vote!i would like to block all of zangys my space.com and all of the other ones
i need help
Submitted by Anonymous visitor on Wed, 2007-01-03 14:09.
Vote!Thomas Stone High School has a problem with not letting students that are done their work to play games. I think they are a little over the edge and need to chill out a bit. Can your website block other websites that block websites that have games.
Squid Configuration
Submitted by Anonymous visitor on Sat, 2007-02-10 02:00.
Vote!I was installed SQUID 2 Stable 5 version, and Configured it as Child Porxy in hirarchi,but anyway i can not access form pages like gmail login
What can I do..?
Nipuna Perera
http://nipunap.blogspot.com
I was tried never_redirect
Submitted by Anonymous visitor on Tue, 2007-03-06 06:33.
Vote!I was tried
never_redirect ALL
It was worked
Another Blocking software
Submitted by Anonymous visitor on Wed, 2007-02-21 04:16.
Vote!You may try Dansguardian its pretty more easy to configure.
Here is a way around
Submitted by Anonymous visitor on Mon, 2007-03-05 03:27.
Vote!You can always try a site like: bypass.thezerogroup.com
I use it to get to myspace while at work
I WANT A PARTICULAR SITE BLOCK IN INTERNET EXPLORER
Submitted by AKASH PANCHAL (not verified) on Thu, 2007-05-17 01:57.
Vote!DEAR SIR ,
I WANT A PARTICULAR SITE BLOCK IN INTERNET EXPLORER ,ITS
POSSIBLE, HOW?
PLS REPLAY,AS SOON AS POSSIBLE
I WAIT YOUR SUGGESTION
blocking spcific sites
Submitted by MRS G (not verified) on Sun, 2007-07-08 12:21.
Vote!I WANT A PARTICULAR SITE BLOCK IN INTERNET EXPLORER ,ITS
POSSIBLE? IF SO, HOW?
squid Blocking All urls else allow some
Submitted by BMW20000 (not verified) on Sat, 2007-07-14 11:18.
Vote!dear
anyone can help how we can block all urls else some specific sites allow to visit them
Thanks
Using a whitelist (Blocking all but a few URLs)
Submitted by Roy Penfold (not verified) on Thu, 2007-09-27 15:47.
Vote!Create the access list (whitelist) as normal, then for your rule line use http_access deny !whitelist
This will deny access to any site that isnt on the whitelist.
Block pages
Submitted by Cesar D. Rodas (not verified) on Tue, 2007-10-02 20:16.
Vote!Is there a way to block pages but read the rules from a database?
I was reading something about squid helpers to do that... right? I basically I need to build an program for add and remove the access to some pages using squid and squidguard.
It is not mandatory to block to a group of users but if there is a way, this will be cool if there is not it is ok.
Thanks...
How
Submitted by The real Proxy (not verified) on Wed, 2007-10-03 03:47.
Vote!hello can i ask how to block proxy sites? is there an easy way?
softwares 4 stricted web sites
Submitted by Kamran (not verified) on Sat, 2007-11-03 11:05.
Vote!i need to open stricted web site in saudia arabia
The suggesion failed
Submitted by Anonymous visitor (not verified) on Sun, 2007-11-04 11:56.
Vote!I have tried fut failed to restrict orkut.com.........
can any one suggest me anything more other than that????????