]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
Calamaris-Proxy-Logdatei-Analyzer eingebaut.
authorms <ms@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Thu, 12 Apr 2007 21:55:51 +0000 (21:55 +0000)
committerms <ms@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Thu, 12 Apr 2007 21:55:51 +0000 (21:55 +0000)
git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@498 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8

15 files changed:
config/calamaris/mkreport [new file with mode: 0644]
config/menu/70-log.menu
config/rootfiles/common/apache2
config/rootfiles/common/calamaris [new file with mode: 0644]
config/rootfiles/common/stage2
doc/language_issues.de
doc/language_issues.en
doc/packages-list.txt
html/cgi-bin/logs.cgi/calamaris.dat [new file with mode: 0644]
langs/de/cgi-bin/de.pl
langs/en/cgi-bin/en.pl
lfs/calamaris [new file with mode: 0644]
lfs/configroot
lfs/stage2
make.sh

diff --git a/config/calamaris/mkreport b/config/calamaris/mkreport
new file mode 100644 (file)
index 0000000..53db9d5
--- /dev/null
@@ -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 (<LOG>) {
+                                       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 (<LOG>) {
+                               if (substr($_,0,10) >= $date_from) { if (substr($_,0,10) <= $date_to) { print TMPLOG "$_"; } }
+                       }
+                       close(LOG);
+               }
+       }
+
+       close (TMPLOG);
+
+       return (-s "$calamlogdir/squid-$unique.log");
+
+}
+
+# -------------------------------------------------------------------
index 26c0527f6f04cbd0111d48490d723cb3fa0466cd..25ba090fc2e609428eaabc1b59bc77f949c9ddb4 100644 (file)
                                 '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'}",
