From: ms Date: Thu, 12 Apr 2007 21:55:51 +0000 (+0000) Subject: Calamaris-Proxy-Logdatei-Analyzer eingebaut. X-Git-Tag: v2.3-beta1~759 X-Git-Url: http://git.ipfire.org/?p=people%2Fpmueller%2Fipfire-2.x.git;a=commitdiff_plain;h=069ae085ad8e635055e7e126723e8994a779c722 Calamaris-Proxy-Logdatei-Analyzer eingebaut. git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@498 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8 --- diff --git a/config/calamaris/mkreport b/config/calamaris/mkreport new file mode 100644 index 0000000000..53db9d5715 --- /dev/null +++ b/config/calamaris/mkreport @@ -0,0 +1,122 @@ +#!/usr/bin/perl +# +# This code is distributed under the terms of the GPL +# +# (c) 2005,2006 marco.s +# +# $Id: mkreport.pl,v 2.0 2006/03/12 00:00:00 marco.s Exp $ +# + +use strict; + +use Time::Local; + +my $swroot = "/var/ipfire"; +my $apdir = "$swroot/proxy/calamaris"; +my $squidlogdir = "/var/log/squid"; +my $calamlogdir = "/var/log/calamaris"; +my $reportdir = "$apdir/reports"; + +unless (-e $reportdir) { mkdir($reportdir) } + +my $unique=time; + +my $commandline=''; +my $skip_gzlogs=0; + +my @now = localtime(time); +my $year = $now[5]+1900; + +if (@ARGV[0] eq 'nogz') +{ + $skip_gzlogs=1; + shift(@ARGV); +} + +if (@ARGV < 6) { die "ERROR: Too few arguments\n\n"; } + +my $day_begin=@ARGV[0]; +my $month_begin=@ARGV[1]; +my $year_begin=@ARGV[2]; +my $day_end=@ARGV[3]; +my $month_end=@ARGV[4]; +my $year_end=@ARGV[5]; + +my $i=6; + +while ($i < @ARGV) { $commandline.=" @ARGV[$i++]"; } + +$commandline.=" $calamlogdir/squid-$unique.log >> $reportdir/calamaris-$unique.log"; + +if (&processlogfiles($day_begin,$month_begin,$year_begin,$day_end,$month_end,$year_end) > 0) +{ + system("$apdir/bin/calamaris $commandline"); + system("chown nobody.nobody $reportdir/calamaris-$unique.log"); +} + +if (-e "$calamlogdir/squid-$unique.log") { unlink("$calamlogdir/squid-$unique.log"); } + +# ------------------------------------------------------------------- + +sub processlogfiles +{ + my $filestr=''; + + my $day_from = $_[0]; + my $mon_from = $_[1]; + my $year_from = $_[2]; + my $day_to = $_[3]; + my $mon_to = $_[4]; + my $year_to = $_[5]; + + if (($mon_from =~ /(3|5|8|10)/) && ($day_from > 30)) { $day_from=30 } + if (($mon_to =~ /(3|5|8|10)/) && ($day_to > 30)) { $day_to=30 } + if (($mon_from == 1) && ($day_from > 28)) { if ($year_from%4==0) { $day_from=29 } else { $day_from=28 } } + if (($mon_to == 1) && ($day_to > 28)) { if ($year_to%4==0) { $day_to=29 } else { $day_to=28 } } + + my $date_now = timelocal(0,0,0,$now[3],$now[4],$year); + my $date_from = timelocal(0,0,0,$day_from,$mon_from,$year_from); + my $date_to = timelocal(0,0,0,$day_to,$mon_to,$year_to); + + # if (($date_from > $date_now) || ($date_from > $date_to)) { $year_from-- } + + $day_from = $_[0]; + if (($mon_from =~ /(3|5|8|10)/) && ($day_from > 30)) { $day_from=30 } + if (($mon_from == 1) && ($day_from > 28)) { if ($year_from%4==0) { $day_from=29 } else { $day_from=28 } } + + my $date_from = timelocal(0,0,0,$day_from,$mon_from,$year_from); + my $date_to = timelocal(59,59,23,$day_to,$mon_to,$year_to); + + open (TMPLOG,">>$calamlogdir/squid-$unique.log") or die "ERROR: Cannot write to $calamlogdir/squid-$unique.log\n"; + + unless ($skip_gzlogs) { + foreach $filestr (<$squidlogdir/*.gz>) + { + if ($filestr =~ /access\.log/) { + open (LOG,"gzip -dc $filestr |"); + foreach () { + if (substr($_,0,10) >= $date_from) { if (substr($_,0,10) <= $date_to) { print TMPLOG "$_"; } } + } + close(LOG); + } + } + } + + foreach $filestr (<$squidlogdir/*.log>) + { + if ($filestr =~ /access\.log/) { + open (LOG,$filestr); + foreach () { + if (substr($_,0,10) >= $date_from) { if (substr($_,0,10) <= $date_to) { print TMPLOG "$_"; } } + } + close(LOG); + } + } + + close (TMPLOG); + + return (-s "$calamlogdir/squid-$unique.log"); + +} + +# ------------------------------------------------------------------- diff --git a/config/menu/70-log.menu b/config/menu/70-log.menu index 26c0527f6f..25ba090fc2 100644 --- a/config/menu/70-log.menu +++ b/config/menu/70-log.menu @@ -13,6 +13,11 @@ 'title' => "$Lang::tr{'proxy logs'}", 'enabled' => 1 }; + $sublogs->{'31.calamaris'} = {'caption' => $Lang::tr{'calamaris proxy reports'}, + 'uri' => '/cgi-bin/logs.cgi/calamaris.dat', + 'title' => "$Lang::tr{'calamaris proxy reports'}", + 'enabled' => 1 + }; $sublogs->{'40.firewall'} = {'caption' => $Lang::tr{'firewall logs'}, 'uri' => '/cgi-bin/logs.cgi/firewalllog.dat', 'title' => "$Lang::tr{'firewall logs'}", diff --git a/config/rootfiles/common/apache2 b/config/rootfiles/common/apache2 index c417eebdf9..de77998b0f 100644 --- a/config/rootfiles/common/apache2 +++ b/config/rootfiles/common/apache2 @@ -1285,6 +1285,7 @@ srv/web/ipfire/cgi-bin/index.cgi srv/web/ipfire/cgi-bin/ipinfo.cgi srv/web/ipfire/cgi-bin/iptables.cgi srv/web/ipfire/cgi-bin/logs.cgi +#srv/web/ipfire/cgi-bin/logs.cgi/calamaris.dat #srv/web/ipfire/cgi-bin/logs.cgi/config.dat #srv/web/ipfire/cgi-bin/logs.cgi/firewalllog.dat #srv/web/ipfire/cgi-bin/logs.cgi/firewalllogip.dat diff --git a/config/rootfiles/common/calamaris b/config/rootfiles/common/calamaris new file mode 100644 index 0000000000..4d3a767e7b --- /dev/null +++ b/config/rootfiles/common/calamaris @@ -0,0 +1,2 @@ +var/ipfire/proxy/calamaris/bin/calamaris +var/ipfire/proxy/calamaris/bin/mkreport diff --git a/config/rootfiles/common/stage2 b/config/rootfiles/common/stage2 index d4a6e7f255..41eb65a7d1 100644 --- a/config/rootfiles/common/stage2 +++ b/config/rootfiles/common/stage2 @@ -118,6 +118,7 @@ var/empty var/lock #var/log var/log/btmp +var/log/calamaris var/log/counter var/log/lastlog var/log/wtmp diff --git a/doc/language_issues.de b/doc/language_issues.de index 3b6e96a709..4d198dd37c 100644 --- a/doc/language_issues.de +++ b/doc/language_issues.de @@ -56,6 +56,7 @@ WARNING: translation string unused: bytes per second WARNING: translation string unused: cache management WARNING: translation string unused: cache size WARNING: translation string unused: cached memory +WARNING: translation string unused: calamaris report interval (in minutes) WARNING: translation string unused: cfg restart WARNING: translation string unused: choose config WARNING: translation string unused: clear cache @@ -122,7 +123,6 @@ WARNING: translation string unused: firmware WARNING: translation string unused: force update WARNING: translation string unused: free memory WARNING: translation string unused: free swap -WARNING: translation string unused: from WARNING: translation string unused: gen static key WARNING: translation string unused: generate WARNING: translation string unused: genkey @@ -268,7 +268,6 @@ WARNING: translation string unused: this is not an authorised update WARNING: translation string unused: this update is already installed WARNING: translation string unused: time date manually reset WARNING: translation string unused: title -WARNING: translation string unused: to WARNING: translation string unused: to install an update WARNING: translation string unused: too long 80 char max WARNING: translation string unused: traffic on diff --git a/doc/language_issues.en b/doc/language_issues.en index 833a485ec0..9fab328795 100644 --- a/doc/language_issues.en +++ b/doc/language_issues.en @@ -72,6 +72,7 @@ WARNING: translation string unused: bytes per second WARNING: translation string unused: cache management WARNING: translation string unused: cache size WARNING: translation string unused: cached memory +WARNING: translation string unused: calamaris report interval (in minutes) WARNING: translation string unused: cfg restart WARNING: translation string unused: choose config WARNING: translation string unused: choose media @@ -132,7 +133,6 @@ WARNING: translation string unused: firmware WARNING: translation string unused: force update WARNING: translation string unused: free memory WARNING: translation string unused: free swap -WARNING: translation string unused: from WARNING: translation string unused: g.dtm WARNING: translation string unused: g.lite WARNING: translation string unused: gen static key @@ -275,7 +275,6 @@ WARNING: translation string unused: this is not an authorised update WARNING: translation string unused: this update is already installed WARNING: translation string unused: time date manually reset WARNING: translation string unused: title -WARNING: translation string unused: to WARNING: translation string unused: to install an update WARNING: translation string unused: traffic on WARNING: translation string unused: transfer limits diff --git a/doc/packages-list.txt b/doc/packages-list.txt index f5394eff0c..cfa139ca02 100644 --- a/doc/packages-list.txt +++ b/doc/packages-list.txt @@ -48,6 +48,7 @@ * busybox-1.2.2 * bwm-ng-0.6 * bzip2-1.0.3 +* calamaris-2.59 * capi4k-utils-2005-07-18 * ccache-2.4 * cdrtools-2.01 diff --git a/html/cgi-bin/logs.cgi/calamaris.dat b/html/cgi-bin/logs.cgi/calamaris.dat new file mode 100644 index 0000000000..19a3693999 --- /dev/null +++ b/html/cgi-bin/logs.cgi/calamaris.dat @@ -0,0 +1,558 @@ +#!/usr/bin/perl +# +# This code is distributed under the terms of the GPL +# +# (c) 2005,2006 marco.s +# +# $Id: calamaris.dat,v 2.1 2006/03/12 00:00:00 marco.s Exp $ +# + +use strict; + +# enable only the following on debugging purpose +#use warnings; +#use CGI::Carp 'fatalsToBrowser'; + +use Time::Local; +use IO::Socket; + +require '/var/ipfire/general-functions.pl'; +require "${General::swroot}/lang.pl"; +require "${General::swroot}/header.pl"; + +my $unique=time; + +my $squidlogdir = "/var/log/squid"; +my $reportdir = "${General::swroot}/proxy/calamaris/reports"; + +unless (-e $reportdir) { mkdir($reportdir) } + +my %cgiparams=(); +my %reportsettings=(); +my %selected=(); +my %checked=(); + +my $errormessage=''; + +my $hintcolour='#FFFFCC'; + +my $commandline=''; + +my %monthidx = (qw(Jan 0 Feb 1 Mar 2 Apr 3 May 4 Jun 5 Jul 6 Aug 7 Sep 8 Oct 9 Nov 10 Dec 11)); + +my @longmonths = ( $Lang::tr{'january'}, $Lang::tr{'february'}, $Lang::tr{'march'}, + $Lang::tr{'april'}, $Lang::tr{'may'}, $Lang::tr{'june'}, $Lang::tr{'july'}, + $Lang::tr{'august'}, $Lang::tr{'september'}, $Lang::tr{'october'}, + $Lang::tr{'november'}, $Lang::tr{'december'} ); + +my @now = localtime(time); +my $year = $now[5]+1900; + +my $day_begin=0; +my $month_begin=0; +my $year_begin=0; +my $day_end=0; +my $month_end=0; +my $year_end=0; + +$reportsettings{'ACTION'} = ''; + +$reportsettings{'DAY_BEGIN'} = $now[3]; +$reportsettings{'MONTH_BEGIN'} = $now[4]; +$reportsettings{'YEAR_BEGIN'} = $now[5]+1900; +$reportsettings{'DAY_END'} = $now[3]; +$reportsettings{'MONTH_END'} = $now[4]; +$reportsettings{'YEAR_END'} = $now[5]+1900; + +$reportsettings{'ENABLE_DOMAIN'} = 'off'; +$reportsettings{'NUM_DOMAINS'} = '10'; +$reportsettings{'ENABLE_PERFORMANCE'} = 'off'; +$reportsettings{'PERF_INTERVAL'} = '60'; +$reportsettings{'ENABLE_CONTENT'} = 'off'; +$reportsettings{'NUM_CONTENT'} = '10'; +$reportsettings{'ENABLE_REQUESTER'} = 'off'; +$reportsettings{'ENABLE_USERNAME'} = 'off'; +$reportsettings{'NUM_HOSTS'} = '10'; +$reportsettings{'NUM_URLS'} = '0'; +$reportsettings{'ENABLE_HISTOGRAM'} = 'off'; +$reportsettings{'HIST_LEVEL'} = '10'; +$reportsettings{'ENABLE_VERBOSE'} = 'off'; +$reportsettings{'BYTE_UNIT'} = 'B'; +$reportsettings{'SKIP_GZLOGS'} = 'off'; +$reportsettings{'RUN_BACKGROUND'} = 'off'; + +&Header::getcgihash(\%reportsettings); + +if ($reportsettings{'ACTION'} eq $Lang::tr{'calamaris create report'}) +{ + $cgiparams{'DAY_BEGIN'} = $reportsettings{'DAY_BEGIN'}; + $cgiparams{'MONTH_BEGIN'} = $reportsettings{'MONTH_BEGIN'}; + $cgiparams{'YEAR_BEGIN'} = $reportsettings{'YEAR_BEGIN'}; + $cgiparams{'DAY_END'} = $reportsettings{'DAY_END'}; + $cgiparams{'MONTH_END'} = $reportsettings{'MONTH_END'}; + $cgiparams{'YEAR_END'} = $reportsettings{'YEAR_END'}; + + delete $reportsettings{'DAY_BEGIN'}; + delete $reportsettings{'MONTH_BEGIN'}; + delete $reportsettings{'YEAR_BEGIN'}; + delete $reportsettings{'DAY_END'}; + delete $reportsettings{'MONTH_END'}; + delete $reportsettings{'YEAR_END'}; + + &General::writehash("${General::swroot}/proxy/calamaris/settings", \%reportsettings); + + $reportsettings{'DAY_BEGIN'} = $cgiparams{'DAY_BEGIN'}; + $reportsettings{'MONTH_BEGIN'} = $cgiparams{'MONTH_BEGIN'}; + $reportsettings{'YEAR_BEGIN'} = $cgiparams{'YEAR_BEGIN'}; + $reportsettings{'DAY_END'} = $cgiparams{'DAY_END'}; + $reportsettings{'MONTH_END'} = $cgiparams{'MONTH_END'}; + $reportsettings{'YEAR_END'} = $cgiparams{'YEAR_END'}; + + $day_begin = $reportsettings{'DAY_BEGIN'}; + $month_begin = $reportsettings{'MONTH_BEGIN'}; + $year_begin = $reportsettings{'YEAR_BEGIN'}; + $day_end = $reportsettings{'DAY_END'}; + $month_end = $reportsettings{'MONTH_END'}; + $year_end = $reportsettings{'YEAR_END'}; + + if ($reportsettings{'SKIP_GZLOGS'} eq 'on') { $commandline.='nogz '; } + + $commandline.="$day_begin $month_begin $year_begin $day_end $month_end $year_end"; + + if ($reportsettings{'ENABLE_DOMAIN'} eq 'on') + { + $commandline.=' -d '; + $commandline.=$reportsettings{'NUM_DOMAINS'}; + } + if ($reportsettings{'ENABLE_PERFORMANCE'} eq 'on') + { + $commandline.=' -P '; + $commandline.=$reportsettings{'PERF_INTERVAL'}; + } + if ($reportsettings{'ENABLE_CONTENT'} eq 'on') + { + $commandline.=' -t '; + $commandline.=$reportsettings{'NUM_CONTENT'}; + } + if ($reportsettings{'ENABLE_HISTOGRAM'} eq 'on') + { + $commandline.=' -D '; + $commandline.=$reportsettings{'HIST_LEVEL'}; + } + if ($reportsettings{'ENABLE_REQUESTER'} eq 'on') + { + if ($reportsettings{'ENABLE_USERNAME'} eq 'on') + { + $commandline.=' -u'; + } + $commandline.=' -r '; + $commandline.=$reportsettings{'NUM_HOSTS'}; + + unless ($reportsettings{'NUM_URLS'} eq '0') + { + $commandline.=' -R '; + $commandline.=$reportsettings{'NUM_URLS'}; + } + } + unless ($reportsettings{'BYTE_UNIT'} eq 'B') + { + $commandline.=' -U '; + $commandline.=$reportsettings{'BYTE_UNIT'}; + } + if ($reportsettings{'ENABLE_VERBOSE'} eq 'on') + { + $commandline.=' -s'; + } + + $commandline.=' < /dev/null > /dev/null 2>&1'; + + if ($reportsettings{'RUN_BACKGROUND'} eq 'on') { $commandline.=" &"; } + + system("${General::swroot}/proxy/calamaris/bin/mkreport $commandline") +} + +if ($reportsettings{'ACTION'} eq $Lang::tr{'export'}) +{ + print "Content-type: application/octet-stream\n"; + print "Content-length: "; + print (-s "$reportdir/$reportsettings{'REPORT'}"); + print "\n"; + print "Content-disposition: attachment; filename=$reportsettings{'REPORT'}\n\n"; + + open (FILE, "$reportdir/$reportsettings{'REPORT'}"); + while () { print; } + close (FILE); + + exit; +} + +if ($reportsettings{'ACTION'} eq $Lang::tr{'delete'}) { unlink("$reportdir/$reportsettings{'REPORT'}"); } + +if (-e "${General::swroot}/proxy/calamaris/settings") +{ + &General::readhash("${General::swroot}/proxy/calamaris/settings", \%reportsettings); +} + +&Header::showhttpheaders(); + +$checked{'ENABLE_DOMAIN'}{'off'} = ''; +$checked{'ENABLE_DOMAIN'}{'on'} = ''; +$checked{'ENABLE_DOMAIN'}{$reportsettings{'ENABLE_DOMAIN'}} = "checked='checked'"; +$selected{'NUM_DOMAINS'}{$reportsettings{'NUM_DOMAINS'}} = "selected='selected'"; +$checked{'ENABLE_PERFORMANCE'}{'off'} = ''; +$checked{'ENABLE_PERFORMANCE'}{'on'} = ''; +$checked{'ENABLE_PERFORMANCE'}{$reportsettings{'ENABLE_PERFORMANCE'}} = "checked='checked'"; +$selected{'PERF_INTERVAL'}{$reportsettings{'PERF_INTERVAL'}} = "selected='selected'"; +$checked{'ENABLE_CONTENT'}{'off'} = ''; +$checked{'ENABLE_CONTENT'}{'on'} = ''; +$checked{'ENABLE_CONTENT'}{$reportsettings{'ENABLE_CONTENT'}} = "checked='checked'"; +$selected{'NUM_CONTENT'}{$reportsettings{'NUM_CONTENT'}} = "selected='selected'"; +$checked{'ENABLE_REQUESTER'}{'off'} = ''; +$checked{'ENABLE_REQUESTER'}{'on'} = ''; +$checked{'ENABLE_REQUESTER'}{$reportsettings{'ENABLE_REQUESTER'}} = "checked='checked'"; +$checked{'ENABLE_USERNAME'}{'off'} = ''; +$checked{'ENABLE_USERNAME'}{'on'} = ''; +$checked{'ENABLE_USERNAME'}{$reportsettings{'ENABLE_USERNAME'}} = "checked='checked'"; +$selected{'NUM_HOSTS'}{$reportsettings{'NUM_HOSTS'}} = "selected='selected'"; +$selected{'NUM_URLS'}{$reportsettings{'NUM_URLS'}} = "selected='selected'"; +$checked{'ENABLE_HISTOGRAM'}{'off'} = ''; +$checked{'ENABLE_HISTOGRAM'}{'on'} = ''; +$checked{'ENABLE_HISTOGRAM'}{$reportsettings{'ENABLE_HISTOGRAM'}} = "checked='checked'"; +$selected{'HIST_LEVEL'}{$reportsettings{'HIST_LEVEL'}} = "selected='selected'"; +$checked{'ENABLE_VERBOSE'}{'off'} = ''; +$checked{'ENABLE_VERBOSE'}{'on'} = ''; +$checked{'ENABLE_VERBOSE'}{$reportsettings{'ENABLE_VERBOSE'}} = "checked='checked'"; +$selected{'BYTE_UNIT'}{$reportsettings{'BYTE_UNIT'}} = "selected='selected'"; +$checked{'SKIP_GZLOGS'}{'off'} = ''; +$checked{'SKIP_GZLOGS'}{'on'} = ''; +$checked{'SKIP_GZLOGS'}{$reportsettings{'SKIP_GZLOGS'}} = "checked='checked'"; +$checked{'RUN_BACKGROUND'}{'off'} = ''; +$checked{'RUN_BACKGROUND'}{'on'} = ''; +$checked{'RUN_BACKGROUND'}{$reportsettings{'RUN_BACKGROUND'}} = "checked='checked'"; + +&Header::openpage($Lang::tr{'calamaris proxy reports'}, 1, ''); + +&Header::openbigbox('100%', 'left', '', $errormessage); + +if ($errormessage) { + &Header::openbox('100%', 'left', $Lang::tr{'error messages'}); + print "$errormessage \n"; + &Header::closebox(); +} + +&Header::openbox('100%', 'left', "$Lang::tr{'settings'}:"); + +print < + + + + + + + + + + + + + + +
$Lang::tr{'calamaris report period'}
$Lang::tr{'from'}: + + + $Lang::tr{'to'}: + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
$Lang::tr{'calamaris report options'}
$Lang::tr{'calamaris enable domain report'}: [-d]$Lang::tr{'calamaris number of domains'}:
$Lang::tr{'calamaris enable performance report'}: [-P]$Lang::tr{'calamaris report interval (in minutes)'}:
$Lang::tr{'calamaris enable content report'}: [-t]$Lang::tr{'calamaris number of content types'}:
$Lang::tr{'calamaris enable requester report'}: [-r/-R]$Lang::tr{'calamaris number of requesting hosts'}:
$Lang::tr{'calamaris show usernames'}: [-u]$Lang::tr{'calamaris number of requested urls'}:
$Lang::tr{'calamaris enable distribution histogram'}: [-D]$Lang::tr{'calamaris histogram resolution'}:
$Lang::tr{'calamaris enable verbose reporting'}: [-s]$Lang::tr{'calamaris byte unit'}:
+ +
+ + + + + + + + + + + +
$Lang::tr{'calamaris performance options'}
$Lang::tr{'calamaris skip archived logfiles'}:$Lang::tr{'calamaris run as background task'}:
+ +
+ + + + + + + + +
  
