system("cd / && tar -xvz -p -f /tmp/restore.ipf");
#Here some converter scripts to correct old Backups (before core 65)
system("/usr/sbin/ovpn-ccd-convert");
- system("/usr/sbin/convert-xtaccess");
- system("/usr/sbin/convert-outgoingfw");
-
- #clean up system, if an old backup was restored
if( -d "/var/ipfire/outgoing"){
+ system("/usr/sbin/convert-outgoingfw");
rmtree("/var/ipfire/outgoing");
}
if( -d "/var/ipfire/xtaccess"){
+ system("/usr/sbin/convert-xtaccess");
rmtree("/var/ipfire/xtaccess");
}
}
$groups{$grpkey}[4] = 0;
}
}
+ @hostarray=();
}
&General::writehasharray($confighosts,\%hosts);
&General::writehasharray($configgroups,\%groups);
&General::writehasharray($confignets,\%nets);
+
}
sub check_host
{
foreach my $rule (@lines)
{
chomp($rule);
+ $port='';
print LOG "processing: $rule\n";
- my @configline = split( /\;/, $rule );
+ my @configline=();
+ @configline = split( /\;/, $rule );
my @prot=();
if($configline[0] eq $type){
#some variables we can use from old config
push(@prot,"udp");
$useport='ON';
$grp3='TGT_PORT';
-
}else{
push(@prot,$configline[3]);
$useport='ON';
}
if($configline[4] ne ''){ $remark=$configline[4];}else{$remark='';}
if($configline[9] eq 'aktiv'){ $log='ON';}else{$log='';}
-
if($configline[10] eq 'on' && $configline[11] eq 'on' && $configline[12] eq 'on' && $configline[13] eq 'on' && $configline[14] eq 'on' && $configline[15] eq 'on' && $configline[16] eq 'on'){
if($configline[17] eq '00:00' && $configline[18] eq '00:00'){
$time='';
print LOG "-> Rule not converted, ipsec+ interface is obsolet since IPFire 2.7 \n";
next;
}elsif ($configline[2] eq 'ovpn') {
- &build_ovpn_grp;
+ &build_ovpn_grp;
+ $grp1='cust_grp_src';
+ $source='ovpn'
}elsif ($configline[2] eq 'ip') {
my $z=&check_ip($configline[5]);
if($z){
next;
}
}
+
}
$port=join("|",@values);
@values=();
+ @parts=();
}
}else{
print LOG "-> Rule not converted because not for Firewall mode $outsettings{'POLICY'} (we are only converting for actual mode)\n";
my $key=shift;
my $service;
my $prot;
-
if($hash{$key}[11] eq 'ON' && $hash{$key}[12] ne 'ICMP'){
if($hash{$key}[14] eq 'cust_srv'){
&General::readhasharray("$configsrv", \%customservice);
$hash{$key}[15]=~ s/\|/,/g;
$service=$hash{$key}[15];
}
-
- print": $service";
+ if($service){
+ print": $service";
+ }
}elsif($hash{$key}[11] eq 'ON' && $hash{$key}[12] eq 'ICMP'){
print":<br>$hash{$key}[13]";
}
# set rules.pl executable
chmod 755 $(CONFIG_ROOT)/forward/bin/rules.pl
+ # set converters executable
+ chmod 755 /usr/sbin/convert-*
+
# Modify variables in header.pl
sed -i -e "s+CONFIG_ROOT+$(CONFIG_ROOT)+g" \
-e "s+VERSION+$(VERSION)+g" \