Web Proxy with Squid

17 01 2010

As we already know that web caching servers play a key role inside an organisation. Not only users can surf faster, but also provide a way to trace back surfing traffic logs for future reference. Yeah, it makes administrator tasks easier, too.

My implementation

Squid 2.7 on Debian is my selection.

1. install squid
> apt-get install squid
2.edit squid.conf in /etc/squid
>vi /etc/squid/squid.conf
3. Follow this basic configuration
– change port:
http_port 3128
– remove comment icp_port
icp_port 3130
– Increase cache memory by dividing RAM capacity by 2
cache_mem 256
– Increase cache directory
cache_dir ufs /var/spool/squid 5000 16 256
– remove comment on squid log
cache_log /var/log/squid/cache.log
cache_store_log /var/log/squid/squid.log
pid_filename pid_filename /var/run/squid.pid

4. edit client netmask
5. add ACL list
acl myNetwork
http_access allow myNetwork

6. create swap directory
> squid -z
7. Enable squid configuration
> squid -k reconfigure /etc/squid/squid.conf
> /etc/init.d/squid restart

After setting squid proxy server, set web browser proxy connection to the one we have implemented. To watch incoming connection just view access.log
> tail -f /var/log/squid/access.log

Block black list

To block some black list, just add more ACL

#Block website by Domain name & IP address
>acl blockList dstdomain -r src "/etc/squid/blocklist1.txt"

#Block keywords

>acl blockRegex url_regex -r src "/etc/squid/blocklist2.txt"
>http_access deny blockList
>http_access deny blockRegex

Read the rest of this entry »