From 1c612d9e326a477bb1cbad719702c51c35f11d62 Mon Sep 17 00:00:00 2001 From: ummeegge Date: Wed, 11 Nov 2020 18:12:25 +0000 Subject: [PATCH] OpenVPN: Add start of static routes in client N2N Fixes: #12529 - If a client N2N configuration will be imported into IPFire systems, a line will be added which calls the --up script to restart the static route initscript. Since this is IPFire specific, i will only be added via import on IPFire system. - Deleted unneeded line in CLIENTCONF section. - Added description to SERVERCONF section. Signed-off-by: ummeegge Signed-off-by: Michael Tremer --- html/cgi-bin/ovpnmain.cgi | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/html/cgi-bin/ovpnmain.cgi b/html/cgi-bin/ovpnmain.cgi index 8626a94cad..44cb48996d 100644 --- a/html/cgi-bin/ovpnmain.cgi +++ b/html/cgi-bin/ovpnmain.cgi @@ -953,6 +953,7 @@ unless(-d "${General::swroot}/ovpn/n2nconf/$cgiparams{'NAME'}"){mkdir "${General print SERVERCONF "ifconfig $ovsubnet.1 $ovsubnet.2\n"; print SERVERCONF "# Client Gateway Network\n"; print SERVERCONF "route $remsubnet[0] $remsubnet[1]\n"; + print SERVERCONF "# Call up script for static routes\n"; print SERVERCONF "up \"/etc/init.d/static-routes start\"\n"; print SERVERCONF "# tun Device\n"; print SERVERCONF "dev tun\n"; @@ -1052,7 +1053,6 @@ unless(-d "${General::swroot}/ovpn/n2nconf/$cgiparams{'NAME'}"){mkdir "${General print CLIENTCONF "ifconfig $ovsubnet.2 $ovsubnet.1\n"; print CLIENTCONF "# Server Gateway Network\n"; print CLIENTCONF "route $remsubnet[0] $remsubnet[1]\n"; - print CLIENTCONF "up \"/etc/init.d/static-routes start\"\n"; print CLIENTCONF "# tun Device\n"; print CLIENTCONF "dev tun\n"; print CLIENTCONF "#Logfile for statistics\n"; @@ -3333,6 +3333,12 @@ END print FILE "status /var/run/openvpn/$n2nname[0]-n2n 10\n"; close FILE; + # Add static route command to client configuration + open(FILE, ">> $tempdir/$uplconffilename") or die 'Unable to open config file.'; + print FILE "# Call up script for static routes\n"; + print FILE "up \"/etc/init.d/static-routes start\"\n"; + close FILE; + move("$tempdir/$uplconffilename", "${General::swroot}/ovpn/n2nconf/$n2nname[0]/$uplconffilename2"); if ($? ne 0) { -- 2.39.2