From 93275f53e8333681125c9bb9d4d4f2ae7b0c7067 Mon Sep 17 00:00:00 2001 From: Kyle Johnston Date: Fri, 28 Aug 2015 18:35:32 -0500 Subject: Replaced lookup_ca($server_cert['caref']) with ca_chain($server_cert). Note that ca_chain returns a string of Base64 encoded certificates, not an array. Thus, all references to base64_decode($server_ca['crt']) have been replaced with simply $server_ca. Additionally, incremented package version from 1.2.19 to 1.2.20. --- config/openvpn-client-export/openvpn-client-export.inc | 14 +++++++------- config/openvpn-client-export/openvpn-client-export.xml | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/config/openvpn-client-export/openvpn-client-export.inc b/config/openvpn-client-export/openvpn-client-export.inc index 4dbc7302..2ecb436b 100755 --- a/config/openvpn-client-export/openvpn-client-export.inc +++ b/config/openvpn-client-export/openvpn-client-export.inc @@ -127,7 +127,7 @@ function openvpn_client_export_validate_config($srvid, $usrid, $crtid) { if (!$server_cert) { $input_errors[] = "Could not locate server certificate."; } else { - $server_ca = lookup_ca($server_cert['caref']); + $server_ca = ca_chain($server_cert); if (!$server_ca) { $input_errors[] = "Could not locate the CA reference for the server certificate."; } @@ -380,7 +380,7 @@ function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $verifys file_put_contents("{$tempdir}/{$prefix}.ovpn", $conf); $cafile = "{$tempdir}/{$cafile}"; - file_put_contents("{$cafile}", base64_decode($server_ca['crt'])); + file_put_contents("{$cafile}", $server_ca); if ($settings['tls']) { $tlsfile = "{$tempdir}/{$prefix}-tls.key"; file_put_contents($tlsfile, base64_decode($settings['tls'])); @@ -414,7 +414,7 @@ function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $verifys case "inlinedroid": case "inlineios": // Inline CA - $conf .= "{$nl}" . trim(base64_decode($server_ca['crt'])) . "{$nl}{$nl}"; + $conf .= "{$nl}" . trim($server_ca) . "{$nl}{$nl}"; if ($settings['mode'] != "server_user") { // Inline Cert $conf .= "{$nl}" . trim(base64_decode($cert['crt'])) . "{$nl}{$nl}"; @@ -442,7 +442,7 @@ function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $verifys file_put_contents("{$tempdir}/vpn.cnf", $conf); $cafile = "{$keydir}/ca.crt"; - file_put_contents("{$cafile}", base64_decode($server_ca['crt'])); + file_put_contents("{$cafile}", $server_ca); if ($settings['tls']) { $tlsfile = "{$keydir}/ta.key"; file_put_contents($tlsfile, base64_decode($settings['tls'])); @@ -468,7 +468,7 @@ function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $verifys file_put_contents("{$tempdir}/vpn.cnf", $conf); $cafile = "{$tempdir}/ca.crt"; - file_put_contents("{$cafile}", base64_decode($server_ca['crt'])); + file_put_contents("{$cafile}", $server_ca); if ($settings['tls']) { $tlsfile = "{$tempdir}/ta.key"; file_put_contents($tlsfile, base64_decode($settings['tls'])); @@ -561,7 +561,7 @@ function openvpn_client_export_installer($srvid, $usrid, $crtid, $useaddr, $veri file_put_contents($cfgfile, $conf); $cafile = "{$tempdir}/config/{$prefix}-ca.crt"; - file_put_contents($cafile, base64_decode($server_ca['crt'])); + file_put_contents($cafile, $server_ca); if ($settings['tls']) { $tlsfile = "{$tempdir}/config/{$prefix}-tls.key"; file_put_contents($tlsfile, base64_decode($settings['tls'])); @@ -697,7 +697,7 @@ EOF; // write ca $cafile = "{$tempdir}/ca.crt"; - file_put_contents($cafile, base64_decode($server_ca['crt'])); + file_put_contents($cafile, $server_ca); if ($settings['mode'] != "server_user") { diff --git a/config/openvpn-client-export/openvpn-client-export.xml b/config/openvpn-client-export/openvpn-client-export.xml index 1a150dc5..f1d032a9 100755 --- a/config/openvpn-client-export/openvpn-client-export.xml +++ b/config/openvpn-client-export/openvpn-client-export.xml @@ -44,7 +44,7 @@ ]]> OpenVPN Client Export - 1.2.19 + 1.2.20 OpenVPN Client Export /usr/local/pkg/openvpn-client-export.inc -- cgit v1.2.3