diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2009-06-30 18:51:59 -0400 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2009-06-30 18:51:59 -0400 |
commit | fcc5aa7fa9bfe3b57aa0bd7f148ba7d409b68bb1 (patch) | |
tree | 7059660e3650b8aab2ebe60143ec32269f52537c /config | |
parent | 8938167b0efdda72f05f0aa1297f1132d09718cf (diff) | |
download | pfsense-packages-fcc5aa7fa9bfe3b57aa0bd7f148ba7d409b68bb1.tar.gz pfsense-packages-fcc5aa7fa9bfe3b57aa0bd7f148ba7d409b68bb1.tar.bz2 pfsense-packages-fcc5aa7fa9bfe3b57aa0bd7f148ba7d409b68bb1.zip |
Viscosity bundle exporter is working, at least it is a directory with the needed files called Viscosity.visc
Diffstat (limited to 'config')
-rwxr-xr-x | config/openvpn-client-export/openvpn-client-export.inc | 18 | ||||
-rwxr-xr-x | config/openvpn-client-export/vpn_openvpn_export.php | 4 |
2 files changed, 12 insertions, 10 deletions
diff --git a/config/openvpn-client-export/openvpn-client-export.inc b/config/openvpn-client-export/openvpn-client-export.inc index 14b2a007..9a384d01 100755 --- a/config/openvpn-client-export/openvpn-client-export.inc +++ b/config/openvpn-client-export/openvpn-client-export.inc @@ -256,7 +256,9 @@ function viscosity_openvpn_client_config_exporter($srvid, $usrid, $crtid, $usead global $config, $g; $ovpndir = "/usr/local/share/openvpn/"; - $tempdir = $g['tmp_path'] . "/openvpn-export-" . uniqid(); + $uniq = uniqid(); + $tempdir = $g['tmp_path'] . "/openvpn-export-" . $uniq; + $zipfile = $g['tmp_path'] . "{$uniq}-Viscosity.visc.zip"; // lookup server settings $settings = $config['openvpn']['openvpn-server'][$srvid]; @@ -283,14 +285,17 @@ function viscosity_openvpn_client_config_exporter($srvid, $usrid, $crtid, $usead // create template directory mkdir($tempdir, 0700, true); + mkdir($tempdir . "/Viscosity.visc", 0700, true); + + // Append new Viscosity.visc directory on top + $tempdir = $tempdir . "/Viscosity.visc"; // write cofiguration file $prefix = openvpn_client_export_prefix($srvid); - $cfgfile = "{$tempdir}/config.conf"; $conf = openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $usetoken); if (!$conf) return false; - file_put_contents($cfgfile, $conf); + file_put_contents("{$tempdir}/config.conf", $conf); // write key files $cafile = "{$tempdir}/{$prefix}-ca.crt"; @@ -312,15 +317,12 @@ function viscosity_openvpn_client_config_exporter($srvid, $usrid, $crtid, $usead openvpn_client_pem_to_pk12($p12file, $outpass, $crtfile, $keyfile, $cafile); // Zip Viscosity file - exec("/usr/local/bin/zip {$tempdir}.zip {$tempdir}"); - - // Read in file and deliver to client - $outfile = "{$tempdir}.zip"; + exec("cd {$tempdir}/.. && /usr/local/bin/zip {$zipfile} Viscosity.visc Viscosity.visc/*"); // Remove temporary directory exec("rm -rf {$tempdir}"); - return $outfile; + return $zipfile; } diff --git a/config/openvpn-client-export/vpn_openvpn_export.php b/config/openvpn-client-export/vpn_openvpn_export.php index 8eecdae0..1f10716a 100755 --- a/config/openvpn-client-export/vpn_openvpn_export.php +++ b/config/openvpn-client-export/vpn_openvpn_export.php @@ -133,7 +133,7 @@ if($act == "visc") { header("Content-Disposition: attachment; filename={$exp_name}"); header("Content-Length: $exp_size"); readfile($exp_path); - unlink($exp_path); + //unlink($exp_path); exit; } @@ -333,7 +333,7 @@ function usepass_changed() { <table border="0" cellpadding="2" cellspacing="0"> <tr> <td> - <input name="usepass" id="usepass" type="checkbox" onClick="usepass_changed()" checked> + <input name="usepass" id="usepass" type="checkbox" value="yes" onClick="usepass_changed()"> </td> <td> <span class="vexpl"> |