aboutsummaryrefslogtreecommitdiffstats
path: root/config/openvpn-client-export/openvpn-client-export.inc
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2009-06-30 18:51:59 -0400
committerScott Ullrich <sullrich@pfsense.org>2009-06-30 18:51:59 -0400
commitfcc5aa7fa9bfe3b57aa0bd7f148ba7d409b68bb1 (patch)
tree7059660e3650b8aab2ebe60143ec32269f52537c /config/openvpn-client-export/openvpn-client-export.inc
parent8938167b0efdda72f05f0aa1297f1132d09718cf (diff)
downloadpfsense-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/openvpn-client-export/openvpn-client-export.inc')
-rwxr-xr-xconfig/openvpn-client-export/openvpn-client-export.inc18
1 files changed, 10 insertions, 8 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;
}