aboutsummaryrefslogtreecommitdiffstats
path: root/config/openvpn-client-export/openvpn-client-export.inc
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2011-11-29 11:58:50 -0500
committerjim-p <jimp@pfsense.org>2011-11-29 11:58:50 -0500
commit8490db315678c14c6b580e6d23718e8f089487c9 (patch)
treeaa0dd3c521fc925fd94e50f938361d1ecca9ac27 /config/openvpn-client-export/openvpn-client-export.inc
parent29d06ea57694cd1dc9ee59f395edb6436e04eec8 (diff)
downloadpfsense-packages-8490db315678c14c6b580e6d23718e8f089487c9.tar.gz
pfsense-packages-8490db315678c14c6b580e6d23718e8f089487c9.tar.bz2
pfsense-packages-8490db315678c14c6b580e6d23718e8f089487c9.zip
Add contributed patch to optionally encrypt the key for Viscosity bundles. Fixes #2032
Diffstat (limited to 'config/openvpn-client-export/openvpn-client-export.inc')
-rwxr-xr-xconfig/openvpn-client-export/openvpn-client-export.inc15
1 files changed, 13 insertions, 2 deletions
diff --git a/config/openvpn-client-export/openvpn-client-export.inc b/config/openvpn-client-export/openvpn-client-export.inc
index 234d7326..b9ac8866 100755
--- a/config/openvpn-client-export/openvpn-client-export.inc
+++ b/config/openvpn-client-export/openvpn-client-export.inc
@@ -541,8 +541,19 @@ EOF;
file_put_contents($crtfile, base64_decode($cert['crt']));
// write user .key
- $keyfile = "{$tempdir}/key.key";
- file_put_contents($keyfile, base64_decode($cert['prv']));
+ if (!empty($outpass)) {
+ $keyfile = "{$tempdir}/key.key";
+ $clearkeyfile = "{$tempdir}/key-clear.key";
+ file_put_contents($clearkeyfile, base64_decode($cert['prv']));
+ $eoutpass = escapeshellarg($outpass);
+ $ekeyfile = escapeshellarg($keyfile);
+ $eclearkeyfile = escapeshellarg($clearkeyfile);
+ exec("/usr/bin/openssl rsa -in ${eclearkeyfile} -out ${ekeyfile} -des3 -passout pass:${eoutpass}");
+ unlink($clearkeyfile);
+ } else {
+ $keyfile = "{$tempdir}/key.key";
+ file_put_contents($keyfile, base64_decode($cert['prv']));
+ }
}
// TLS support?