From 68669f0ebca6c7412c5ca9d547d231d26be7568c Mon Sep 17 00:00:00 2001 From: Matthew Grooms Date: Wed, 17 Sep 2008 05:44:01 +0000 Subject: Add a new OpenVPN client configuration and installer export package. It will create and export a config file or pre-configured windows installer based on the server configuration and user information. --- .../client-export/template/7zS.sfx | Bin 0 -> 132096 bytes .../client-export/template/config-import | 3 + .../client-export/template/config-standard | 3 + .../client-export/template/openvpn-postinstall.exe | Bin 0 -> 63001 bytes .../client-export/template/procchain-import | 2 + .../client-export/template/procchain-standard | 2 + .../client-export/template/procchain.exe | Bin 0 -> 65536 bytes .../client-export/vpn_openvpn_export.php | 362 +++++++++++++++++++++ 8 files changed, 372 insertions(+) create mode 100755 packages/openvpn-client-export/client-export/template/7zS.sfx create mode 100755 packages/openvpn-client-export/client-export/template/config-import create mode 100755 packages/openvpn-client-export/client-export/template/config-standard create mode 100755 packages/openvpn-client-export/client-export/template/openvpn-postinstall.exe create mode 100755 packages/openvpn-client-export/client-export/template/procchain-import create mode 100755 packages/openvpn-client-export/client-export/template/procchain-standard create mode 100755 packages/openvpn-client-export/client-export/template/procchain.exe create mode 100755 packages/openvpn-client-export/client-export/vpn_openvpn_export.php (limited to 'packages/openvpn-client-export/client-export') diff --git a/packages/openvpn-client-export/client-export/template/7zS.sfx b/packages/openvpn-client-export/client-export/template/7zS.sfx new file mode 100755 index 00000000..f72ac75e Binary files /dev/null and b/packages/openvpn-client-export/client-export/template/7zS.sfx differ diff --git a/packages/openvpn-client-export/client-export/template/config-import b/packages/openvpn-client-export/client-export/template/config-import new file mode 100755 index 00000000..6b4465c2 --- /dev/null +++ b/packages/openvpn-client-export/client-export/template/config-import @@ -0,0 +1,3 @@ +;!@Install@!UTF-8! +RunProgram="procchain.exe procchain-import" +;!@InstallEnd@! diff --git a/packages/openvpn-client-export/client-export/template/config-standard b/packages/openvpn-client-export/client-export/template/config-standard new file mode 100755 index 00000000..19e410e9 --- /dev/null +++ b/packages/openvpn-client-export/client-export/template/config-standard @@ -0,0 +1,3 @@ +;!@Install@!UTF-8! +RunProgram="procchain.exe procchain-standard" +;!@InstallEnd@! diff --git a/packages/openvpn-client-export/client-export/template/openvpn-postinstall.exe b/packages/openvpn-client-export/client-export/template/openvpn-postinstall.exe new file mode 100755 index 00000000..903885d8 Binary files /dev/null and b/packages/openvpn-client-export/client-export/template/openvpn-postinstall.exe differ diff --git a/packages/openvpn-client-export/client-export/template/procchain-import b/packages/openvpn-client-export/client-export/template/procchain-import new file mode 100755 index 00000000..3b7c74fb --- /dev/null +++ b/packages/openvpn-client-export/client-export/template/procchain-import @@ -0,0 +1,2 @@ +"openvpn-install.exe" +"openvpn-postinstall.exe" /Import diff --git a/packages/openvpn-client-export/client-export/template/procchain-standard b/packages/openvpn-client-export/client-export/template/procchain-standard new file mode 100755 index 00000000..b9d1a1e5 --- /dev/null +++ b/packages/openvpn-client-export/client-export/template/procchain-standard @@ -0,0 +1,2 @@ +"openvpn-install.exe" +"openvpn-postinstall.exe" diff --git a/packages/openvpn-client-export/client-export/template/procchain.exe b/packages/openvpn-client-export/client-export/template/procchain.exe new file mode 100755 index 00000000..924e7a47 Binary files /dev/null and b/packages/openvpn-client-export/client-export/template/procchain.exe differ diff --git a/packages/openvpn-client-export/client-export/vpn_openvpn_export.php b/packages/openvpn-client-export/client-export/vpn_openvpn_export.php new file mode 100755 index 00000000..e5d474cb --- /dev/null +++ b/packages/openvpn-client-export/client-export/vpn_openvpn_export.php @@ -0,0 +1,362 @@ + & $server) { + $ras_user = array(); + if (stripos($server['mode'], "server") === false) + continue; + foreach($a_user as $uindex => & $user) { + if (!is_array($user['cert'])) + continue; + foreach($user['cert'] as $cindex => & $cert) { + if ($cert['caref'] != $server['caref']) + continue; + $ras_userent = array(); + $ras_userent['uindex'] = $uindex; + $ras_userent['cindex'] = $cindex; + $ras_userent['name'] = $user['name']; + $ras_userent['certname'] = $cert['name']; + $ras_user[] = $ras_userent; + } + } + if (!count($ras_user)) + continue; + $ras_serverent = array(); + $prot = $server['protocol']; + $port = $server['local_port']; + if ($server['description']) + $name = "{$server['description']} {$prot}:{$port}"; + else + $name = "Server {$prot}:{$port}"; + $ras_serverent['index'] = $sindex; + $ras_serverent['name'] = $name; + $ras_serverent['users'] = $ras_user; + $ras_server[] = $ras_serverent; +} + +$id = $_GET['id']; +if (isset($_POST['id'])) + $id = $_POST['id']; + +$act = $_GET['act']; +if (isset($_POST['act'])) + $act = $_POST['act']; + +if($act == "conf") { + $srvid = $_GET['srvid']; + $usrid = $_GET['usrid']; + $crtid = $_GET['crtid']; + if (($srvid === false) || ($usrid === false) || ($crtid === false)) { + pfSenseHeader("vpn_openvpn_export.php"); + exit; + } + $useaddr = $_GET['useaddr']; + $usetoken = $_GET['usetoken']; + + $exp_name = openvpn_client_export_prefix($srvid); + $exp_name = urlencode($exp_name."-config.ovpn"); + $exp_data = openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $usetoken); + $exp_size = strlen($exp_data); + + header("Content-Type: application/octet-stream"); + header("Content-Disposition: attachment; filename={$exp_name}"); + header("Content-Length: $exp_size"); + echo $exp_data; + exit; +} + +if($act == "inst") { + $srvid = $_GET['srvid']; + $usrid = $_GET['usrid']; + $crtid = $_GET['crtid']; + if (($srvid === false) || ($usrid === false) || ($crtid === false)) { + pfSenseHeader("vpn_openvpn_export.php"); + exit; + } + $useaddr = $_GET['useaddr']; + $usetoken = $_GET['usetoken']; + $password = ""; + if ($_GET['password']) + $password = $_GET['password']; ; + + $exp_name = openvpn_client_export_prefix($srvid); + $exp_name = urlencode($exp_name."-install.exe"); + $exp_path = openvpn_client_export_installer($srvid, $usrid, $crtid, $useaddr, $usetoken, $password); + $exp_size = filesize($exp_path); + + header("Content-Type: application/octet-stream"); + header("Content-Disposition: attachment; filename={$exp_name}"); + header("Content-Length: $exp_size"); + readfile($exp_path); + unlink($exp_path); + exit; +} + +include("head.inc"); + +?> + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + + + + + + + + + + +
Remote Access Server + +
Host Name Resolution + + + + + +
+ + + + Use the server IP address instead of the hostname. + +
+
Certificate Export Options + + + + + +
+ + + + Use Microsoft Certificate Storage instead of local files. + +
+ + + + + +
+ + + + Use a password to protect the pkcs12 file contents. + +
+ + + + + + + + + +
+ +  Password :  + + + +
+ +  Confirm :  + + + +
+
 
Client Install Packages
+ + + + + + +
+
+
+ + + -- cgit v1.2.3