]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
OpenVPN: Allow to set routes to IPsec networks
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 4 Dec 2017 17:51:53 +0000 (17:51 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 4 Dec 2017 17:51:53 +0000 (17:51 +0000)
This makes hub-and-spoke designs with OpenVPN RW and
IPsec N2N easier to configure

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
config/rootfiles/core/117/filelists/files
html/cgi-bin/ovpnmain.cgi

index 4a5e674ecf69d3848bcdc766450a0ea4e2621348..9906b1542cc7a69efdfe7faeec0b590e5696b61a 100644 (file)
@@ -19,6 +19,7 @@ srv/web/ipfire/cgi-bin/logs.cgi/ids.dat
 srv/web/ipfire/cgi-bin/logs.cgi/showrequestfromcountry.dat
 srv/web/ipfire/cgi-bin/netexternal.cgi
 srv/web/ipfire/cgi-bin/netother.cgi
 srv/web/ipfire/cgi-bin/logs.cgi/showrequestfromcountry.dat
 srv/web/ipfire/cgi-bin/netexternal.cgi
 srv/web/ipfire/cgi-bin/netother.cgi
+srv/web/ipfire/cgi-bin/ovpnmain.cgi
 srv/web/ipfire/cgi-bin/routing.cgi
 srv/web/ipfire/cgi-bin/vpnmain.cgi
 srv/web/ipfire/html/themes/darkdos/include/functions.pl
 srv/web/ipfire/cgi-bin/routing.cgi
 srv/web/ipfire/cgi-bin/vpnmain.cgi
 srv/web/ipfire/html/themes/darkdos/include/functions.pl
index ceb88c1569d07e6190a99f7fb0dcae67712163a2..b43f91f6bbdb93d3cee910969313c0488e2d4128 100644 (file)
@@ -4975,6 +4975,35 @@ END
                }
                if ($set == '1' && $#temp != -1){ print"<option selected>$temp[1]</option>";$set=0;}elsif($set == '0' && $#temp != -1){print"<option>$temp[1]</option>";}
        }       
                }
                if ($set == '1' && $#temp != -1){ print"<option selected>$temp[1]</option>";$set=0;}elsif($set == '0' && $#temp != -1){print"<option>$temp[1]</option>";}
        }       
+
+       my %vpnconfig = ();
+       &General::readhasharray("${General::swroot}/vpn/config", \%vpnconfig);
+       foreach my $vpn (keys %vpnconfig) {
+               # Skip all disabled VPN connections
+               my $enabled = $vpnconfig{$vpn}[0];
+               next unless ($enabled eq "on");
+
+               my $name = $vpnconfig{$vpn}[1];
+
+               # Remote subnets
+               my @networks = split(/\|/, $vpnconfig{$vpn}[11]);
+               foreach my $network (@networks) {
+                       my $selected = "";
+
+                       foreach my $key (keys %ccdroute2hash) {
+                               if ($ccdroute2hash{$key}[0] eq $cgiparams{'NAME'}) {
+                                       foreach my $i (1 .. $#{$ccdroute2hash{$key}}) {
+                                               if ($ccdroute2hash{$key}[$i] eq $network) {
+                                                       $selected = "selected";
+                                               }
+                                       }
+                               }
+                       }
+
+                       print "<option value=\"$network\" $selected>$name ($network)</option>\n";
+               }
+       }
+
        #check if green,blue,orange are defined for client
        foreach my $key (keys %ccdroute2hash) {
                if($ccdroute2hash{$key}[0] eq $cgiparams{'NAME'}){
        #check if green,blue,orange are defined for client
        foreach my $key (keys %ccdroute2hash) {
                if($ccdroute2hash{$key}[0] eq $cgiparams{'NAME'}){