Remove IPAC stuff

This is unused for a very very very long time and serves
no purpose any more.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
Michael Tremer
2016-10-02 15:13:55 +01:00
parent cc60329d88
commit 5edc06b701
23 changed files with 37 additions and 868 deletions

View File

@@ -1,257 +0,0 @@
#!/usr/bin/perl
#
# This file is a library file for the Net-Traffic Addon.
#
# Copyright (C) 2006 Achim Weber <dotzball@users.sourceforge.net>
#
# $Id: net-traffic-admin.pl,v 1.13 2006/12/10 13:46:00 dotzball Exp $
#
# This program 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.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
package NETTRAFF;
use strict;
use LWP::UserAgent;
require '/var/ipfire/general-functions.pl';
require "${General::swroot}/lang.pl";
require "${General::swroot}/header.pl";
$|=1; # line buffering
my $updateUrl = "http://blockouttraffic.de/version/Net-Traffic.latest";
my $latestVersionFile = "${General::swroot}/net-traffic/latestVersion";
%NETTRAFF::settings;
$NETTRAFF::settingsfile = "${General::swroot}/net-traffic/settings";
$NETTRAFF::versionfile = "${General::swroot}/net-traffic/version";
$NETTRAFF::logfile = "/var/log/net-traffic.log";
$NETTRAFF::colorOk = '#00FF00';
$NETTRAFF::colorWarn = '#FFFF00';
$NETTRAFF::colorMax = '#FF0000';
#~ $NETTRAFF::settingsCGI = '/cgi-bin/fwrulesadm.cgi';
#~ $NETTRAFF::configCGI = '/cgi-bin/fwrules.cgi';
#~ $NETTRAFF::advConfCGI = '/cgi-bin/fwadvconf.cgi';
@NETTRAFF::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'} );
@NETTRAFF::months = ( 0,1,2,3,4,5,6,7,8,9,10,11 );
@NETTRAFF::years=("2001","2002","2003","2004","2005","2006","2007","2008","2009");
#workaround to suppress a warning when a variable is used only once
my @dummy = ( $General::version );
undef (@dummy);
# Init Settings
$NETTRAFF::settings{'MONTHLY_VOLUME_ON'} = 'off';
$NETTRAFF::settings{'MONTHLY_VOLUME'} = '1';
$NETTRAFF::settings{'STARTDAY'} = '1';
$NETTRAFF::settings{'WARN_ON'} = 'off';
$NETTRAFF::settings{'WARN'} = '80';
$NETTRAFF::settings{'CALC_INTERVAL'} = '60';
$NETTRAFF::settings{'SHOW_AT_HOME'} = 'on';
$NETTRAFF::settings{'SEND_EMAIL_ON'} = 'off';
$NETTRAFF::settings{'EMAIL_TO'} = '';
$NETTRAFF::settings{'EMAIL_FROM'} = '';
$NETTRAFF::settings{'EMAIL_USR'} = '';
$NETTRAFF::settings{'EMAIL_PW'} = '';
$NETTRAFF::settings{'EMAIL_SERVER'} = '';
$NETTRAFF::settings{'VERSION_CHECK_ON'} = 'off';
&NETTRAFF::readSettings();
sub readSettings
{
&General::readhash($NETTRAFF::settingsfile, \%NETTRAFF::settings);
}
sub showNetTrafficVersion
{
my %versionSettings = ();
&General::readhash($NETTRAFF::versionfile, \%versionSettings);
print <<END;
<a href="http://$versionSettings{'URL'}" target="_blank">
<b>Net-Traffic $versionSettings{'VERSION_INSTALLED'}
-
END
print "Build $versionSettings{'BUILD_INSTALLED'}";
if ($versionSettings{'IS_TESTVERSION'} == 1) {
print " - Testversion $versionSettings{'TESTVERSION'}";
}
print "</b></a><br /><br />\n";
# check for new version
&checkForNewVersion();
}
sub traffPercentbar
{
my $percent = $_[0];
my $fg = '#a0a0a0';
my $bg = '#e2e2e2';
if ($percent =~ m/^(\d+)%$/ )
{
print <<END;
<table width='100%' border='1' cellspacing='0' cellpadding='0' style='border-width:1px;border-style:solid;border-color:$fg;width:100%;height:10px;'>
<tr>
END
if ($percent eq "100%" || $1 > 100)
{
$fg = $NETTRAFF::colorMax;
print "<td width='100%' bgcolor='$fg' style='background-color:$fg;border-style:solid;border-width:1px;border-color:$bg'>"
}
elsif ($percent eq "0%")
{
print "<td width='100%' bgcolor='$bg' style='background-color:$bg;border-style:solid;border-width:1px;border-color:$bg'>"
}
else
{
if($NETTRAFF::settings{'WARN_ON'} eq 'on'
&& $1 >= $NETTRAFF::settings{'WARN'})
{
$fg = $NETTRAFF::colorWarn;
}
print "<td width='$percent' bgcolor='$fg' style='background-color:$fg;border-style:solid;border-width:1px;border-color:$bg'></td><td width='" . (100-$1) . "%' bgcolor='$bg' style='background-color:$bg;border-style:solid;border-width:1px;border-color:$bg'>"
}
print <<END;
<img src='/images/null.gif' width='1' height='1' alt='' />
</td>
</tr>
</table>
END
}
}
sub checkForNewVersion
{
if ($NETTRAFF::settings{'VERSION_CHECK_ON'} ne 'on')
{
return;
}
# download latest version
&downloadLatestVersionInfo();
if(-e $latestVersionFile)
{
my %versionSettings = ();
&General::readhash($NETTRAFF::versionfile, \%versionSettings);
my %latestVersion = ();
&General::readhash($latestVersionFile, \%latestVersion);
if( $versionSettings{'VERSION_INSTALLED'} lt $latestVersion{'VERSION_AVAILABLE'}
|| ( $versionSettings{'VERSION_INSTALLED'} le $latestVersion{'VERSION_AVAILABLE'}
&& $versionSettings{'BUILD_INSTALLED'} lt $latestVersion{'BUILD_AVAILABLE'} ) )
{
&Header::openbox('100%', 'left', $Lang::tr{'info'});
print <<END;
<table width="100%">
<tr>
<td>
$Lang::tr{'net traffic newversion'}
<a href="$latestVersion{'URL_UPDATE'}" target="_blank">
<b>$latestVersion{'URL_UPDATE'}</b>
</a>
</td>
</tr>
<tr>
<td>
<b>v$latestVersion{'VERSION_AVAILABLE'} - Build $latestVersion{'BUILD_AVAILABLE'}
</table>
END
&Header::closebox();
}
}
}
sub downloadLatestVersionInfo
{
# only check if we are online
if (! -e '/var/ipfire/red/active')
{
return;
}
# download latest version file if it is not existing or outdated (i.e. 5 days old)
if((! -e $latestVersionFile) || (int(-M $latestVersionFile) > 5))
{
my %versionSettings = ();
&General::readhash($NETTRAFF::versionfile, \%versionSettings);
my $ua = LWP::UserAgent->new;
$ua->timeout(120);
$ua->agent("Mozilla/4.0 (compatible; IPFire $General::version; $versionSettings{'VERSION_INSTALLED'})");
my $content = $ua->get($updateUrl);
if ( $content->is_success )
{
#~ open(FILE, ">$latestVersionFile") or die "Could not write file: $latestVersionFile";
#~ flock (FILE, 2);
#~ print FILE "$content->content\n";
#~ close(FILE);
my %latestVersion = ();
# latest versions, format is: MOD_VERSION="1.3.0"
$content->content =~ /MOD_VERSION="(.+?)"/;
$latestVersion{'VERSION_AVAILABLE'} = $1;
# latest build, format is: MOD_BUILD="0"
$content->content =~ /MOD_BUILD="(.+?)"/;
$latestVersion{'BUILD_AVAILABLE'} = $1;
# URL format is: MOD_URL="http://blockouttraffic.de/nt_index.php"
$content->content =~ /MOD_URL="(.+?)"/;
$latestVersion{'URL_UPDATE'} = $1;
&General::writehash($latestVersionFile, \%latestVersion);
}
}
}
sub getFormatedDate
{
my $time = shift;
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($time);
return sprintf("%04d-%02d-%02d, %02d:%02d", 1900+$year, $mon+1, $mday, $hour, $min);;
}
# always return 1;
1;
# EOF

