####################################################################################################
# PROXYBURNER DOCUMENTATION										
# Copyright Psybercore.com, Inc.								info@superscripts.com                 
####################################################################################################
# COPYRIGHT NOTICE                                                           
# Copyright Psybercore.com, Inc. - All Rights Reserved.                    
# http://www.superscripts.com                                                                                                          
# Selling the code for this program without prior written consent is         
# expressly forbidden.                                                                                                        
# Obtain written permission before redistributing this software over the Internet or 
# in any other medium.  In all cases copyright and header must remain intact.
#
# My name is drew star... and i am funky... http://www.drewstar.com/
#
#####################################################################################################
# SERVER CONFIGURATION FOR SCRIPT
#####################################################################################################

SETUP PARALLEL ACCESS LOG FOR PROXYBURNER.CGI TO SCAN WITHOUT DISRUPTING YOUR NORMAL ACCESS LOGS
THIS CAN ONLY BE DONE BY ROOT OR WHOEVER HAS ACCESS TO APACHE'S httpd.conf file.  Here is an example
of the httpd.conf settings for a domain running multiple logs.  Proxyburner requires an ACCESS LOG
to run but will also work with most other log styles.

IMPORTANT - The special logfile you setup for proxyburner MUST have permissions set to 666 or 777 so
the script can scan it fast without any noticable server load.

EXAMPLE OF A DOMAIN USING THREE DIFFERENT LOGS AT THE SAME TIME httpd.conf

<VirtualHost 202.22.109.134>
ServerAdmin webmaster@yourdomain.com
DocumentRoot /full/path/to/yourdomain.com/htdocs/
ServerName yourdomain.com
ServerAlias www.yourdomain.com
ScriptAlias /cgi-bin/ /full/path/to/your/cgi-bin/
ErrorLog /full/path/to/your/logs/error_log
CustomLog /full/path/to/your/logs/combined_log combined
TransferLog /full/path/to/your/logs/proxyburner_access_scanlog
</VirtualHost>

After setting up httpd.conf and the cgi script you will want to setup a crontab file to execute
proxyburner.cgi once per minute (recommended interval).  An example crontab file is included in
the tarball called crontab.example
#####################################################################################################
# SCRIPT CONFIGURATION
#####################################################################################################

EDIT PROXYBURNER.CGI
FIRST SET PATH TO PERL at line one of script proxyburner.cgi

Create a directory inside your cgi-bin called "proxyburner" and upload ALL the files into this folder.
You should probably also use this folder to store your "proxyburner_access_scanlog"
FIND THE "USER CONFIGURATION AREA INSIDE PROXYBURNER.CGI AND EDIT VARIABLES AS DESCRIBED BELOW:

$proxyscanlog = "/full/path/to/cgi-bin/proxyburner/proxyburner_access_scanlog";
$networkblockfile = "/full/path/to/cgi-bin/proxyburner/proxyburner.blocked";
$htaccess = "/full/path/to/root/html/.htaccess";
$scriptlog = "/full/path/to/cgi-bin/proxyburner/proxyburner.log";
$resetlogperscan = "yes";
$updatehtaccessperscan = "yes";

$proxyscanlog set to the FULL PATH to the PARALLEL ACCESS LOG USED FOR THIS SCRIPT

$networkblockfile set to the /full/path/to/cgi-bin/proxyburner/proxyburner.blocked
$htaccess set to the "/full/path/to/root/html/.htaccess
$scriptlog set to the "/full/path/to/cgi-bin/proxyburner/proxyburner.log

$resetlogperscan = "yes"; (set to "no" if you do NOT want the "proxyburner_access_scanlog" reset to 0K
	every minute (NOT RECOMMENDED)
$updatehtaccessperscan = "yes";  (set to "no" if you do NOT want your root .htaccess file updated in realtime
	every minute (NOT RECOMMENDED)

NOTE ABOUT THE .htaccess file - NO THIS IS NOT THE SAME .htaccess file you use for your MEMBERS AREA or PASSWORD
PROTECTION.  THIS IS A SEPERATE .htaccess file that will control access to the ENTIRE WEBSITE.  IT GOES INSIDE
THE ROOT HTML DIRECTORY SO IT WILL BLOCK EVERYTHING FROM ANYONE ON THE proxyburner.blocked NETWORK ADDRESS LIST.
If you already have an .htaccess file in that location you may need to modify the subroutine below so the .htaccess
rebuild is correct.

sub updatehtaccess{
print "UPDATING HTACCESS\n";
	open (NETWORKBLOCKFILE, "$networkblockfile");
	flock(NETWORKBLOCKFILE, 2);
	@updatednetworkblocklist=<NETWORKBLOCKFILE>;
	flock(NETWORKBLOCKFILE, 8);
	close NETWORKBLOCKFILE;
	open (HTACCESS, ">$htaccess");
	flock(HTACCESS, 2);
	print HTACCESS "ErrorDocument 404 http://www.superscripts.com/\n";
	print HTACCESS "AuthUserFile /dev/null\n";
	print HTACCESS "AuthGroupFile /dev/null\n";
	print HTACCESS "AuthName BANNED\n";
	print HTACCESS "<Limit GET>\n";
	print HTACCESS "order allow,deny\n";
	print HTACCESS "allow from all\n";
	foreach $updatednetworkblocklist(@updatednetworkblocklist)  {
		chomp $updatednetworkblocklist;
		print "$updatednetworkblocklist\n";
		print HTACCESS "deny from $updatednetworkblocklist\n";
		}
	print HTACCESS "</Limit>\n";
flock(HTACCESS, 8);
close HTACCESS;
}

Otherwise set $updatehtaccessperscan = "no";

############################################################
#  FINISHING
############################################################
Make sure your proxyburner_access_scanlog is running (apache must be rebooted)
Chmod proxyburner.cgi to 755
Chmod all the other files to 666 or 777
Upload your crontab file and execute it
Watch by ftp the size of the proxyburner_access_scanlog and make sure it is being reset to 0K every minute
	If it is being reset check your .htaccess file and make sure it looks right and also check the proxyburner.blocked
	file to make sure nothing wierd is being done to it either!

Finally to test the script you can manually upload a fake proxyburner_access_scanlog with a line like the one below

2.3.4.5.6.7.8 - - [21/Jun/2002:22:14:04 -0500] "GET / HTTP/1.1" 200 22602

OBVIOUSLY 2.3.4.5.6.7.8 is a BOGUS IP address so after the script runs you should see 2.3.4.5.6.7.8 added to the
proxyburner.blocked file, the .htaccess file, and the proxyburner.log file.

If you run into trouble with anyone particular you can always review the proxyburner.log file to see when they were
blocked and see if perhaps there are network connectivity problems with this person.  MOST LIKELY THIS NEVER HAPPENS.
Don't get scammed!

############################################################
#  ALL DONE
############################################################

Now the script will be screening your visitors every minute.  Anyone caught surfing your site from a bogus network
will be "gone in 60 seconds" or less.  They will probably get themselves a new IP and try coming back but soon will
realize it is futile and will go somewhere else where the security is weak.

ENJOY!