diff options
author | jim-p <jim@pingle.org> | 2010-04-27 10:04:31 -0400 |
---|---|---|
committer | jim-p <jim@pingle.org> | 2010-04-27 10:07:46 -0400 |
commit | 88b1deff55bc9bc6daeeb89478eb564c18446b1c (patch) | |
tree | 7bce2dd73830a551a19a4e1d9d017b5b71a898fc /config/openvpn-client-export | |
parent | 0f34f2799deac46ce80825cd3d50ba06cc7a9866 (diff) | |
download | pfsense-packages-88b1deff55bc9bc6daeeb89478eb564c18446b1c.tar.gz pfsense-packages-88b1deff55bc9bc6daeeb89478eb564c18446b1c.tar.bz2 pfsense-packages-88b1deff55bc9bc6daeeb89478eb564c18446b1c.zip |
Define $cafile before use. Ticket #529
Diffstat (limited to 'config/openvpn-client-export')
-rwxr-xr-x | config/openvpn-client-export/openvpn-client-export.inc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/config/openvpn-client-export/openvpn-client-export.inc b/config/openvpn-client-export/openvpn-client-export.inc index 6db3651f..62a1989c 100755 --- a/config/openvpn-client-export/openvpn-client-export.inc +++ b/config/openvpn-client-export/openvpn-client-export.inc @@ -145,7 +145,7 @@ function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $usetoke $server_host = $useaddr; $server_port = $settings['local_port']; - $proto = ($settings['protocol'] == 'UDP' ? 'udp' : "tcp-client"); + $proto = (strtoupper($settings['protocol']) == 'UDP' ? 'udp' : "tcp-client"); $cipher = $settings['crypto']; @@ -184,15 +184,16 @@ function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $usetoke // add key settings $prefix = openvpn_client_export_prefix($srvid); + $cafile = "{$prefix}-ca.crt"; if($nokeys == false) { if ($usetoken) { - $conf .= "ca {$prefix}-ca.crt\n"; + $conf .= "ca {$cafile}\n"; $conf .= "cryptoapicert \"SUBJ:{$user['name']}\"\n"; } else { $conf .= "pkcs12 {$prefix}.p12\n"; } } else if ($settings['mode'] == "server_user") - $conf .= "ca {$prefix}-ca.crt\n"; + $conf .= "ca {$cafile}\n"; if ($settings['tls']) $conf .= "tls-auth {$prefix}-tls.key 1\n"; @@ -210,7 +211,8 @@ function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $usetoke file_put_contents("{$tempdir}/{$prefix}.ovpn", $conf); - file_put_contents("{$tempdir}/{$prefix}-ca.crt", base64_decode($server_ca['crt'])); + $cafile = "{$tempdir}/{$cafile}"; + file_put_contents("{$cafile}", base64_decode($server_ca['crt'])); if ($settings['tls']) { $tlsfile = "{$tempdir}/{$prefix}-tls.key"; file_put_contents($tlsfile, base64_decode($settings['tls'])); |