diff --git a/src/etc/inc/openvpn.inc b/src/etc/inc/openvpn.inc index 67a3de77a..bda04b680 100644 --- a/src/etc/inc/openvpn.inc +++ b/src/etc/inc/openvpn.inc @@ -212,9 +212,21 @@ function openvpn_get_digestlist() { return $digests; } -function openvpn_get_engines() { +function openvpn_get_engines() +{ + if (file_exists('/usr/local/bin/openssl')) { + /* use the ports version */ + $bin_openssl = '/usr/local/bin/openssl'; + } elseif (file_exists('/usr/bin/openssl')) { + /* use the base version (legacy fallback) */ + $bin_openssl = '/usr/bin/openssl'; + } else { + /* the infamous "this should never happen" */ + log_error(_('Could not find an OpenSSL implementation on your system.')); + } + $openssl_engines = array('none' => 'No Hardware Crypto Acceleration'); - exec("/usr/bin/openssl engine -t -c", $openssl_engine_output); + exec($bin_openssl . ' engine -t -c', $openssl_engine_output); $openssl_engine_output = implode("\n", $openssl_engine_output); $openssl_engine_output = preg_replace("/\\n\\s+/", "|", $openssl_engine_output); $openssl_engine_output = explode("\n", $openssl_engine_output);