View File

@@ -1,518 +0,0 @@
#!/usr/bin/perl
#
# $Id: net-traffic-lib.pl,v 1.10 2007/01/09 19:00:35 dotzball Exp $
#
# Summarize all IP accounting files from start to end time
#
# Copyright (C) 1997 - 2000 Moritz Both
# 2001 - 2002 Al Zaharov
#
# This program 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.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# The author can be reached via email: moritz@daneben.de, or by
# snail mail: Moritz Both, Im Moore 26, 30167 Hannover,
# Germany. Phone: +49-511-1610129
#
#
# 22 June 2004 By Achim Weber dotzball@users.sourceforge.net
# - changed to use it with Net-Traffic Addon
# - renamed to avoid issues when calling this file or original ipacsum
# - this file is net-traffic-lib.pl for IPCop 1.4.0
#
package Traffic;
use 5.000;
use Getopt::Long;
use POSIX qw(strftime);
use Time::Local;
use Socket;
use IO::Handle;
#use warnings;
#use strict;
$|=1; # line buffering
my @moff = (0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 );
# =()<$datdelim="@<DATDELIM>@";>()=
my $datdelim="#-#-#-#-#";
# =()<$prefix="@<prefix>@";>()=
my $prefix="/usr";
# =()<$exec_prefix="@<exec_prefix>@";>()=
my $exec_prefix="${prefix}";
# =()<$INSTALLPATH="@<INSTALLPATH>@";>()=
my $INSTALLPATH="${exec_prefix}/sbin";
my $datdir="/var/log/ip-acct";
my $me=$0;
$me =~ s|^.*/([^/]+)$|$1|;
my $now = time;
my $fetchipac="$INSTALLPATH/fetchipac";
my $rule_regex = ".*"; # match rules with this regex only
my $machine_name;
my $fetchipac_options;
my ($newest_timestamp_before_starttime, $oldest_timestamp_after_endtime);
my (%rule_firstfile, %rule_lastfile);
my $count;
my @timestamps;
my $rulenumber;
my ($starttime, $endtime);
## Net-Traffic variables ##
my %allDays;
my $allDaysBytes;
my $tzoffset = 0;
my $displayMode = "daily";
my ($curMonth, $curYear);
${Traffic::blue_in} = 'incoming BLUE';
${Traffic::green_in} = 'incoming GREEN';
${Traffic::orange_in} = 'incoming ORANGE';
${Traffic::red_in} = 'incoming RED';
${Traffic::blue_out} = 'outgoing BLUE';
${Traffic::green_out} = 'outgoing GREEN';
${Traffic::orange_out} = 'outgoing ORANGE';
${Traffic::red_out} = 'outgoing RED';
sub calcTraffic{
$allDaysBytes = shift;
$starttime = shift;
$endtime = shift;
$displayMode = shift;
# init
%allDays = ();
$starttime =~ /^(\d\d\d\d)(\d\d)/;
$curYear = $1;
$curMonth = $2;
# calculate time zone offset in seconds - use difference of output of date
# command and time function, round it
$tzoffset = time-timegm(localtime());
$machine_name = undef;
if($displayMode ne "exactTimeframe")
{
$starttime = makeunixtime($starttime);
if($displayMode ne 'exactEnd') {
$endtime = makeunixtime($endtime);
}
}
$endtime -= 1;
# options that we need to pass to fetchipac if we call it.
$fetchipac_options = "--directory=$datdir";
$endtime = $now if ($endtime > $now);
$starttime = 0 if ($starttime < 0);
#~ $mystarttime = &makemydailytime($starttime);
#~ $myendtime = &makemydailytime($endtime);
%rule_firstfile = ( );
%rule_lastfile = ( );
@timestamps = ();
# find out which timestamps we need to read.
# remember newest timestamp before starttime so we know when data for
# the first file starts
# also remember oldest timestamp after end time
$newest_timestamp_before_starttime = "";
$oldest_timestamp_after_endtime = "";
open(DATA, "$fetchipac $fetchipac_options --timestamps=$starttime,$endtime ".
"--machine-output-format|") || die "$me: cant run $fetchipac\n";
# the first thing is the timestamp count
$count=<DATA>;
if ($count == 0) {
return ();
}
while(<DATA>)
{
if (/^(.)\s(\d+)$/) {
my $ts = $2;
if ($1 eq "-") {
$newest_timestamp_before_starttime=$ts;
}
elsif ($1 eq "+") {
$oldest_timestamp_after_endtime=$ts;
}
elsif ($1 eq "*") {
push(@timestamps, $ts);
}
else {
die "$me: illegal output from $fetchipac: \"$_\"\n";
}
}
else {
die "$me: illegal output from $fetchipac: \"$_\"\n";
}
}
close DATA;
push(@timestamps, $oldest_timestamp_after_endtime)
if ($oldest_timestamp_after_endtime);
unshift(@timestamps, $newest_timestamp_before_starttime)
if ($newest_timestamp_before_starttime);
$rulenumber = 0;
# read all data we need and put the data into memory.
&read_data;
my @days_sorted = sort keys %allDays;
return @days_sorted;
}
##########################
# END OF MAIN PROGRAM
##########################
# read all data (@timestmaps contains the timestamps, must be sorted!)
# and put the data into our global memory data
# structures. special care must be taken with data of the first and
# the last timestamps we read, since we only want data which is from our
# time frame. Furthermore, data from before and after this time frame
# must be preserved in special data structures because we might replace
# them (option --replace) and have to write extra data for these times
# then.
sub read_data {
my $run_s;
my $s;
my $i;
my $in_time = 0;
my $after_time = 0;
my $curDay = $starttime;
# feed the timestamp list to fetchipac on its stdin.
socketpair(CHILD, PARENT, AF_UNIX, SOCK_STREAM, PF_UNSPEC)
or die "socketpair: $!";
CHILD->autoflush(1);
PARENT->autoflush(1);
my $pid = open(CHILD, "-|");
die "$me: can't fork: $!\n" unless defined $pid;
if ($pid == 0) {
# child
close CHILD;
open(FETCHIPAC, "|$fetchipac $fetchipac_options --record "
."--machine-output-format")
or die "$me: cant exec fetchipac\n";
#this is much more efficient than the original code (Manfred Weihs)
# and it adds more troubles than solves (Al Zakharov)
if ($timestamps[0] == $newest_timestamp_before_starttime) {
print(FETCHIPAC $timestamps[1],"-",$timestamps[$count],"\n");
} else {
print(FETCHIPAC $timestamps[0],"-",$timestamps[$count-1],"\n");
}
close(FETCHIPAC);
close(PARENT);
exit;
}
close PARENT;
my $laststamp = undef;
$laststamp = $newest_timestamp_before_starttime
if ($newest_timestamp_before_starttime);
$i = 0;
$i++ if ($laststamp);
while (<CHILD>) {
# first line of fetchipac output: "ADD"
/^ADD\s*$/i or die "$me: bad line from fetchipac: $_\n";
# second line of fetchipac output: timestamp no_of_records
$_ = <CHILD> || last;
/^(\d+)\s(\d+)$/ or die "$me: bad line from fetchipac: $_\n";
my $timestamp = int $1;
my $number_of_records = int $2;
my $do_collect = 1;
if ($displayMode =~ /^daily/) {
# increment Day aslong current timestamp is not in current Day
while ( ($timestamp-$curDay) > 86399) {
$curDay += 86400;
}
}
else
{
my @dummy = localtime($timestamp);
# increment Month aslong current timestamp is not in current Month
while ($curMonth < ($dummy[4]+1) || $curYear<($dummy[5]+1900)) {
$curMonth++;
if ($curMonth > 12) {
$curMonth = 1;
$curYear++;
}
my $newMonth = $curYear;
$newMonth .= $curMonth < 10 ? "0".$curMonth."01" : $curMonth."01";
$newMonth .= "01";
$curDay = &makeunixtime($newMonth);
}
}
if ($timestamp < $starttime) {
# this record is too old, we dont need the data.
# However, the timestamp gives us a clue on the
# time period the next item covers.
$do_collect = 0;
}
my $irec;
# read each record
my $data = &read_data_record(CHILD, $number_of_records);
if ($do_collect && $in_time == 0) {
# the data is from after starttime. if it is the
# first one, split the data (if we know for how
# long this data is valid, and if $laststamp is not
# equal to $starttime in which case the split is
# redundant). If we don't have a clue about the
# last file time before our first file was created,
# we do not know how much of the file data is in our
# time frame. we assume everything belongs to us.
$in_time = 1;
# if ($laststamp && $laststamp != $starttime) {
if ($laststamp && $laststamp != $newest_timestamp_before_starttime) {
my $newdata = &split_data($data,
$laststamp, $timestamp, $starttime);
#~ $glb_data_before = $data;
$data = $newdata;
$laststamp = $starttime;
}
}
if ($timestamp > $endtime) {
# this data is too new, but the data in it may have
# begun within our time frame. (if endtime eq laststamp
# we do a redundant split here, too - it works for now
# and --replace relies on it, but it is ugly.)
if ($after_time == 0) {
$after_time = 1;
if ($laststamp) {
#~ $glb_data_after =
#~ &split_data($data,$laststamp,$timestamp,$endtime);
&split_data($data,$laststamp,$timestamp,$endtime);
} else {
$do_collect = 0;
}
} else {
$do_collect = 0; # just too new.
}
}
if ($do_collect) {
&collect_data($data, $i, $curDay);
}
$laststamp = $timestamp;
$i++;
}
close CHILD;
wait;
}
# split the data in $1 (format as from read_data) into a pair of two
# such data sets. The set referenced to as $1 will afterwards contain
# the first part of the data, another set which is returned contains
# the second part of the data.
# interpret the data as having start time=$2 and end time=$3 and split
# time=$4
sub split_data {
my $data = shift;
my $mstart = shift;
my $mend = shift;
my $msplit = shift;
# calculate factors for multiplications
my $ust = $mstart;
my $uperiod = $mend - $ust;
my $usplit = $msplit - $ust;
if ($uperiod < 0) {
# hmmm? die Daten sind rueckwaerts???
$uperiod = -$uperiod;
}
my $fac1;
if ($usplit < 0) {
$fac1 = 0;
}
elsif ($usplit > $uperiod) {
$fac1 = 1;
}
else {
$fac1 = $usplit / $uperiod;
}
# $fac1 now says us how much weight the first result has.
# initialize the set we will return.
my @ret = ( );
foreach my $set (@$data) {
my ($rule, $bytes, $pkts) = @$set;
$$set[1] = int($bytes * $fac1 + 0.5);
$$set[2] = int($pkts * $fac1 + 0.5);
push(@ret, [ $rule, $bytes - $$set[1], $pkts - $$set[2] ]);
}
return \@ret;
}
# put data from one file into global data structures
# must be called in correct sorted file name order to set rules_lastfile
# and rules_firstfile (which are currently useless)
# arguments:
# $1=index number of file; $2 = reference to array with data from file
sub collect_data {
my($filedata, $ifile, $i, $day);
$filedata = shift;
$ifile=shift;
$day =shift;
# if day first appeared in this file, initialize its
# life.
if (!defined($allDays{$day})) {
return if (&init_filter_id($day));
$allDays{$day} = $rulenumber++;
}
for ($i=0; $i<=$#$filedata; $i++) {
my $set = $$filedata[$i];
my $rule = $$set[0];
my $bytes = $$set[1];
my $pkts = $$set[2];
$_ = $rule;
/^(.*) \(.*$/;
$_ = $1;
/^forwarded (.*)$/;
$rule = $1;
$allDaysBytes->{$day}{$rule} += $bytes;
}
}
# initialize data variables for a new rule - if it is new
sub init_filter_id {
my($s, $ifile) = @_;
if (!defined $allDaysBytes->{$s}) {
if ($displayMode =~ /^daily/) {
my $newDay = &makemydailytime($s);
$newDay =~ /^\d\d\d\d-(\d\d)-\d\d$/;
return 1 if ($1 > $curMonth && $displayMode ne "daily_multi");
$allDaysBytes->{$s}{'Day'} = $newDay;
}
else {
$allDaysBytes->{$s}{'Day'} = &makemymonthlytime($s);
}
$allDaysBytes->{$s}{${Traffic::blue_in}} = int(0);
$allDaysBytes->{$s}{${Traffic::green_in}} = int(0);
$allDaysBytes->{$s}{${Traffic::orange_in}} = int(0);
$allDaysBytes->{$s}{${Traffic::red_in}} = int(0);
$allDaysBytes->{$s}{${Traffic::blue_out}} = int(0);
$allDaysBytes->{$s}{${Traffic::green_out}} = int(0);
$allDaysBytes->{$s}{${Traffic::orange_out}} = int(0);
$allDaysBytes->{$s}{${Traffic::red_out}} = int(0);
}
return 0;
}
# read data record from filehandle $1
# number of records is $2
# Return value: reference to array a of length n;
# n is the number of rules
# each field in a is an array aa with 3 fields
# the fields in arrays aa are: [0]=name of rule; [1]=byte count;
# [2]=packet count
# function does not use global variables
sub read_data_record {
my($file, $number_of_records, $beforedata, $indata, $i, $irec);
my($pkts, $bytes, $rule);
my(@result);
$file=shift;
$number_of_records = shift;
$indata=0;
$beforedata=1;
for($irec = 0; $irec < $number_of_records; $irec++) {
$_ = <$file>;
chop;
/^\(\s*(.*)$/ or die "$me: bad line from fetchipac (expecting machine name): $_\n";
$machine_name = $1; # remember final machine name
while(<$file>) {
last if (/^\)$/); # terminating line ')'
/^(\d+)\s(\d+)\s\|(.*)\|$/
or die "$me: bad line from fetchipac (expecting rule item): $_\n";
$bytes = $1;
$pkts = $2;
$rule = $3;
if ($rule =~ /$rule_regex/) {
push(@result, [ $rule, $bytes, $pkts]);
}
}
}
# read another emtpy line (data format consistency)
$_ = <$file>;
die "$me: bad data from fetchipac (expected emtpy line): $_\n"
if ($_ !~ /^$/);
\@result;
}
# given a string in format YYYYMMDD[hh[mm[ss]]], make unix time
# use time zone offset $tzoffset (input=wall clock time, output=UTC)
sub makeunixtime {
my($y, $m, $d, $h, $i, $e);
my $s = shift;
$h=0; $i=0; $e=0;
if ($s =~ /^(\d\d\d\d)(\d\d)(\d\d)/) {
($y, $m, $d) = ($1, $2, $3);
if ($s =~ /^\d\d\d\d\d\d\d\d-?(\d\d)/) {
$h=$1;
if ($s =~ /^\d\d\d\d\d\d\d\d-?\d\d(\d\d)/) {
$i=$1;
if ($s =~ /^\d\d\d\d\d\d\d\d-?\d\d\d\d(\d\d)/) {
$e=$1;
}
}
}
}
else {
return 0;
}
$y-=1970;
$s = (($y)*365) + int(($y+2)/4) + $moff[$m-1] + $d-1;
$s-- if (($y+2)%4 == 0 && $m < 3);
$s*86400 + $h*3600 + $i*60 + $e + $tzoffset;
}
# return the given unix time in localtime in "mydaily" time format
sub makemydailytime {
my($s)=shift;
my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime($s);
return sprintf("%04d-%02d-%02d", 1900+$year, $mon+1, $mday);
}
# return the given unix time in localtime in "mymonthly" time format
sub makemymonthlytime {
my($s)=shift;
my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime($s);
return sprintf("%04d-%02d", 1900+$year, $mon+1);
}
# EOF

View File

@@ -2,7 +2,6 @@ etc/init.d
#etc/rc.d
#etc/rc.d/helper
etc/rc.d/helper/getdnsfromdhcpc.pl
etc/rc.d/helper/writeipac.pl
#etc/rc.d/init.d
#etc/rc.d/init.d/alsa
#etc/rc.d/init.d/amavisd
@@ -93,7 +92,6 @@ etc/rc.d/init.d/networking/red.up/24-RS-qos
etc/rc.d/init.d/networking/red.up/27-RS-squid
etc/rc.d/init.d/networking/red.up/30-ddns
#etc/rc.d/init.d/networking/red.up/35-guardian
etc/rc.d/init.d/networking/red.up/40-ipac
etc/rc.d/init.d/networking/red.up/50-ipsec
etc/rc.d/init.d/networking/red.up/50-ovpn
etc/rc.d/init.d/networking/red.up/98-leds

View File

@@ -121,11 +121,6 @@ var/ipfire/modem
#var/ipfire/modem/settings
var/ipfire/modem-lib.pl
var/ipfire/network-functions.pl
var/ipfire/net-traffic
#var/ipfire/net-traffic/net-traffic-admin.pl
#var/ipfire/net-traffic/net-traffic-lib.pl
#var/ipfire/net-traffic/settings
#var/ipfire/net-traffic/templates
#var/ipfire/nfs
#var/ipfire/nfs/nfs-server
var/ipfire/optionsfw

View File

@@ -2,7 +2,6 @@ etc/init.d
#etc/rc.d
#etc/rc.d/helper
etc/rc.d/helper/getdnsfromdhcpc.pl
etc/rc.d/helper/writeipac.pl
#etc/rc.d/init.d
etc/rc.d/init.d/acpid
#etc/rc.d/init.d/alsa
@@ -95,7 +94,6 @@ etc/rc.d/init.d/networking/red.up/24-RS-qos
etc/rc.d/init.d/networking/red.up/27-RS-squid
etc/rc.d/init.d/networking/red.up/30-ddns
#etc/rc.d/init.d/networking/red.up/35-guardian
etc/rc.d/init.d/networking/red.up/40-ipac
etc/rc.d/init.d/networking/red.up/50-ipsec
etc/rc.d/init.d/networking/red.up/50-ovpn
etc/rc.d/init.d/networking/red.up/98-leds

View File

@@ -162,7 +162,6 @@ var/log/btmp
var/log/calamaris
var/log/counter
var/log/lastlog
#var/log/net-traffic.log
var/log/wtmp
var/mail
#var/opt

View File

@@ -2,7 +2,6 @@ etc/init.d
#etc/rc.d
#etc/rc.d/helper
etc/rc.d/helper/getdnsfromdhcpc.pl
etc/rc.d/helper/writeipac.pl
#etc/rc.d/init.d
etc/rc.d/init.d/acpid
#etc/rc.d/init.d/alsa
@@ -95,7 +94,6 @@ etc/rc.d/init.d/networking/red.up/24-RS-qos
etc/rc.d/init.d/networking/red.up/27-RS-squid
etc/rc.d/init.d/networking/red.up/30-ddns
#etc/rc.d/init.d/networking/red.up/35-guardian
etc/rc.d/init.d/networking/red.up/40-ipac
etc/rc.d/init.d/networking/red.up/50-ipsec
etc/rc.d/init.d/networking/red.up/50-ovpn
etc/rc.d/init.d/networking/red.up/98-leds

View File

@@ -164,7 +164,6 @@ var/log/btmp
var/log/calamaris
var/log/counter
var/log/lastlog
#var/log/net-traffic.log
var/log/wtmp
var/mail
#var/opt

View File

@@ -55,6 +55,13 @@ rm -vf \
/etc/rc.d/init.d/networking/red.up/05-RS-dnsmasq \
/usr/sbin/dnsmasq
# Delete old net-traffic stuff
rm -vrf \
/etc/rc.d/helper/writeipac.pl \
/etc/rc.d/init.d/networking/red.up/40-ipac \
/var/ipfire/net-traffic \
/var/log/net-traffic.log*
# update linker config
ldconfig

View File

@@ -295,6 +295,7 @@ WARNING: translation string unused: import
WARNING: translation string unused: importkey
WARNING: translation string unused: in
WARNING: translation string unused: incorrect password
WARNING: translation string unused: info
WARNING: translation string unused: insert floppy
WARNING: translation string unused: install new update
WARNING: translation string unused: installed
@@ -325,6 +326,7 @@ WARNING: translation string unused: kernel version
WARNING: translation string unused: key stuff
WARNING: translation string unused: keyreset
WARNING: translation string unused: keys
WARNING: translation string unused: lang
WARNING: translation string unused: lateprompting
WARNING: translation string unused: length
WARNING: translation string unused: line
@@ -383,6 +385,7 @@ WARNING: translation string unused: net
WARNING: translation string unused: net address
WARNING: translation string unused: net config type
WARNING: translation string unused: net config type help
WARNING: translation string unused: net traffic newversion
WARNING: translation string unused: net-traffic configuration
WARNING: translation string unused: network added
WARNING: translation string unused: network configuration

View File

@@ -322,6 +322,7 @@ WARNING: translation string unused: import
WARNING: translation string unused: importkey
WARNING: translation string unused: in
WARNING: translation string unused: incorrect password
WARNING: translation string unused: info
WARNING: translation string unused: insert floppy
WARNING: translation string unused: insert removable device
WARNING: translation string unused: install new update
@@ -353,6 +354,7 @@ WARNING: translation string unused: kernel version
WARNING: translation string unused: key stuff
WARNING: translation string unused: keyreset
WARNING: translation string unused: keys
WARNING: translation string unused: lang
WARNING: translation string unused: lateprompting
WARNING: translation string unused: length
WARNING: translation string unused: line
@@ -411,6 +413,7 @@ WARNING: translation string unused: net
WARNING: translation string unused: net address
WARNING: translation string unused: net config type
WARNING: translation string unused: net config type help
WARNING: translation string unused: net traffic newversion
WARNING: translation string unused: net-traffic configuration
WARNING: translation string unused: network added
WARNING: translation string unused: network configuration

View File

@@ -269,6 +269,7 @@ WARNING: translation string unused: import
WARNING: translation string unused: importkey
WARNING: translation string unused: in
WARNING: translation string unused: incorrect password
WARNING: translation string unused: info
WARNING: translation string unused: insert floppy
WARNING: translation string unused: insert removable device
WARNING: translation string unused: install new update
@@ -299,6 +300,7 @@ WARNING: translation string unused: kernel version
WARNING: translation string unused: key stuff
WARNING: translation string unused: keyreset
WARNING: translation string unused: keys
WARNING: translation string unused: lang
WARNING: translation string unused: lateprompting
WARNING: translation string unused: length
WARNING: translation string unused: line
@@ -357,6 +359,7 @@ WARNING: translation string unused: net
WARNING: translation string unused: net address
WARNING: translation string unused: net config type
WARNING: translation string unused: net config type help
WARNING: translation string unused: net traffic newversion
WARNING: translation string unused: net-traffic configuration
WARNING: translation string unused: network added
WARNING: translation string unused: network configuration

View File

@@ -266,6 +266,7 @@ WARNING: translation string unused: import
WARNING: translation string unused: importkey
WARNING: translation string unused: in
WARNING: translation string unused: incorrect password
WARNING: translation string unused: info
WARNING: translation string unused: insert floppy
WARNING: translation string unused: insert removable device
WARNING: translation string unused: install new update
@@ -296,6 +297,7 @@ WARNING: translation string unused: kernel version
WARNING: translation string unused: key stuff
WARNING: translation string unused: keyreset
WARNING: translation string unused: keys
WARNING: translation string unused: lang
WARNING: translation string unused: lateprompting
WARNING: translation string unused: length
WARNING: translation string unused: line
@@ -354,6 +356,7 @@ WARNING: translation string unused: net
WARNING: translation string unused: net address
WARNING: translation string unused: net config type
WARNING: translation string unused: net config type help
WARNING: translation string unused: net traffic newversion
WARNING: translation string unused: net-traffic configuration
WARNING: translation string unused: network added
WARNING: translation string unused: network configuration

View File

@@ -316,6 +316,7 @@ WARNING: translation string unused: import
WARNING: translation string unused: importkey
WARNING: translation string unused: in
WARNING: translation string unused: incorrect password
WARNING: translation string unused: info
WARNING: translation string unused: insert floppy
WARNING: translation string unused: insert removable device
WARNING: translation string unused: install new update
@@ -347,6 +348,7 @@ WARNING: translation string unused: kernel version
WARNING: translation string unused: key stuff
WARNING: translation string unused: keyreset
WARNING: translation string unused: keys
WARNING: translation string unused: lang
WARNING: translation string unused: lateprompting
WARNING: translation string unused: length
WARNING: translation string unused: line
@@ -405,6 +407,7 @@ WARNING: translation string unused: net
WARNING: translation string unused: net address
WARNING: translation string unused: net config type
WARNING: translation string unused: net config type help
WARNING: translation string unused: net traffic newversion
WARNING: translation string unused: net-traffic configuration
WARNING: translation string unused: network added
WARNING: translation string unused: network configuration

View File

@@ -315,6 +315,7 @@ WARNING: translation string unused: import
WARNING: translation string unused: importkey
WARNING: translation string unused: in
WARNING: translation string unused: incorrect password
WARNING: translation string unused: info
WARNING: translation string unused: insert floppy
WARNING: translation string unused: insert removable device
WARNING: translation string unused: install new update
@@ -346,6 +347,7 @@ WARNING: translation string unused: kernel version
WARNING: translation string unused: key stuff
WARNING: translation string unused: keyreset
WARNING: translation string unused: keys
WARNING: translation string unused: lang
WARNING: translation string unused: lateprompting
WARNING: translation string unused: length
WARNING: translation string unused: line
@@ -404,6 +406,7 @@ WARNING: translation string unused: net
WARNING: translation string unused: net address
WARNING: translation string unused: net config type
WARNING: translation string unused: net config type help
WARNING: translation string unused: net traffic newversion
WARNING: translation string unused: net-traffic configuration
WARNING: translation string unused: network added
WARNING: translation string unused: network configuration

View File

@@ -269,6 +269,7 @@ WARNING: translation string unused: import
WARNING: translation string unused: importkey
WARNING: translation string unused: in
WARNING: translation string unused: incorrect password
WARNING: translation string unused: info
WARNING: translation string unused: insert floppy
WARNING: translation string unused: insert removable device
WARNING: translation string unused: install new update
@@ -299,6 +300,7 @@ WARNING: translation string unused: kernel version
WARNING: translation string unused: key stuff
WARNING: translation string unused: keyreset
WARNING: translation string unused: keys
WARNING: translation string unused: lang
WARNING: translation string unused: lateprompting
WARNING: translation string unused: length
WARNING: translation string unused: line
@@ -357,6 +359,7 @@ WARNING: translation string unused: net
WARNING: translation string unused: net address
WARNING: translation string unused: net config type
WARNING: translation string unused: net config type help
WARNING: translation string unused: net traffic newversion
WARNING: translation string unused: net-traffic configuration
WARNING: translation string unused: network added
WARNING: translation string unused: network configuration

View File

@@ -261,6 +261,7 @@ WARNING: translation string unused: import
WARNING: translation string unused: importkey
WARNING: translation string unused: in
WARNING: translation string unused: incorrect password
WARNING: translation string unused: info
WARNING: translation string unused: insert floppy
WARNING: translation string unused: insert removable device
WARNING: translation string unused: install new update
@@ -291,6 +292,7 @@ WARNING: translation string unused: kernel version
WARNING: translation string unused: key stuff
WARNING: translation string unused: keyreset
WARNING: translation string unused: keys
WARNING: translation string unused: lang
WARNING: translation string unused: lateprompting
WARNING: translation string unused: length
WARNING: translation string unused: line
@@ -348,6 +350,7 @@ WARNING: translation string unused: net
WARNING: translation string unused: net address
WARNING: translation string unused: net config type
WARNING: translation string unused: net config type help
WARNING: translation string unused: net traffic newversion
WARNING: translation string unused: net-traffic configuration
WARNING: translation string unused: network added
WARNING: translation string unused: network configuration

View File

@@ -324,6 +324,7 @@ WARNING: translation string unused: import
WARNING: translation string unused: importkey
WARNING: translation string unused: in
WARNING: translation string unused: incorrect password
WARNING: translation string unused: info
WARNING: translation string unused: insert floppy
WARNING: translation string unused: insert removable device
WARNING: translation string unused: install new update
@@ -355,6 +356,7 @@ WARNING: translation string unused: kernel version
WARNING: translation string unused: key stuff
WARNING: translation string unused: keyreset
WARNING: translation string unused: keys
WARNING: translation string unused: lang
WARNING: translation string unused: lateprompting
WARNING: translation string unused: length
WARNING: translation string unused: line
@@ -413,6 +415,7 @@ WARNING: translation string unused: net
WARNING: translation string unused: net address
WARNING: translation string unused: net config type
WARNING: translation string unused: net config type help
WARNING: translation string unused: net traffic newversion
WARNING: translation string unused: net-traffic configuration
WARNING: translation string unused: network added
WARNING: translation string unused: network configuration

View File

@@ -28,8 +28,6 @@ use strict;
require '/var/ipfire/general-functions.pl';
require "${General::swroot}/lang.pl";
require "${General::swroot}/header.pl";
require "${General::swroot}/net-traffic/net-traffic-admin.pl";
require "${General::swroot}/net-traffic/net-traffic-lib.pl";
my %color = ();
my %mainsettings = ();

View File

@@ -52,7 +52,7 @@ $(TARGET) :
# Create all directories
for i in addon-lang auth backup ca certs connscheduler crls ddns dhcp dhcpc dns dnsforward \
ethernet extrahd/bin fwlogs fwhosts firewall isdn key langs logging mac main \
menu.d modem net-traffic net-traffic/templates nfs optionsfw \
menu.d modem nfs optionsfw \
ovpn patches pakfire portfw ppp private proxy/advanced/cre \
proxy/calamaris/bin qos/bin red remote sensors snort time \
updatexlrator/bin updatexlrator/autocheck urlfilter/autoupdate urlfilter/bin upnp vpn \
@@ -66,7 +66,7 @@ $(TARGET) :
dhcp/fixleases dhcp/advoptions dhcp/dhcpd.conf.local dns/settings dnsforward/config ethernet/aliases ethernet/settings ethernet/known_nics ethernet/scanned_nics \
ethernet/wireless extrahd/scan extrahd/devices extrahd/partitions extrahd/settings firewall/settings firewall/config firewall/geoipblock firewall/input firewall/outgoing \
fwhosts/customnetworks fwhosts/customhosts fwhosts/customgroups fwhosts/customservicegrp fwhosts/customgeoipgrp fwlogs/ipsettings fwlogs/portsettings \
isdn/settings mac/settings main/hosts main/routing main/settings net-traffic/settings optionsfw/settings \
isdn/settings mac/settings main/hosts main/routing main/settings optionsfw/settings \
ovpn/ccd.conf ovpn/ccdroute ovpn/ccdroute2 pakfire/settings portfw/config ppp/settings-1 ppp/settings-2 ppp/settings-3 ppp/settings-4 \
ppp/settings-5 ppp/settings proxy/settings proxy/squid.conf proxy/advanced/settings proxy/advanced/cre/enable remote/settings qos/settings qos/classes qos/subclasses qos/level7config qos/portconfig \
qos/tosconfig snort/settings upnp/settings vpn/config vpn/settings vpn/ipsec.conf \
@@ -91,8 +91,6 @@ $(TARGET) :
cp $(DIR_SRC)/config/menu/* $(CONFIG_ROOT)/menu.d/
cp $(DIR_SRC)/config/cfgroot/modem-defaults $(CONFIG_ROOT)/modem/defaults
cp $(DIR_SRC)/config/cfgroot/modem-settings $(CONFIG_ROOT)/modem/settings
cp $(DIR_SRC)/config/cfgroot/net-traffic-lib.pl $(CONFIG_ROOT)/net-traffic/net-traffic-lib.pl
cp $(DIR_SRC)/config/cfgroot/net-traffic-admin.pl $(CONFIG_ROOT)/net-traffic/net-traffic-admin.pl
cp $(DIR_SRC)/config/cfgroot/nfs-server $(CONFIG_ROOT)/nfs/nfs-server
cp $(DIR_SRC)/config/cfgroot/proxy-acl $(CONFIG_ROOT)/proxy/acl-1.4
cp $(DIR_SRC)/config/qos/* $(CONFIG_ROOT)/qos/bin/

View File

@@ -126,7 +126,7 @@ endif
-mkdir -pv /var/{opt,cache,lib/{misc,locate},local}
-mkdir -pv /var/log/{counter,calamaris}
chown nobody.nobody /var/log/calamaris
touch /var/log/{btmp,lastlog,wtmp,net-traffic.log}
touch /var/log/{btmp,lastlog,wtmp}
chgrp -v utmp /var/log/lastlog
chmod -v 664 /var/log/lastlog

View File

@@ -1,67 +0,0 @@
#!/usr/bin/perl
###############################################################################
# #
# IPFire.org - A linux based firewall #
# Copyright (C) 2007 Michael Tremer & Christian Schmidt #
# #
# This program 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 3 of the License, or #
# (at your option) any later version. #
# #
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>. #
# #
###############################################################################
use strict;
require '/var/ipfire/general-functions.pl';
my %settings;
my $iface;
General::readhash("${General::swroot}/ethernet/settings", \%settings);
if (!open(FILE, '>/etc/ipac-ng/rules.conf')) {
die "Unable to create /etc/ipac-ng/rules.conf"; }
if (open(IFACE, "${General::swroot}/red/iface"))
{
$iface = <IFACE>;
close IFACE;
chomp ($iface);
}
print FILE "incoming GREEN ($settings{'GREEN_DEV'})|ipac~o|$settings{'GREEN_DEV'}|all|||\n";
print FILE "outgoing GREEN ($settings{'GREEN_DEV'})|ipac~i|$settings{'GREEN_DEV'}|all|||\n";
print FILE "forwarded incoming GREEN ($settings{'GREEN_DEV'})|ipac~fi|$settings{'GREEN_DEV'}|all|||\n";
print FILE "forwarded outgoing GREEN ($settings{'GREEN_DEV'})|ipac~fo|$settings{'GREEN_DEV'}|all|||\n";
if ($settings{'CONFIG_TYPE'} =~ /^(2|4)$/ )
{
print FILE "incoming ORANGE ($settings{'ORANGE_DEV'})|ipac~o|$settings{'ORANGE_DEV'}|all|||\n";
print FILE "outgoing ORANGE ($settings{'ORANGE_DEV'})|ipac~i|$settings{'ORANGE_DEV'}|all|||\n";
print FILE "forwarded incoming ORANGE ($settings{'ORANGE_DEV'})|ipac~fi|$settings{'ORANGE_DEV'}|all|||\n";
print FILE "forwarded outgoing ORANGE ($settings{'ORANGE_DEV'})|ipac~fo|$settings{'ORANGE_DEV'}|all|||\n";
}
if ($settings{'CONFIG_TYPE'} =~ /^(3|4)$/ )
{
print FILE "incoming BLUE ($settings{'BLUE_DEV'})|ipac~o|$settings{'BLUE_DEV'}|all|||\n";
print FILE "outgoing BLUE ($settings{'BLUE_DEV'})|ipac~i|$settings{'BLUE_DEV'}|all|||\n";
print FILE "forwarded incoming BLUE ($settings{'BLUE_DEV'})|ipac~fi|$settings{'BLUE_DEV'}|all|||\n";
print FILE "forwarded outgoing BLUE ($settings{'BLUE_DEV'})|ipac~fo|$settings{'BLUE_DEV'}|all|||\n";
}
if ($iface) {
print FILE "incoming RED ($iface)|ipac~o|$iface|all|||\n";
print FILE "outgoing RED ($iface)|ipac~i|$iface|all|||\n";
print FILE "forwarded incoming RED ($iface)|ipac~fi|$iface|all|||\n";
print FILE "forwarded outgoing RED ($iface)|ipac~fo|$iface|all|||\n";
}
close FILE;

View File

@@ -1,6 +0,0 @@
#!/bin/bash
#/etc/rc.d/helper/writeipac.pl
#/usr/sbin/fetchipac -S
exit 0