Posts Tagged ‘proxy setup’

Time limit with squid

2012/01/05

I have nice kids, that love Internet. Sometimes a bit too much too our state, and with my wife we decided that after a certain hour during the week, it was wise to shutdown the Web access for the kids’ machines so they could start thinking sleeping 😉

As I have a transparent proxy setup, I looked at how to do that with Squid 2.5 (old I know !) and used google to find examples.

The ones I found first turned out to be wrong in their explanations and the squid doc lacks of an example here.

Especially, the names of days should NOT be separated by spaces. Instead you rather need to use other examples which give good advises, and also explain the constraints on the hours.

So I came up with this configuration:

#Time
acl bfore_time time SMTWH 00:00-06:00
acl after_week time SMTWH 22:30-24:00
acl after_wend time FS 23:30-24:00
#Kids
#acl punition src 192.168.x.y/32
acl kids src 192.168.x.y1/32 192.168.x.y2/32 192.168.x.y3/32
#http_access deny punition
http_access deny kids bfore_time
http_access deny kids after_week
http_access deny kids after_wend

That way they are restricted to using the Web between 10:30PM and 6:00AM during the week, and later (11:30PM) the week-end. And I can ban one easily in case of punishment 😉

Of course, that’s not a completely blocked context, as they can use our machines, or try to change the IP address (but they aren’t root and dn’t know that yet – but could learned which would be great !!). But it’s a kind reminder when it’s becoming late.

ACLs in Squid are very powerfull, and combined with Squiguard, you can also activate parental control if you want.

Advertisements