+ +END +; + +&Header::closebox(); + +&Header::openbox('100%', 'left', "$Lang::tr{'calamaris available reports'}:"); + +my @content=(); +my @reports=(); +my @reportdata=(); +my $description; + +undef @reports; + +foreach (<$reportdir/*>) +{ + open (FILE, "$_"); + @content=; + if ($content[3] =~ /^Report\speriod/) + { + $description = timelocal( + substr($content[4],31,2), + substr($content[4],28,2), + substr($content[4],25,2), + substr($content[4],15,2), + $monthidx{substr($content[4],18,3)}, + "20".substr($content[4],22,2)); + push(@reports,join("#",$description,substr($_,rindex($_,"/")+1),$content[3],$content[4])); + } + close FILE; +} + +@reports=reverse(sort(@reports)); + + +print < + +END +; + +if (@reports) +{ + print "\n"; +} else { print "$Lang::tr{'calamaris no reports available'}\n"; } + +print < + +
+ + + +END +; + +if (@reports) +{ +print <  + + + + + +END +; +} + +print < +
 
+ +END +; + +if (($reportsettings{'ACTION'} eq $Lang::tr{'calamaris view'}) && (!($reportsettings{'REPORT'} eq ''))) +{ + &Header::closebox(); + &Header::openbox('100%', 'left', "$Lang::tr{'calamaris view report'}:"); + print "
\n";
+	open (FILE, "$reportdir/$reportsettings{'REPORT'}");
+	@content=;
+	close FILE;
+	foreach (@content)
+	{
+		s//\>/;
+		print;
+	}
+	print "
\n"; +} + +&Header::closebox(); + +&Header::closebigbox(); + +&Header::closepage(); diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl index 12dae3cce6..2990b554f0 100644 --- a/langs/de/cgi-bin/de.pl +++ b/langs/de/cgi-bin/de.pl @@ -352,6 +352,37 @@ 'cache size' => 'Cache-Größe (MB):', 'cached' => 'zwischengespeichert', 'cached memory' => 'Cache Speicher', +'calamaris available reports' => 'Verfügbare Berichte', +'calamaris byte unit' => 'Byte Einheit', +'calamaris create report' => 'Bericht erstellen', +'calamaris enable content report' => 'Aktiviere Inhaltsbericht', +'calamaris enable distribution histogram' => 'Aktiviere Verteilungshistogramm', +'calamaris enable domain report' => 'Aktiviere Domainbericht', +'calamaris enable performance report' => 'Aktiviere Leistungsbericht', +'calamaris enable requester report' => 'Aktiviere Abfragebericht', +'calamaris enable verbose reporting' => 'Aktiviere ausführlichen Bericht', +'calamaris high' => 'hoch', +'calamaris histogram resolution' => 'Histogramm Auflösung', +'calamaris low' => 'gering', +'calamaris medium' => 'mittel', +'calamaris no reports available' => 'Keine Berichte verfügbar', +'calamaris none' => 'keine', +'calamaris number of content types' => 'Anzahl der Inhaltstypen', +'calamaris number of domains' => 'Anzahl der Domains', +'calamaris number of requested urls' => 'Anzahl der abgefragten URLs', +'calamaris number of requesting hosts' => 'Anzahl der abfragenden Hosts', +'calamaris performance options' => 'Leistungsoptionen', +'calamaris proxy reports' => 'Proxy-Berichte', +'calamaris refresh list' => 'Liste aktualisieren', +'calamaris report interval (in minutes)' => 'Berichtsintervall (in Minuten)', +'calamaris report options' => 'Berichtsoptionen', +'calamaris report period' => 'Berichtszeitraum', +'calamaris run as background task' => 'Als Hintergrundprozess starten', +'calamaris show usernames' => 'Benutzernamen anzeigen', +'calamaris skip archived logfiles' => 'Archivierte Protokolle überspringen', +'calamaris unlimited' => 'unbegrenzt', +'calamaris view' => 'Anzeigen', +'calamaris view report' => 'Bericht anzeigen', 'cancel' => 'Abbrechen', 'cancel-adv-options' => 'Abbrechen', 'cannot enable both nat traversal and compression' => 'NAT Traversal und Kompression können nicht gleichzeitig aktiviert sein.', diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index 1e74bbec42..d06bf6bbc1 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -369,6 +369,37 @@ 'cache size' => 'Cache size (MB):', 'cached' => 'cached', 'cached memory' => 'Cached Memory', +'calamaris available reports' => 'Available reports', +'calamaris byte unit' => 'Byte unit', +'calamaris create report' => 'Create report', +'calamaris enable content report' => 'Enable content report', +'calamaris enable distribution histogram' => 'Enable distribution histogram', +'calamaris enable domain report' => 'Enable domain report', +'calamaris enable performance report' => 'Enable performance report', +'calamaris enable requester report' => 'Enable requester report', +'calamaris enable verbose reporting' => 'Enable verbose reporting', +'calamaris high' => 'high', +'calamaris histogram resolution' => 'Histogram resolution', +'calamaris low' => 'low', +'calamaris medium' => 'medium', +'calamaris no reports available' => 'No reports available', +'calamaris none' => 'none', +'calamaris number of content types' => 'Number of content types', +'calamaris number of domains' => 'Number of domains', +'calamaris number of requested urls' => 'Number of requested URLs', +'calamaris number of requesting hosts' => 'Number of requesting hosts', +'calamaris performance options' => 'Performance options', +'calamaris proxy reports' => 'Proxy Reports', +'calamaris refresh list' => 'Refresh list', +'calamaris report interval (in minutes)' => 'Report interval (in minutes)', +'calamaris report options' => 'Report options', +'calamaris report period' => 'Report period', +'calamaris run as background task' => 'Run as background task', +'calamaris show usernames' => 'Show usernames', +'calamaris skip archived logfiles' => 'Skip archived logfiles', +'calamaris unlimited' => 'unlimited', +'calamaris view' => 'View', +'calamaris view report' => 'View report', 'cancel' => 'Cancel', 'cancel-adv-options' => 'Cancel', 'cannot enable both nat traversal and compression' => 'Cannot enable both NAT Traversal and Compression.', diff --git a/lfs/calamaris b/lfs/calamaris new file mode 100644 index 0000000000..57a1014195 --- /dev/null +++ b/lfs/calamaris @@ -0,0 +1,79 @@ +############################################################################### +# This file is part of the IPCop Firewall. # +# # +# IPCop is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either version 2 of the License, or # +# (at your option) any later version. # +# # +# IPCop is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with IPCop; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# # +# Makefiles are based on LFSMake, which is # +# Copyright (C) 2002 Rod Roard # +# # +############################################################################### + +############################################################################### +# Definitions +############################################################################### + +include Config + +VER = 2.59 + +THISAPP = calamaris-$(VER) +DL_FILE = $(THISAPP).tar.gz +DL_FROM = $(URL_IPFIRE) +DIR_APP = $(DIR_SRC)/$(THISAPP) +TARGET = $(DIR_INFO)/$(THISAPP) + +############################################################################### +# Top-level Rules +############################################################################### + +objects = $(DL_FILE) + +$(DL_FILE) = $(DL_FROM)/$(DL_FILE) + +$(DL_FILE)_MD5 = 63c233b3407f9aec34b03647ed7fc852 + +install : $(TARGET) + +check : $(patsubst %,$(DIR_CHK)/%,$(objects)) + +download :$(patsubst %,$(DIR_DL)/%,$(objects)) + +md5 : $(subst %,%_MD5,$(objects)) + +############################################################################### +# Downloading, checking, md5sum +############################################################################### + +$(patsubst %,$(DIR_CHK)/%,$(objects)) : + @$(CHECK) + +$(patsubst %,$(DIR_DL)/%,$(objects)) : + @$(LOAD) + +$(subst %,%_MD5,$(objects)) : + @$(MD5) + +############################################################################### +# Installation Details +############################################################################### + +$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) + @$(PREBUILD) + @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE) + cd $(DIR_APP) && cp -f calamaris $(DIR_SRC)/config/calamaris/mkreport \ + /var/ipfire/proxy/calamaris/bin/ + chmod 755 /var/ipfire/proxy/calamaris/bin/{calamaris,mkreport} + @rm -rf $(DIR_APP) + @$(POSTBUILD) diff --git a/lfs/configroot b/lfs/configroot index a747f14781..71f0e4cc7a 100644 --- a/lfs/configroot +++ b/lfs/configroot @@ -55,7 +55,7 @@ $(TARGET) : for i in addon-lang auth backup ca certs connscheduler crls ddns dhcp dhcpc dmzholes \ ethernet extrahd/bin fwlogs isdn key langs logging main mbmon menu.d modem net-traffic \ nfs optionsfw outgoing/bin patches pakfire portfw \ - ppp private proxy/advanced qos/bin red remote snort time tripwire/report \ + ppp private proxy/advanced proxy/calamaris/bin qos/bin red remote snort time tripwire/report \ updatexlrator/bin updatexlrator/autocheck urlfilter/autoupdate urlfilter/bin upnp vpn \ wakeonlan wireless xtaccess ; do \ mkdir -p $(CONFIG_ROOT)/$$i; \ diff --git a/lfs/stage2 b/lfs/stage2 index 97923e979a..3643e7a8d7 100644 --- a/lfs/stage2 +++ b/lfs/stage2 @@ -98,7 +98,9 @@ $(TARGET) : # Create /var dirs and files -mkdir -v /var/{lock,log,mail,run,spool,empty} -mkdir -pv /var/{opt,cache,lib/{misc,locate},local} - touch /var/run/utmp /var/log/{btmp,lastlog,wtmp,counter} + -mkdir -pv /var/log/{counter,calamaris} + chown nobody.nobody /var/log/calamaris + touch /var/run/utmp /var/log/{btmp,lastlog,wtmp} chgrp -v utmp /var/run/utmp /var/log/lastlog chmod -v 664 /var/run/utmp /var/log/lastlog diff --git a/make.sh b/make.sh index 8a6a9f5802..3fd133fc16 100644 --- a/make.sh +++ b/make.sh @@ -464,6 +464,7 @@ buildipfire() { ipfiremake squid ipfiremake squid-graph ipfiremake squidguard + ipfiremake calamaris ipfiremake tcpdump ipfiremake traceroute ipfiremake vlan