From 3c2e5528d2fb27b6a10bd02065bda1e2d9140280 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Fri, 2 Sep 2005 22:27:44 +0000 Subject: Import OpenVPN 1.2 settings(m0n0wall) from Peter Allgeyer --- usr/local/www/vpn_openvpn_cli.php | 68 +++++++++++++++++++++++++-------------- 1 file changed, 44 insertions(+), 24 deletions(-) (limited to 'usr/local/www/vpn_openvpn_cli.php') diff --git a/usr/local/www/vpn_openvpn_cli.php b/usr/local/www/vpn_openvpn_cli.php index c574483..b9d88f1 100755 --- a/usr/local/www/vpn_openvpn_cli.php +++ b/usr/local/www/vpn_openvpn_cli.php @@ -28,6 +28,7 @@ POSSIBILITY OF SUCH DAMAGE. */ +$pgtitle = array("VPN", "OpenVPN"); require("guiconfig.inc"); require_once("openvpn.inc"); @@ -38,37 +39,48 @@ if (!is_array($config['ovpn']['client'])){ $config['ovpn']['client']['tunnel'] = array(); } +$id = $_GET['id']; +if (isset($_POST['id'])) + $id = $_POST['id']; + $ovpncli =& $config['ovpn']['client']['tunnel']; if ($_POST['apply']) { $retval = 0; - ovpn_lock(); - $retval = ovpn_config_client(); - ovpn_unlock(); + if (file_exists($d_sysrebootreqd_path)) { + /* Rewrite interface definitions */ + $retval = ovpn_client_iface(); + } + else{ + ovpn_lock(); + $retval = ovpn_config_client(); + ovpn_unlock(); + } if (file_exists($d_ovpnclidirty_path)) unlink($d_ovpnclidirty_path); $savemsg = get_std_save_message($retval); } if ($_GET['act'] == "del") { - if ($ovpncli[$_GET['id']]) { - unset($ovpncli[$_GET['id']]); + if ($ovpncli[$id]) { + $ovpnent = $ovpncli[$id]; + unset($ovpncli[$id]); + + /* Kill running processes */ + /* Remove old certs & keys */ + ovpn_client_kill($ovpnent['if']); + + /* Remove interface from list of optional interfaces */ + ovpn_client_iface_del($ovpnent['if']); + write_config(); - ovpn_client_kill($_GET['id']); - touch($d_ovpnclidirty_path); + touch($d_sysrebootreqd_path); header("Location: vpn_openvpn_cli.php"); exit; } } - -$pgtitle = "VPN: OpenVPN: Client"; -include("head.inc"); - ?> - - -

@@ -80,7 +92,7 @@ include("head.inc"); @@ -93,9 +105,11 @@ include("head.inc");
- - - + + + + + @@ -110,7 +124,13 @@ include("head.inc"); + + - + - - + +
InterfaceServer addressVersionDescriptionProtocolSocketServer addressVersionDescription
- + + + + + @@ -119,15 +139,15 @@ include("head.inc"); - +   -   +  
   
-- cgit v1.1