diff options
author | PiBa-NL <pba_2k3@yahoo.com> | 2012-11-21 23:25:37 +0100 |
---|---|---|
committer | PiBa-NL <pba_2k3@yahoo.com> | 2012-11-21 23:25:37 +0100 |
commit | 139ee999295b3d99beb2dc933b037249463c3a8d (patch) | |
tree | 61efeced7bca72699202ccbed2531963587a3c50 /config | |
parent | 43eb7bc003dd6b9b2725d0c9e6fb37a243bfde29 (diff) | |
download | pfsense-packages-139ee999295b3d99beb2dc933b037249463c3a8d.tar.gz pfsense-packages-139ee999295b3d99beb2dc933b037249463c3a8d.tar.bz2 pfsense-packages-139ee999295b3d99beb2dc933b037249463c3a8d.zip |
openvpn-client-export, use certificate common-name in the exported files filenames.
Diffstat (limited to 'config')
-rwxr-xr-x | config/openvpn-client-export/openvpn-client-export.inc | 12 | ||||
-rwxr-xr-x | config/openvpn-client-export/vpn_openvpn_export.php | 2 |
2 files changed, 8 insertions, 6 deletions
diff --git a/config/openvpn-client-export/openvpn-client-export.inc b/config/openvpn-client-export/openvpn-client-export.inc index 1ab962da..27ddaa87 100755 --- a/config/openvpn-client-export/openvpn-client-export.inc +++ b/config/openvpn-client-export/openvpn-client-export.inc @@ -61,7 +61,7 @@ function openvpn_client_export_deinstall() { conf_mount_ro(); } -function openvpn_client_export_prefix($srvid, $usrid = null) { +function openvpn_client_export_prefix($srvid, $usrid = null, $crtid = null) { global $config; // lookup server settings @@ -79,6 +79,8 @@ function openvpn_client_export_prefix($srvid, $usrid = null) { //$config['openvpn']['openvpn-server']; if ($usrid && is_numeric($usrid)) $username = "-".$config['system']['user'][$usrid]['name']; + if ($crtid && is_numeric($crtid)) + $username = "-".$config['cert'][$crtid]['descr']; return "{$host}-{$prot}-{$port}{$username}"; } @@ -216,7 +218,7 @@ function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $quotese $conf .= "http-proxy {$proxy['ip']} {$proxy['port']} "; if ($proxy['proxy_authtype'] != "none") { if (!isset($proxy['passwdfile'])) - $proxy['passwdfile'] = openvpn_client_export_prefix($srvid, $usrid) . "-proxy"; + $proxy['passwdfile'] = openvpn_client_export_prefix($srvid, $usrid, $crtid) . "-proxy"; $conf .= " {$proxy['passwdfile']} {$proxy['proxy_authtype']}"; } $conf .= "{$nl}"; @@ -231,7 +233,7 @@ function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $quotese } // add key settings - $prefix = openvpn_client_export_prefix($srvid, $usrid); + $prefix = openvpn_client_export_prefix($srvid, $usrid, $crtid); $cafile = "{$prefix}-ca.crt"; if($nokeys == false) { if ($expformat == "inline") { @@ -478,7 +480,7 @@ function openvpn_client_export_installer($srvid, $usrid, $crtid, $useaddr, $quot exec("/bin/cp {$tempdir}/{$client_install_exe} {$tempdir}/openvpn-install.exe"); // write configuration file - $prefix = openvpn_client_export_prefix($srvid, $usrid); + $prefix = openvpn_client_export_prefix($srvid, $usrid, $crtid); $cfgfile = "{$confdir}/{$prefix}-config.ovpn"; if (!empty($proxy) && $proxy['proxy_authtype'] != "none") { $proxy['passwdfile'] = "{$prefix}-password"; @@ -580,7 +582,7 @@ function viscosity_openvpn_client_config_exporter($srvid, $usrid, $crtid, $usead $tempdir = $tempdir . "/Viscosity.visc/"; // write cofiguration file - $prefix = openvpn_client_export_prefix($srvid, $usrid); + $prefix = openvpn_client_export_prefix($srvid, $usrid, $crtid); if (!empty($proxy) && $proxy['proxy_authtype'] != "none") { $proxy['passwdfile'] = "config-password"; $pwdfle = "{$proxy['user']}\n"; diff --git a/config/openvpn-client-export/vpn_openvpn_export.php b/config/openvpn-client-export/vpn_openvpn_export.php index e7c94ae6..85d44177 100755 --- a/config/openvpn-client-export/vpn_openvpn_export.php +++ b/config/openvpn-client-export/vpn_openvpn_export.php @@ -172,7 +172,7 @@ if (!empty($act)) { } } - $exp_name = openvpn_client_export_prefix($srvid, $usrid); + $exp_name = openvpn_client_export_prefix($srvid, $usrid, $crtid); if(substr($act, 0, 4) == "conf") { switch ($act) { |