Squid+DansGuardian (DG)+Squish

See my earlier post, on methods to limit users through proxy server.

Since I have found nothing (free) newer than Squish, for limiting total amount of data for users (per IP or username) for a defined amount of time, and use for something like that is nearing, I have decided to try it.

Links : link1, link2
What have I done :
1. Needed startup conditions
Squid (up and configured)
Apache (for CGI part)
Perl-GD (and yes, GD letters are upper case!)
2. # wget http://www.ledge.co.za/software/squint/squish/squish-0.0.18.tar.gz
3. # tar xvfz squish-0.0.18.tar.gz
4. Installation
# make install
mkdir -p /usr/local/squish
install squish.pl squish.cron.sh squish.cgi squish.pm rrdsquish.pm apache-squish.conf /usr/local/squish
install squish.conf /etc/squid/
# Installing…
/usr/local/squish/squish.pl –install
readline() on closed filehandle CONF at /usr/local/squish/squish.pl line 230.
Writing to
print() on closed filehandle CONF at /usr/local/squish/squish.pl line 242.
Writing to /etc/squid/squid.conf
Writing to /usr/local/squish/apache-squish.conf
Checking /etc/crontab
Modified /etc/crontab
touch /etc/squid/squished
# make init will initialise data
Take care, installation will add some lines into Squid configuration file, and it will stop working. So hash those lines for start, and we will see them later on.
5. The rest of the installation
# cd /usr/local/squish/
# ./squish.pl –install
readline() on closed filehandle CONF at ./squish.pl line 230.
Writing to
print() on closed filehandle CONF at ./squish.pl line 242.
Already modified /etc/squid/squid.conf
Writing to ./apache-squish.conf
Checking /etc/crontab
Modified /etc/crontab
6. Configuration
File /etc/squid/squid.conf – from where Squish is enabled.
acl SQUISHLOC dst IP-address-of-proxy-server
acl SQUISHED3 src “/etc/squid/squished”
http_access allow SQUISHLOC
http_access deny SQUISHED3
File /etc/squid/squish.conf is a place where lists of client IP addresses are written, along with the limitations.
The simplest way is to put there only the IPs for which there are limitations, and put as the default that there are no limitations.
10\.10\.10\.143 10Kb/day
Named IP address has a limitation of 10Kb per day.
.* 25h/day
This last line means that that all the IP addresses that are not set up, have no limitations.
File /etc/squid/squished is the list of “bad” IP addresses.
7. How to set up that Squish is called up every 5min to check up the IP address activity.
Put in a crontab the following :
5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/local/squish/squish.cron.sh
8. How to set up Apache to show how “bad”each IP address has been :
In /etc/httpd/conf/httpd.conf, at the end of the file, add :
Alias /squish “/var/www/squish”

Options +ExecCGI
AddHandler cgi-script .cgi
DirectoryIndex squish.cgi
AllowOverride None
Order allow,deny
Allow from all

And all the files from folder /usr/local/squish/ (except apache-squish.conf) copy in folder /var/www/squish. (This assumes that DosumentRoot of Apache is in /var/www).
Restart Apache.
In location http://IP-address-of-proxy-server/squish you will get the list of IPs that use this proxy server, and how many resources are they using.

Napomena 1 : posle svake izmene u squish.conf restartovati ili reload-ovati squid.
Napomena 2 : iz misterioznih razloga squish.log se nalazi u root-u : /squish.log

This entry was posted in Linux and tagged , , . Bookmark the permalink.

Comments are closed.