Hai,
I hope this will help you.
#####################################################
### SDQuota ###
### Steps to Configure Quota restriction in squid ###
#####################################################
1. Downlaod tarballs from the followin site.
http://sdquota.grumbler.org
( note: ==> copy to file to "/opt" folder.
)
2. Unpack the tarball where you want to install & configure SDQuota.
example :
location : /opt/sdquota
commands :
#mkdir /opt/sdquota
#tar -zxvf /opt/squidquota-0.13.sd.tgz -C /opt/sdquota
#chown -R squid:squid /opt/sdquota/squidquota
3. Edit the files in the directory to configure SDQuota.
example :
In Centos x86_64 follow the steps.
#cd /opt/sdquota/squidquota
**********************
#vim Makefile
chown -R :apache $(DB_DIR)
:wq
( note : ==> change the group name from "www" to "apache".
)
#make
**********************
#vim sdquota_auth.pl
$ncsa_auth = "/usr/lib64/squid/ncsa_auth"; # BASIC authentification agent
:wq
#htpasswd -c /etc/squid/passwd <testuser>
#/opt/sdquota/squidquota/sdsetquota <testuser> <size in bytes>
( note: ==> Initially set the value to valid byte no. other than 0.
==> If you want the user unlimited access use keyword "unlimited" in size.
)
#echo testuser <password> | /opt/sdquota/squidquota/sdquota_auth.pl /etc/squid/passwd
( note: ==> Above command should return "OK" if your authentication success.)
**********************
#vim sdq_redirector
my $redirecturl = 'http://proxy/quotaexceeded.html'; # URL to redirect
:wq
( note: ==> Change the http url.
==> Create the file "quotaexceeded.html" in httpd service root directory.
)
**********************
#vim procjnl.pl
/opt/sdquota/squidquota/1aday.pl `/usr/bin/dirname $userdir`
:wq
( note: ==> Change the default path to the current path of "1aday.pl".)
#cd /etc/cron.daily
#vim squidquota
/opt/sdquota/squidquota/procjnl.sh
:wq
( note: ==> The above crontab entry will reset quota details daily.
==> If you want to clear the quota mannually call the peral script.
)
**********************
#vim parseuser.pl
$squidlog = "/var/log/squid/access.log";
:wq
( note : ==> Change the default path to the current path of "access.log" file.)
4. Start the real time squid log file parser.
#tail -n1 -F /var/log/squid/access.log | /opt/sdquota/squidquota/rtparse.pl &
#vim /etc/rc.d/rc.local
tail -n1 -F /var/log/squid/access.log | /opt/sdquota/squidquota/rtparse.pl &
:wq
5.Configure squid to use the SDQuota.
**********************
#vim /etc/squid/squid.conf
auth_param basic program /opt/sdquota/squidquota/sdquota_auth.pl /etc/squid/passwd
acl authenticate proxy_auth REQUIRED
http_access allow authenticate
redirect_program /opt/sdquota/squidquota/sdq_redirector
:wq
#service squid reload