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

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 
Don't miss out on the other pages!
1234567next ›last »

Write a full post in response to this!

0

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.

admin's picture

Proxy

Submitted by admin on Wed, 2006-03-29 11:28.

Vote!
0

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.

Anonymous visitor's picture

Squid.

Submitted by Anonymous visitor on Tue, 2006-10-03 17:56.

Vote!
0

I have doen exactly that and nothing seeems to be blocked. What now?

Anonymous visitor's picture

blocking

Submitted by Anonymous visitor on Tue, 2006-11-28 20:24.

Vote!
0

i would like to block all of zangys my space.com and all of the other ones

Anonymous visitor's picture

i need help

Submitted by Anonymous visitor on Wed, 2007-01-03 14:09.

Vote!
0

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.

Anonymous visitor's picture

Squid Configuration

Submitted by Anonymous visitor on Sat, 2007-02-10 02:00.

Vote!
0

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

Anonymous visitor's picture

I was tried never_redirect

Submitted by Anonymous visitor on Tue, 2007-03-06 06:33.

Vote!
0

I was tried

never_redirect ALL

It was worked

Anonymous visitor's picture

Another Blocking software

Submitted by Anonymous visitor on Wed, 2007-02-21 04:16.

Vote!
0

You may try Dansguardian its pretty more easy to configure.

Anonymous visitor's picture

Here is a way around

Submitted by Anonymous visitor on Mon, 2007-03-05 03:27.

Vote!
0

You can always try a site like: bypass.thezerogroup.com
I use it to get to myspace while at work

AKASH PANCHAL's picture

I WANT A PARTICULAR SITE BLOCK IN INTERNET EXPLORER

Submitted by AKASH PANCHAL (not verified) on Thu, 2007-05-17 01:57.

Vote!
0

DEAR SIR ,

I WANT A PARTICULAR SITE BLOCK IN INTERNET EXPLORER ,ITS
POSSIBLE, HOW?

PLS REPLAY,AS SOON AS POSSIBLE

I WAIT YOUR SUGGESTION

MRS G's picture

blocking spcific sites

Submitted by MRS G (not verified) on Sun, 2007-07-08 12:21.

Vote!
0

I WANT A PARTICULAR SITE BLOCK IN INTERNET EXPLORER ,ITS
POSSIBLE? IF SO, HOW?

BMW20000's picture

squid Blocking All urls else allow some

Submitted by BMW20000 (not verified) on Sat, 2007-07-14 11:18.

Vote!
0

dear
anyone can help how we can block all urls else some specific sites allow to visit them

Thanks

Roy Penfold's picture

Using a whitelist (Blocking all but a few URLs)

Submitted by Roy Penfold (not verified) on Thu, 2007-09-27 15:47.

Vote!
0

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.

Cesar D. Rodas's picture

Block pages

Submitted by Cesar D. Rodas (not verified) on Tue, 2007-10-02 20:16.

Vote!
0

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

The real Proxy's picture

How

Submitted by The real Proxy (not verified) on Wed, 2007-10-03 03:47.

Vote!
0

hello can i ask how to block proxy sites? is there an easy way?

Kamran's picture

softwares 4 stricted web sites

Submitted by Kamran (not verified) on Sat, 2007-11-03 11:05.

Vote!
0

i need to open stricted web site in saudia arabia

Anonymous visitor's picture

The suggesion failed

Submitted by Anonymous visitor (not verified) on Sun, 2007-11-04 11:56.

Vote!
0

I have tried fut failed to restrict orkut.com.........

can any one suggest me anything more other than that????????



CariNet: Cloud computing is a reality.