From 3a4459746774ddaabdf6c85414b7b91d75863740 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Mon, 4 Dec 2017 17:51:53 +0000 Subject: [PATCH] OpenVPN: Allow to set routes to IPsec networks This makes hub-and-spoke designs with OpenVPN RW and IPsec N2N easier to configure Signed-off-by: Michael Tremer --- config/rootfiles/core/117/filelists/files | 1 + html/cgi-bin/ovpnmain.cgi | 29 +++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/config/rootfiles/core/117/filelists/files b/config/rootfiles/core/117/filelists/files index 4a5e674ecf..9906b1542c 100644 --- a/config/rootfiles/core/117/filelists/files +++ b/config/rootfiles/core/117/filelists/files @@ -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/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 diff --git a/html/cgi-bin/ovpnmain.cgi b/html/cgi-bin/ovpnmain.cgi index ceb88c1569..b43f91f6bb 100644 --- a/html/cgi-bin/ovpnmain.cgi +++ b/html/cgi-bin/ovpnmain.cgi @@ -4975,6 +4975,35 @@ END } if ($set == '1' && $#temp != -1){ print"";$set=0;}elsif($set == '0' && $#temp != -1){print"";} } + + 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 "\n"; + } + } + #check if green,blue,orange are defined for client foreach my $key (keys %ccdroute2hash) { if($ccdroute2hash{$key}[0] eq $cgiparams{'NAME'}){ -- 2.39.2