Time Restriction using "SQUID"

Taking care of your Linux box.
Post Reply
Learner
Lance Naik
Posts: 41
Joined: Wed Nov 08, 2006 2:40 am

Time Restriction using "SQUID"

Post by Learner »

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
lambda
Major General
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Location: Lahore
Contact:

Post by lambda »

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"?
Learner
Lance Naik
Posts: 41
Joined: Wed Nov 08, 2006 2:40 am

Post by Learner »

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
lambda
Major General
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Location: Lahore
Contact:

Post by lambda »

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"?
Post Reply