Carrying on from my pants way I installed lightsquid.
I created a little script as I am running this once a minute. You will have to see what hit this takes
Just will not let it run until its finished
sudo crontab -e
*/1 * * * * /usr/share/lightsquid/run-lightparser
/usr/share/lightsquid/run-lightparser
#!/bin/bash
## envvar set to stop cron repeating before finish and running the script up its own ass
if [ "$LIGHTPARSEISRUNNING" == "" ];
then
echo "`date` LIGHTPARSEISRUNNING=$LIGHTPARSEISRUNNING" >> /var/log/syslog ##Remark command out after all is well
export LIGHTPARSEISRUNNING=TRUE
perl /usr/share/lightsquid/lightparser.pl
export LIGHTPARSEISRUNNING=
fi
I did an
apt-get install lightsquid
, so I don't know how you installed your files might be in different places
anyway that does it stuff I wished it create just the files in total but it makes folders in
/var/lib/lightsquid/reports/YYYYMMDD format
In there you have individual files by ip address .overuser .realname .total
also this made me think does lightsquid keep making these files as /var is going to get full of these psuedo logs
anyway if you change logrotate for squid to a day then these should keep manageable and its up to the sysadmin when to clear.
I know this is a horrid method and I am a dirty horrid hacker but I have totals by the minute via ip
All I need now is to create a conf file in
/etc/lightsquid/limits.conf
that sets limits
Add to my initial script where it compares ip's bandwidth used to the above limits.conf and if over quota put them into a
/etc/lightsquid/restricted.conf
which becomes part of the squids authentication
acl restrictedusers proxy_auth "/etc/lightsquid/restricted.conf"
http_access deny restrictedusers
Then thats it done by ip
Now all I have to do is make some routine to use the last command and match up where users where and thats it done by user.
I will have another go and add later to the dirty horrid hackers guide, I did mean to be at user name stage so I haven't checked about auth by ip