aboutsummaryrefslogtreecommitdiffstats
path: root/config/openvpn-client-export
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2009-07-01 01:40:30 -0400
committerScott Ullrich <sullrich@pfsense.org>2009-07-01 01:40:30 -0400
commit2a1ad3e188a7d0f31d41e7f5e2953566196fdcd1 (patch)
treee0361d672ef20109ea4ea2ec4f572882a4e1e2e7 /config/openvpn-client-export
parenta4387207d65a4a757e10b3619da284c5878cc9ff (diff)
downloadpfsense-packages-2a1ad3e188a7d0f31d41e7f5e2953566196fdcd1.tar.gz
pfsense-packages-2a1ad3e188a7d0f31d41e7f5e2953566196fdcd1.tar.bz2
pfsense-packages-2a1ad3e188a7d0f31d41e7f5e2953566196fdcd1.zip
Do not duplicate key lines
Diffstat (limited to 'config/openvpn-client-export')
-rwxr-xr-xconfig/openvpn-client-export/openvpn-client-export.inc24
1 files changed, 14 insertions, 10 deletions
diff --git a/config/openvpn-client-export/openvpn-client-export.inc b/config/openvpn-client-export/openvpn-client-export.inc
index 08f8390b..85122988 100755
--- a/config/openvpn-client-export/openvpn-client-export.inc
+++ b/config/openvpn-client-export/openvpn-client-export.inc
@@ -84,7 +84,7 @@ function openvpn_client_pem_to_pk12($outpath, $outpass, $crtpath, $keypath, $cap
unlink($capath);
}
-function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $usetoken) {
+function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $usetoken, $nokeys = false) {
global $config;
// lookup server settings
@@ -140,15 +140,19 @@ function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $usetoke
// add key settings
$prefix = openvpn_client_export_prefix($srvid);
- if ($usetoken) {
- $conf .= "ca {$prefix}-ca.crt\n";
- $conf .= "cryptoapicert \"SUBJ:{$user['name']}\"\n";
- } else {
- $conf .= "pkcs12 {$prefix}.p12\n";
+ if(!$nokeys) {
+ if ($usetoken) {
+ $conf .= "ca {$prefix}-ca.crt\n";
+ $conf .= "cryptoapicert \"SUBJ:{$user['name']}\"\n";
+ } else {
+ $conf .= "pkcs12 {$prefix}.p12\n";
+ }
}
- if ($settings['tls'])
- $conf .= "tls-auth {$prefix}-tls.key\n";
+ if(!$nokeys) {
+ if ($settings['tls'])
+ $conf .= "tls-auth {$prefix}-tls.key\n";
+ }
// add optional settings
if ($settings['compression'])
@@ -203,7 +207,7 @@ function openvpn_client_export_installer($srvid, $usrid, $crtid, $useaddr, $uset
// write cofiguration file
$prefix = openvpn_client_export_prefix($srvid);
$cfgfile = "{$confdir}/{$prefix}-config.ovpn";
- $conf = openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $usetoken);
+ $conf = openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $usetoken, false);
if (!$conf)
return false;
file_put_contents($cfgfile, $conf);
@@ -293,7 +297,7 @@ function viscosity_openvpn_client_config_exporter($srvid, $usrid, $crtid, $usead
// write cofiguration file
$prefix = openvpn_client_export_prefix($srvid);
- $conf = openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $usetoken);
+ $conf = openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $usetoken, true);
if (!$conf)
return false;