Re: [squid-users] fyi

From: 'Simon White' <simon@dont-contact.us>
Date: Thu, 14 Mar 2002 12:23:09 +0000

14-Mar-02 at 11:32, Van Bossche Koen (Koen.VanBossche@KONE.com) wrote :
> I already use a blocking list (txt file) within squid which could be used. I
> am not really a developer or perl guru, but I will try to find some time
> (problem of many I expect) and try it myself.

I have cooked up something rather quickly. It's not particularly neat or
impressive, but it does the job. I am not going to improve it unless there is
significant interest, but I can think of loads of ways it can be made
significantly better, so encourage me :-).

The attached perl file will ask for a site to be input for blocking. When you
hit go it is simply concatenated to the end of the block list file, and then
the current file is echoed to the web browser.

Instructions:
- The block file is set on line 4. It has to be read/writable by the same user
as the web server (nobody, if you're running stock apache) which would
probably best run on the squid machine. You should not need to change anything
else in the code.
- It requires cgi-lib.pl, which may be available on your machine already.
cgi-lib handles HTML Form input parsing, header generation, etc. Get a recent
version from http://cgi-lib.berkeley.edu/
- Copy the script to your cgi-bin directory, mark it as executable by the web
server user (nobody, if you're running stock apache), and go for it!

I accept no responsibility for what this script may do, if you don't dig what
is going on then don't install it on a production machine.

Please don't flame my PERL style, this is a rapid homecooked piece of script
which is meant more to "show the way" than provide a functional utility.
However, constructive criticism most welcome, along with additions and
corrections. After all, this is 31 lines of code, not a masterpiece.

-- 
John Lennon:--v [Simon White. vim/mutt/Linux. simon@mtds.com. GIMPS: 39.78%] 
Sometimes we sit and read other people's interpretations of our lyrics
and think, 'Hey, that's pretty good.' If we liked it, we would keep our
mouths shut and just accept the credit as if it was what we meant all along.

Received on Thu Mar 14 2002 - 05:23:11 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 17:06:56 MST