Monday, September 22, 2008

How to Block Web sites using Squid..

Step1:-Open the /etc/squid/squid.conf file in any text editor ,preferably vim as shown below.

[root@localhost ~]#vim /etc/squid/squid.conf

Step2:-Search for the following set of lines to the script:

#Recommended minimum configuration:
………
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
acl internet src 192.168.1.0/255.255.255.0


Step3:-Now, add the following end of these lines to block the sites using acl (acl aclmame dstdomain "filename.squid")

acl badurl dstdomain “/etc/squid/bad-sites.squid”
........
........
Step4:-Search again for the following set of lines to the script:

#Only allow cachemgr access from localhost
http_access allow manager localhost
http_access deny manager


Step4:- Now, add the following end of these lines to deny the particular aclname using http_access (http_access deny aclname)

http_access deny badurl

:wq!

Step5:- Then create a new file /etc/squid/bad-sites.squid. Then enter the block web sites using following format.

[root@localhost ~]#vim /etc/squid/bad-sites.squid


.orkut.com
.youtube.com
:wq!

Step3:-
Restart the squid service

[root@localhost ~]#service squid restart
[root@localhost ~]#chkconfig squid on

No comments: