#!/usr/bin/perl
+###############################################################################
+# #
+# IPFire.org - A linux based firewall #
+# Copyright (C) 2013 #
+# #
+# 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/>. #
+# #
+###############################################################################
+# Author: Alexander Marx (amarx@ipfire.org) #
+###############################################################################
+# #
+#This script converts old xtaccess rules to new firewall #
+#Logfiles are created under /var/log/converters #
+# #
+###############################################################################
my @current=();
my @alias=();
my %configinputfw=();
my $field16=''; #remark
my $field26='00:00';
my $field27='00:00';
+my $field28 = '';
+my $field29 = 'ALL';
+my $field30 = '';
+my $field31 = 'dnat';
open(FILE, $xtaccessconfig) or die 'Unable to open config file.';
my @current = <FILE>;
close(FILE);
}
#check ipfire address
if ($e eq '0.0.0.0'){
- $field6 = 'Default IP';
+ $field6 = 'RED1';
}else{
foreach my $line (@alias){
my ($ip,$state,$aliasname) = split (",",$line);
$c = "$1:65535";
}
$field15=$c;
- #Ausgabe
- #print "0:$field0 1:$field1 2:$field2 3:$field3 4:$field4 5:$field5 6:$field6 11:$field11 12:$field12 13:$field13 14:$field14 15:$field15 16:$field16 26:$field26 27:$field27\n";
my $key = &General::findhasharraykey (\%configinputfw);
- foreach my $i (0 .. 27) { $configinputfw{$key}[$i] = "";}
+ foreach my $i (0 .. 31) { $configinputfw{$key}[$i] = "";}
$configinputfw{$key}[0] = $field0;
$configinputfw{$key}[1] = $field1;
$configinputfw{$key}[2] = $field2;
$configinputfw{$key}[25] = '';
$configinputfw{$key}[26] = $field26;
$configinputfw{$key}[27] = $field27;
+ $configinputfw{$key}[28] = $field28;
+ $configinputfw{$key}[29] = $field29;
+ $configinputfw{$key}[30] = $field30;
+ $configinputfw{$key}[31] = $field31;
&General::writehasharray($inputfwconfig,\%configinputfw);
}