Dear squidguard users group,
If anyone else is using any of the prebuilt cgi's to display the "access
denied" messages to the client are you also using this to email a report to
yourselves?
Situation has it I've modified a script a little bit and I've added this
section near the end. (forgive the pi$$ poor perl, just started learning this)
###Begin my e-mail script
use CGI;
use Time::Local;
my $sendmail = "/usr/sbin/sendmail";
my $mail_body= "";
my $realtime;
my @dayofweek = (qw(Sunday Monday Tuesday Wednesday Thursday Friday
Saturday));
my @monthnames = (qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec));
$realtime = timegm($sec,$min,$hour,$mday,$mon,$year,$wday,$yday);
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = localtime($realtime);
$year += 1900;
$mail_body = "The Client at $clientaddr attempted to access $url at
$hour:$min:$sec UTC, $dayofweek[$wday] $mday $monthnames[$mon] $year\n";
# send the email message
$query = new CGI;
open(MAIL, "|$sendmail -oi -t") or die "Can't open pipe to $sendmail: $!\n";
print MAIL "To: myname\@mysite.com\n";
print MAIL "From: Squid Guard\n";
print MAIL "Subject: Blocked Sites\n\n";
print MAIL "$mail_body";
close(MAIL) or die "Can't close pipe to $sendmail: $!\n";
###End my e-mail script
exit 0;
This effectively sends me an email that says "The Client at xxx.xxx.xxx.xxx
attempted to access http://ncmail.netscape.com/rlogin.adp?sn at 17:52:53 UTC,
Friday 8 Mar 2002"
however I usually get a second email that says "The Client at xxx.xxx.xxx.xxx
attempted to access http://ncmail.netscape.com/blocked.gif at 17:52:53 UTC,
Friday 8 Mar 2002"
which points to the image we've got at the top of the access denied page.
The cgi I modified is the one that starts with this..
#! /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
#
Any help from you perl guru's out there would be a help if it's a script
problem. Otherwise does anyone know if squidguard is trying to rewrite the
url? My first guess was that squidguard was trying to keep the blocked url
in the broswer but display the access denied page from our local site.
Anyway, thanks for any help!
--
Kevin White, Linux+, A+
Computer Support
Town of Collierville, TN