Time Restriction using "SQUID"

Taking care of your Linux box.

Time Restriction using "SQUID"

Postby Learner » Wed Apr 08, 2009 1:15 pm

AOA

Dear All

I am using squid as a cache server. I want to use time base restriction on users.

Allow time period for different groups is as follow:

12Hrs 0800 - 2000 (08:00 AM - 08:00 PM)
14Hrs 0800 - 2200 (08:00 AM - 10:00 PM)
08Hrs 0830 - 1730 (08:30 AM - 05:30 PM)

Other than this time restriction can block net access.

Please guide.
Thanks & Regards


Muhammad Ali
Learner
Lance Naik
 
Posts: 41
Joined: Wed Nov 08, 2006 2:40 am

Postby lambda » Wed Apr 08, 2009 8:13 pm

squid's configuration file gives you all the information you need to set those acls. all you have to do is create the acls as

Code: Select all

acl twelvehour ...
acl fourteenhour ...
acl eighthour ...

http_access allow group1 twelvehour
http_access allow group2 fourteenhour
http_access allow group3 eighthour

http_access deny all # default, already in your config file
Watch out for the Manners Taliban!
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?
lambda
Major General
 
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Website: http://www.hungry.com/~fn/
Location: Lahore

Postby Learner » Sat Apr 11, 2009 11:24 am

Dear Lambda

I am still confused, I have put this in my squid.conf file. I have set the time period

acl off_hrs8 src 1.2.3.4
acl off_hrs14 src 1.2.3.5
acl off_hrs12 src 1.2.3.6

acl hrs8 time MTWHFA 08:30-17:30
acl hrs14 time MTWHFA 08:00-22:00
acl hrs12 time MTWHFA 08:00-20:00

http_access allow hrs8 off_hrs8
http_access allow hrs14 off_hrs14
http_access allow hrs12 off_hrs12
http_access allow off_hrs8
http_access allow off_hrs14
http_access allow off_hrs12
http_access deny all

it not working

Please guide, I just want that browsing should be only available with in this time period.
Thanks & Regards





Muhammad Ali
Learner
Lance Naik
 
Posts: 41
Joined: Wed Nov 08, 2006 2:40 am

Postby lambda » Sat Apr 11, 2009 2:43 pm

Code: Select all

acl off_hrs8 src 1.2.3.4
okay, an acl that matches the 1.2.3.4 ip.

Code: Select all

acl hrs8 time MTWHFA 08:30-17:30
okay, an acl that matches 8:30am to 5:30pm, six days a week.

Code: Select all

http_access allow hrs8 off_hrs8
a rule that specifies that 1.2.3.4 is allowed between 8:30am to 5:30pm, six days a week.

Code: Select all

http_access allow off_hrs8
a rule that specifies that 1.2.3.4 is allowed at any time.

are your surprised that it doesn't work?

take the time to think. in the end, who's responsible for thinking for you? who's responsible for doing your job, but you? in your original post, you wrote
Other than this time restriction can block net access.
why, then, do you have the "http_access allow off_hrs8" allow rule?

try to understand what you're doing instead of blindly writing rules and hoping (praying) that it'll work. computers are not magic. learn the rules, and follow them.
Watch out for the Manners Taliban!
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?
lambda
Major General
 
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Website: http://www.hungry.com/~fn/
Location: Lahore


Return to “%s” Administration

Who is online

Users browsing this forum: No registered users and 0 guests

cron