Re: [K12OSN] Internet access question

Scott Sherrill scott@hancock.k12.mi.us
Fri, 15 Mar 2002 10:16:43 -0500


>We use squid/squidGuard on Linux at our high school for Internet access.  We
>have had requests from a couple of teachers that, at their discretion, they
>would like to disable Internet access for all PC's in the computer lab
>during their class time.  Suggestions for how to do this would be really
>appreciated.
>
>Right now the teachers do not have userid's on the squid PC.  They do have
>Samba access to another Linux server on the same LAN.



Here's a program I wrote awhile ago that lets you switch between 
squidguard configurations remotely from any web browser.  I wrote it 
one snow day for a guy in Australia and it's a snow day again today 
:-) It isn't robust for multiple simultaneous requests, so consider 
it a starting point.

The code is written in php so you will need to have php installed on 
your squid/web server.  I know the code is correct php v4 code, but I 
don't know if it will work under v3.  I would make the assumption but 
without testing it.....

Also, I didn't do any checking *if* the program could restart squid, 
it just assumes it can, so permissions on squid and your config files 
will need to reflect that. 

Finally there is no password system on here yet, limit access to the 
system through apache for teacher terminals or some other login 
method.

The script will allow you to add/remove files from your conf_files 
directory without altering the program.  The conf-files directory 
then have squidquard.conf files that have rules stating High School 
lab deactivated, High School lab activated etc.   The problem comes 
in if you have multiple teachers wanting to change rules for the same 
hour.  The script isn't that clever and was designed for one lab 
on/off.  It could be expanded at some point I suppose.

Hope it helps.

Scott

 Switch SquidGuard Configurations 

Switch SquidGuard Configurations

Current configurations:

"; exec ("ls $path/conf_files",$dir); while (list ($key, $val) = each ($dir)) { echo "$key => $val
"; echo " $val
"; } echo " "; } function pick_configs($config) // Since we have chosen the config file already we copy over the desired // config file, and restart squid. { global $PHP_SELF; global $path; echo "Switching to configuration..... $config
"; $result = exec ("cp $path/conf_files/$config $path/squidGuard.conf"); echo "$result
"; echo "Restarting squid.....
"; $result2 = exec ("/usr/local/bin/squid -k reconfigure"); echo "$result2
"; } $path = "/usr/local/squidGuard"; if (empty($stage)) {find_configs();} else { pick_configs($config); } ?>

Created by Scott Sherrill, Hancock Public Schools _______________________________________________ K12OSN mailing list K12OSN@redhat.com https://listman.redhat.com/mailman/listinfo/k12osn For more info see