index c417eebdf908b77626d1ab210f8cbceae4072bb0..de77998b0f02cd221a1f7723d84a4f020846f731 100644 (file)
@@ -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 (file)
index 0000000..4d3a767
--- /dev/null
@@ -0,0 +1,2 @@
+var/ipfire/proxy/calamaris/bin/calamaris
+var/ipfire/proxy/calamaris/bin/mkreport
index d4a6e7f255a9c34e254b5f9976248f79105fb2e3..41eb65a7d17f24a2672e96fc0dc1f109c2d8f8a9 100644 (file)
@@ -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
index 3b6e96a7090b8c88576b49ed5e263b4d9911dc41..4d198dd37c4748732c4a979ed77ef0cbc0841433 100644 (file)
@@ -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
index 833a485ec0c18582858eadbd2716b3d3ee2dd32e..9fab32879566617c3e944f49ecc9028eb18dd50e 100644 (file)
@@ -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
index f5394eff0c40b16c59cf8b95952517158948a344..cfa139ca02a1f9e15ae3918bcd3f13b6ed63b3bd 100644 (file)
@@ -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 (file)
index 0000000..19a3693
--- /dev/null
@@ -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 (<FILE>) { 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 "<font class='base'>$errormessage&nbsp;</font>\n";
+       &Header::closebox();
+}
+
+&Header::openbox('100%', 'left', "$Lang::tr{'settings'}:");
+
+print <<END
+<form method='post' action='$ENV{'SCRIPT_NAME'}'>
+<table width='100%' border='0'>
+<tr>
+       <td colspan='8' class='base'><b>$Lang::tr{'calamaris report period'}</b></td>
+</tr>
+<tr>
+       <td width='9%' class='base'>$Lang::tr{'from'}:</td>
+       <td width='15%'>
+       <select name='MONTH_BEGIN'>
+END
+;
+for ($month_begin = 0; $month_begin < 12; $month_begin++)
+{
+       print "\t<option ";
+       if ($month_begin == $reportsettings{'MONTH_BEGIN'}) {
+               print 'selected="selected" '; }
+       print "value='$month_begin'>$longmonths[$month_begin]</option>\n";
+}
+print <<END
+       </select>
+       </td>
+       <td width='9%'>
+       <select name='DAY_BEGIN'>
+END
+;
+for ($day_begin = 1; $day_begin <= 31; $day_begin++) 
+{
+       print "\t<option ";
+       if ($day_begin == $reportsettings{'DAY_BEGIN'}) {
+               print 'selected="selected" '; }
+       print "value='$day_begin'>$day_begin</option>\n";
+}
+print <<END
+       </select>
+       </td>
+       <td width='12%'>
+       <select name='YEAR_BEGIN'>
+END
+;
+for ($year_begin = $year-2; $year_begin <= $year+1; $year_begin++) 
+{
+       print "\t<option ";
+       if ($year_begin == $reportsettings{'YEAR_BEGIN'}) {
+               print 'selected="selected" '; }
+       print "value='$year_begin'>$year_begin</option>\n";
+}
+print <<END
+       </select>
+       </td>
+       <td width='9%' class='base'>$Lang::tr{'to'}:</td>
+       <td width='15%'>
+       <select name='MONTH_END'>
+END
+;
+for ($month_end = 0; $month_end < 12; $month_end++)
+{
+       print "\t<option ";
+       if ($month_end == $reportsettings{'MONTH_END'}) {
+               print 'selected="selected" '; }
+       print "value='$month_end'>$longmonths[$month_end]</option>\n";
+}
+print <<END
+       </select>
+       </td>
+       <td width='9%'>
+       <select name='DAY_END'>
+END
+;
+for ($day_end = 1; $day_end <= 31; $day_end++) 
+{
+       print "\t<option ";
+       if ($day_end == $reportsettings{'DAY_END'}) {
+               print 'selected="selected" '; }
+       print "value='$day_end'>$day_end</option>\n";
+}
+print <<END
+       </select>
+       </td>
+       <td width='22%'>
+       <select name='YEAR_END'>
+END
+;
+for ($year_end = $year-2; $year_end <= $year+1; $year_end++) 
+{
+       print "\t<option ";
+       if ($year_end == $reportsettings{'YEAR_END'}) {
+               print 'selected="selected" '; }
+       print "value='$year_end'>$year_end</option>\n";
+}
+print <<END
+       </select>
+       </td>
+</tr>
+</table>
+
+<hr size='1'>
+
+<table width='100%' border='0'>
+<tr>
+       <td colspan='4' class='base'><b>$Lang::tr{'calamaris report options'}</b></td>
+</tr>
+<tr>
+       <td width='30%' class='base'>$Lang::tr{'calamaris enable domain report'}:</td>
+       <td width='15%'><input type='checkbox' name='ENABLE_DOMAIN' $checked{'ENABLE_DOMAIN'}{'on'} /> [-d]</td>
+       <td width='30%' class='base'>$Lang::tr{'calamaris number of domains'}:</td>
+       <td width='25%'><select name='NUM_DOMAINS'>
+               <option value='10'  $selected{'NUM_DOMAINS'}{'10'}>10</option>
+               <option value='25'  $selected{'NUM_DOMAINS'}{'25'}>25</option>
+               <option value='100' $selected{'NUM_DOMAINS'}{'100'}>100</option>
+               <option value='-1'  $selected{'NUM_DOMAINS'}{'-1'}>$Lang::tr{'calamaris unlimited'}</option>
+       </select></td>
+</tr>
+<tr>
+       <td class='base'>$Lang::tr{'calamaris enable performance report'}:</td>
+       <td><input type='checkbox' name='ENABLE_PERFORMANCE' $checked{'ENABLE_PERFORMANCE'}{'on'} /> [-P]</td>
+       <td class='base'>$Lang::tr{'calamaris report interval (in minutes)'}:</td>
+       <td><select name='PERF_INTERVAL'>
+               <option value='30'   $selected{'PERF_INTERVAL'}{'30'}>30</option>
+               <option value='60'   $selected{'PERF_INTERVAL'}{'60'}>60</option>
+               <option value='120'  $selected{'PERF_INTERVAL'}{'120'}>120</option>
+               <option value='240'  $selected{'PERF_INTERVAL'}{'240'}>240</option>
+               <option value='480'  $selected{'PERF_INTERVAL'}{'480'}>480</option>
+               <option value='720'  $selected{'PERF_INTERVAL'}{'720'}>720</option>
+               <option value='1440' $selected{'PERF_INTERVAL'}{'1440'}>1440</option>
+       </select></td>
+</tr>
+<tr>
+       <td class='base'>$Lang::tr{'calamaris enable content report'}:</td>
+       <td><input type='checkbox' name='ENABLE_CONTENT' $checked{'ENABLE_CONTENT'}{'on'} /> [-t]</td>
+       <td class='base'>$Lang::tr{'calamaris number of content types'}:</td>
+       <td><select name='NUM_CONTENT'>
+               <option value='10'  $selected{'NUM_CONTENT'}{'10'}>10</option>
+               <option value='25'  $selected{'NUM_CONTENT'}{'25'}>25</option>
+               <option value='100' $selected{'NUM_CONTENT'}{'100'}>100</option>
+               <option value='-1'  $selected{'NUM_CONTENT'}{'-1'}>$Lang::tr{'calamaris unlimited'}</option>
+       </select></td>
+</tr>
+<tr>
+       <td class='base'>$Lang::tr{'calamaris enable requester report'}:</td>
+       <td><input type='checkbox' name='ENABLE_REQUESTER' $checked{'ENABLE_REQUESTER'}{'on'} /> [-r/-R]</td>
+       <td class='base'>$Lang::tr{'calamaris number of requesting hosts'}:</td>
+       <td><select name='NUM_HOSTS'>
+               <option value='10'  $selected{'NUM_HOSTS'}{'10'}>10</option>
+               <option value='25'  $selected{'NUM_HOSTS'}{'25'}>25</option>
+               <option value='100' $selected{'NUM_HOSTS'}{'100'}>100</option>
+               <option value='-1'  $selected{'NUM_HOSTS'}{'-1'}>$Lang::tr{'calamaris unlimited'}</option>
+</tr>
+<tr>
+       <td class='base'>$Lang::tr{'calamaris show usernames'}:</td>
+       <td><input type='checkbox' name='ENABLE_USERNAME' $checked{'ENABLE_USERNAME'}{'on'} /> [-u]</td>
+       <td class='base'>$Lang::tr{'calamaris number of requested urls'}:</td>
+       <td><select name='NUM_URLS'>
+               <option value='0'   $selected{'NUM_URLS'}{'0'}>$Lang::tr{'calamaris none'}</option>
+               <option value='10'  $selected{'NUM_URLS'}{'10'}>10</option>
+               <option value='25'  $selected{'NUM_URLS'}{'25'}>25</option>
+               <option value='100' $selected{'NUM_URLS'}{'100'}>100</option>
+               <option value='-1'  $selected{'NUM_URLS'}{'-1'}>$Lang::tr{'calamaris unlimited'}</option>
+       </select></td>
+</tr>
+<tr>
+       <td class='base'>$Lang::tr{'calamaris enable distribution histogram'}:</td>
+       <td><input type='checkbox' name='ENABLE_HISTOGRAM' $checked{'ENABLE_HISTOGRAM'}{'on'} /> [-D]</td>
+       <td class='base'>$Lang::tr{'calamaris histogram resolution'}:</td>
+       <td><select name='HIST_LEVEL'>
+               <option value='1000' $selected{'HIST_LEVEL'}{'1000'}>$Lang::tr{'calamaris low'}</option>
+               <option value='10'   $selected{'HIST_LEVEL'}{'10'}>$Lang::tr{'calamaris medium'}</option>
+               <option value='2'    $selected{'HIST_LEVEL'}{'2'}>$Lang::tr{'calamaris high'}</option>
+</tr>
+<tr>
+       <td class='base'>$Lang::tr{'calamaris enable verbose reporting'}:</td>
+       <td><input type='checkbox' name='ENABLE_VERBOSE' $checked{'ENABLE_VERBOSE'}{'on'} /> [-s]</td>
+       <td class='base'>$Lang::tr{'calamaris byte unit'}:</td>
+       <td><select name='BYTE_UNIT'>
+               <option value='B' $selected{'BYTE_UNIT'}{'B'}>Byte</option>
+               <option value='K' $selected{'BYTE_UNIT'}{'K'}>KByte</option>
+               <option value='M' $selected{'BYTE_UNIT'}{'M'}>MByte</option>
+               <option value='G' $selected{'BYTE_UNIT'}{'G'}>GByte</option>
+</tr>
+</table>
+
+<hr size='1'>
+
+<table width='100%' border='0'>
+<tr>
+       <td colspan='4' class='base'><b>$Lang::tr{'calamaris performance options'}</b></td>
+</tr>
+<tr>
+       <td width='30%' class='base'>$Lang::tr{'calamaris skip archived logfiles'}:</td>
+       <td width='15%'><input type='checkbox' name='SKIP_GZLOGS' $checked{'SKIP_GZLOGS'}{'on'} /></td>
+       <td width='30%'class='base'>$Lang::tr{'calamaris run as background task'}:</td>
+       <td width='25%'><input type='checkbox' name='RUN_BACKGROUND' $checked{'RUN_BACKGROUND'}{'on'} /></td>
+</tr>
+</table>
+
+<hr size='1'>
+
+<table width='100%' border='0'>
+<tr>
+<td align='left'>&nbsp;</td>
+<td width='33%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'calamaris create report'}' /></td>
+<td width='33%' align='right'>&nbsp;</td>
+</tr>
+
+</table>
+
+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=<FILE>;
+       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
+
+<table width='100%' border='0'>
+<tr>
+END
+;
+
+if (@reports)
+{
+       print "<td><select name='REPORT' size='5'>\n";
+       my $n=0;
+       foreach (@reports)
+       {
+               @reportdata=split(/#/);
+               print "\t<option ";
+               if ($n eq '0') { print "selected "; $reportsettings{'REPORT'}=$reportdata[1]; $n++}
+               print "value='$reportdata[1]'>$reportdata[2] &nbsp;-&nbsp; $reportdata[3]</option>\n";
+       }
+       print "</select></td>\n";
+} else { print "<td><i>$Lang::tr{'calamaris no reports available'}</i></td>\n"; }
+
+print <<END
+</tr>
+</table>
+<hr size='1'>
+<table width='100%' cellpadding='5' border='0'>
+<tr>
+<td><input type='submit' name='ACTION' value='$Lang::tr{'calamaris refresh list'}' /></td>
+END
+;
+
+if (@reports)
+{
+print <<END
+<td>&nbsp;</td>
+<td>&nbsp;</td>
+<td><input type='submit' name='ACTION' value='$Lang::tr{'calamaris view'}' /></td>
+<td><input type='submit' name='ACTION' value='$Lang::tr{'export'}' /></td>
+<td><input type='submit' name='ACTION' value='$Lang::tr{'delete'}' /></td>
+<td width='95%'></td>
+END
+;
+}
+
+print <<END
+</tr>
+</table>
+</form>
+END
+;
+
+if (($reportsettings{'ACTION'} eq $Lang::tr{'calamaris view'}) && (!($reportsettings{'REPORT'} eq '')))
+{
+       &Header::closebox();
+       &Header::openbox('100%', 'left', "$Lang::tr{'calamaris view report'}:");
+       print "<pre>\n";
+       open (FILE, "$reportdir/$reportsettings{'REPORT'}");
+       @content=<FILE>;
+       close FILE;
+       foreach (@content)
+       {
+               s/</\&lt;/;
+               s/>/\&gt;/;
+               print;
+       }
+       print "</pre>\n";
+}
+
+&Header::closebox();
+
+&Header::closebigbox();
+
+&Header::closepage();
index 12dae3cce6b39475b87ddbc13786727698b9b03c..2990b554f01556cc80211091e1f73b03517ef8b4 100644 (file)
 '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.',
index 1e74bbec424beebbaa72d9bfb9a595caeb865d36..d06bf6bbc1c63d2e0b394e283e074d046f7d8d54 100644 (file)
 '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 (file)
index 0000000..57a1014
--- /dev/null
@@ -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 <rod@sunsetsystems.com>                        #
+#                                                                             #
+###############################################################################
+
+###############################################################################
+# 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)
index a747f14781095db66944ee7534ce52f3ba0100b2..71f0e4cc7a9edd7485e496cd0bf2104489a761b1 100644 (file)
@@ -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; \
index 97923e979a4ca6eb1b0c5a58c754ff9059dc4100..3643e7a8d7cd9a365f9baf4ce1861068d01356b7 100644 (file)
@@ -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 8a6a9f5802b0e80088826a7f38b56cf1b84ce734..3fd133fc166a32b3b21a79758f3f68bddca3705a 100644 (file)
--- 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