Saturday, March 20, 2010

Block anything based on url keywords by squid proxy

Hai guys/gals,
Here i going to tell about block any sites based on keywords squid proxy.
This help for system administrators in schools and colleges
Here i use linux sever( RHEL5 ) and squid 2.6 stable version.
It simple to do,
Step 1 : Just store what all are key words you want to block
Here i stored keywords in "/etc/squid/badkeys"
Step 2 : Using vim , open squid configuration file
Ex. vim /etc/squid/squid.conf
Step 3 : Use url_regex to block, (Just add following line in acl )
acl badkey url_regex "/etc/squid/badkey"
Ex:
#Recommended minimum configuration:
acl all src 0.0.0.0/0.0.0.0
acl your_network_name src 10.1.1.0/24
acl badkey url_regex "/etc/squid/badkey"
Step 4 : Add following line for deny badkey in http_access
http_access deny badkey
Ex:
http_access allow localhost
http_access deny badkey
http_access allow your_network_name
http_access deny all

Step 5 :That's all. Restart Squid




No comments: