How to Make The Blocked Page Work in A squidGuard
I have downloaded the following script file from the net but as I am new to linux I dont know how to make it run. At present I am displaying a static page whenever someone visits a restricted site.
I want to display more details when displaying a blocked page.
I need to know how to run this script and what more changes I have to do in this script to make it run.
A step by step instruction will be very helpful to me
Thanks in advance.
#! /usr/bin/perl
#
# Sample CGI to explain to the user that the URL is blocked and by which rule set
#
# By Pål Baltzersen 1998
#
require '/var/ipcop/header.pl';
$QUERY_STRING = $ENV{'QUERY_STRING'};
$DOCUMENT_ROOT = $ENV{'DOCUMENT_ROOT'};
$clientaddr = "";
$clientname = "";
$clientident = "";
$srcclass = "";
$targetclass = "";
$url = "";
$time = time;
@day = ("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
@month = ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
$swroot = '/var/ipcop';
my %netsettings;
my %proxysettings;
&readhash("${swroot}/ethernet/settings", \%netsettings);
$netsettings = {'GREEN_ADDRESS'};
&readhash("${swroot}/proxy/sgsettings", \%proxysettings);
$proxysettings{'ADMIN_NAME'};
while ($QUERY_STRING =~ /^\&?([^&=]+)=([^&=]*)(.*)/) {
$key = $1;
$value = $2;
$QUERY_STRING = $3;
if ($key =~ /^(clientaddr|clientname|clientident|srcclass|targetclass|url)$/) {
eval "\$$key = \$value";
}
if ($QUERY_STRING =~ /^url=(.*)/) {
$url = $1;
$QUERY_STRING = "";
}
}
{
print "Content-type: text/html\n";
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime($time);
printf "Expires: %s, %02d-%s-%02d %02d:%02d:%02d GMT\n\n", $day[$wday],$mday,$month[$mon],$year,$hour,$min,$sec;
print "<HTML>\n\n <HEAD>\n <TITLE>302 Access denied</TITLE>\n </HEAD>\n\n";
print " <BODY BGCOLOR=\"#FFFFFF\">\n";
print " <P ALIGN=CENTER>\n";
print " <IMG SRC=\"http://$netsettings{'GREEN_ADDRESS'}:81/images/title.gif\"\n";
print " BORDER=0></A> </P>\n";
print " <H1 ALIGN=CENTER>Access to the page:</H1>\n";
print " <TABLE BORDER=0 ALIGN=CENTER>\n";
print " <TR><TH ALIGN=CENTER>$url\n";
print " <TR><TH ALIGN=CENTER>... has been denied for the following reason:\n";
print " <TR><TH ALIGN=CENTER>$targetclass\n";
print " </TABLE>\n";
print " <table border=1 TH ALIGN=CENTER bgcolor='#FFEE00'>\n";
print " <tr><td>You are seeing this error because the page you attempted<br>\n";
print " to access contains, or is labled as containing, material that<br>\n";
print " has been deemed inappropriate.</td></tr>\n";
print " </TABLE>\n\n";
print " <P ALIGN=CENTER>If this is wrong, contact your<BR>\n";
print " <A HREF=mailto:$proxysettings{'ADMIN_NAME'}>Network Administrator</A><P>\n\n";
print " <P ALIGN=CENTER>This site Protected by:<BR>\n";
print " <A HREF=\"http://www.squidguard.org/\"><P ALIGN=CENTER>SquidGuard<BR>\n";
print " <IMG SRC=\"http://$netsettings{'GREEN_ADDRESS'}:81/images/squidGuard.gif\"\n";
print " </P>\n\n";
print " </BODY>\n\n</HTML>\n";
}
exit 0;
Last edited by vineetcornelius; 02-27-2013 at 11:09 PM.
|