[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [K12OSN] WEB ON/OFF Control over web access to terminals

I also have this from a while ago.  Never used it myself, but it is a 
squidguard control web page.

>From scott hancock k12 mi us Mon Mar 18 22:08:13 2002
Date: Fri, 15 Mar 2002 10:16:43 -0500
From: Scott Sherrill <scott hancock k12 mi us>
To: k12osn redhat com
Subject: Re: [K12OSN] Internet access question

>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
>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 

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.


<title> Switch SquidGuard Configurations </title>
<h1> Switch SquidGuard Configurations </h1><p>
Current configurations:<p>

// PHP Program to choose a squidGuard configuration file from a
// directory of choices.  A form is created with possible configurations
// the new configuration is copied over to replace the current config
// file and squid is restarted.

// The program does not do any checking for permissions to cp files, so it's
// assumed the correct permissions are in place.  There is no password
// protection on this version, until there is anyone can run the program
// and make the change to the config.

// Change the variable $path to reflect the correct location for the install
// of squidGuard.  Currently set to the default /usr/local/squidGuard

// Squid is assumed to be located at /usr/local/bin/squid

// v1.0 Birth -- Scott Sherrill scott hancock k12 mi us 01/30/2001

function find_configs()
// We create a simple form that consists of radio buttons
// and a submit button.  The radio buttons are built by
// dynamically taking a list of files from a prechosen directory
// $path/conf_files.  A single radio button choice is passed back.

global $PHP_SELF;
global $path;

echo "<form target=$PHP_SELF METHOD=POST>";
exec ("ls $path/conf_files",$dir);
while (list ($key, $val) = each ($dir))
	echo "$key => $val <br>";
	echo "<input type=radio name=config value=\"$val\"> $val <br>";
echo "
<input type=hidden name=stage value=chose>
<input type=submit>";

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<br>";
$result = exec ("cp $path/conf_files/$config $path/squidGuard.conf");
echo "$result <br>";
echo "Restarting squid.....<br>";
$result2 = exec ("/usr/local/bin/squid -k reconfigure");
echo "$result2<br>";

$path = "/usr/local/squidGuard";
if (empty($stage)) {find_configs();}

Created by Scott Sherrill, <a 
href=http://www.hancock.k12.mi.us>Hancock Public Schools </a>

K12OSN mailing list
K12OSN redhat com
For more info see <http://www.k12os.org>

Jim Wildman, CISSP                                      jim rossberry com

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]