LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-20-2011, 12:57 AM   #1
craja_1979
LQ Newbie
 
Registered: Jan 2011
Posts: 7

Rep: Reputation: 1
Squid with Quota on Centos


Dear LQ friends,

I want to implement squid with quota restriction based on username.

Please help me.

Yours
C.Raja
 
Old 01-20-2011, 01:14 AM   #2
craja_1979
LQ Newbie
 
Registered: Jan 2011
Posts: 7

Original Poster
Rep: Reputation: 1
Squid with Quota

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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Implement Quota in Squid ba$h Linux - Server 3 09-26-2013 06:50 AM
how to enable quota on centos Md.Abul Quashem Linux - Server 1 05-30-2010 06:47 AM
Users can't get own quota information - CentOS 5 sgb Linux - Server 3 01-13-2009 06:00 AM
centOS 4.4 user quota not working ! jimmyjiang Red Hat 0 05-11-2007 02:57 PM
Quota error - CentOS 4.4 Heinz09 Linux - Server 2 05-10-2007 07:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration