From a5633bb155e348bd0fce9ea703511de86308fab6 Mon Sep 17 00:00:00 2001 From: Frank Karlitschek Date: Sat, 31 Aug 2013 18:03:10 +0200 Subject: remove the config option that is no longer needed --- config/config.sample.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'config') diff --git a/config/config.sample.php b/config/config.sample.php index 5f748438bc7..0f6d686a511 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -71,9 +71,6 @@ $CONFIG = array( /* Enable the help menu item in the settings */ "knowledgebaseenabled" => true, -/* URL to use for the help page, server should understand OCS */ -"knowledgebaseurl" => "http://api.apps.owncloud.com/v1", - /* Enable installing apps from the appstore */ "appstoreenabled" => true, -- cgit v1.2.3 From fb34f49913e55731031a2e5c1b8041259df5c5ef Mon Sep 17 00:00:00 2001 From: Owen Winkler Date: Sun, 18 Aug 2013 13:11:48 -0400 Subject: Start a branch for easier OpenSSL configuration. --- apps/files_encryption/lib/crypt.php | 1 + apps/files_encryption/lib/helper.php | 12 +++++++++++- config/config.sample.php | 5 +++++ 3 files changed, 17 insertions(+), 1 deletion(-) (limited to 'config') diff --git a/apps/files_encryption/lib/crypt.php b/apps/files_encryption/lib/crypt.php index e129bc9313e..7eab620baa5 100755 --- a/apps/files_encryption/lib/crypt.php +++ b/apps/files_encryption/lib/crypt.php @@ -52,6 +52,7 @@ class Crypt { $return = false; + $res = \OCA\Encryption\Helper::getOpenSSLPkey(); $res = openssl_pkey_new(array('private_key_bits' => 4096)); if ($res === false) { diff --git a/apps/files_encryption/lib/helper.php b/apps/files_encryption/lib/helper.php index 0209a5d18b7..2cc905c2914 100755 --- a/apps/files_encryption/lib/helper.php +++ b/apps/files_encryption/lib/helper.php @@ -265,7 +265,7 @@ class Helper { * @return bool true if configuration seems to be OK */ public static function checkConfiguration() { - if(openssl_pkey_new(array('private_key_bits' => 4096))) { + if(self::getOpenSSLPkey()) { return true; } else { while ($msg = openssl_error_string()) { @@ -275,6 +275,16 @@ class Helper { } } + /** + * Create an openssl pkey with config-supplied settings + * @return resource The pkey resource created + */ + public static function getOpenSSLPkey() { + $config = array('private_key_bits' => 4096); + $config = array_merge(\OCP\Config::getSystemValue('openssl'), $config); + return openssl_pkey_new($config); + } + /** * @brief glob uses different pattern than regular expressions, escape glob pattern only * @param unescaped path diff --git a/config/config.sample.php b/config/config.sample.php index 5f748438bc7..6425baf87cb 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -214,4 +214,9 @@ $CONFIG = array( 'preview_libreoffice_path' => '/usr/bin/libreoffice', /* cl parameters for libreoffice / openoffice */ 'preview_office_cl_parameters' => '', + +// Extra SSL options to be used for configuration +'openssl' => array( + //'config' => '/path/to/openssl.cnf', +), ); -- cgit v1.2.3 From 9a263a500abb6e6eaf482fcb962fcd9d652e076c Mon Sep 17 00:00:00 2001 From: Owen Winkler Date: Mon, 19 Aug 2013 06:36:19 -0400 Subject: Employ config option for OpenSSL config file, if provided. This should help make OpenSSL configuration on Windows servers easier by allowing the openssl.cnf file to be set directly in the ownCloud config, rather than in SetEnv commands that don't exist and are hard to replicate in IIS. --- apps/files_encryption/lib/crypt.php | 9 +++++---- apps/files_encryption/lib/helper.php | 17 +++++++++++++++-- config/config.sample.php | 2 +- 3 files changed, 21 insertions(+), 7 deletions(-) (limited to 'config') diff --git a/apps/files_encryption/lib/crypt.php b/apps/files_encryption/lib/crypt.php index 7eab620baa5..c009718160a 100755 --- a/apps/files_encryption/lib/crypt.php +++ b/apps/files_encryption/lib/crypt.php @@ -52,15 +52,14 @@ class Crypt { $return = false; - $res = \OCA\Encryption\Helper::getOpenSSLPkey(); - $res = openssl_pkey_new(array('private_key_bits' => 4096)); + $res = Helper::getOpenSSLPkey(); if ($res === false) { \OCP\Util::writeLog('Encryption library', 'couldn\'t generate users key-pair for ' . \OCP\User::getUser(), \OCP\Util::ERROR); while ($msg = openssl_error_string()) { \OCP\Util::writeLog('Encryption library', 'openssl_pkey_new() fails: ' . $msg, \OCP\Util::ERROR); } - } elseif (openssl_pkey_export($res, $privateKey)) { + } elseif (openssl_pkey_export($res, $privateKey, null, Helper::getOpenSSLConfig())) { // Get public key $keyDetails = openssl_pkey_get_details($res); $publicKey = $keyDetails['key']; @@ -71,7 +70,9 @@ class Crypt { ); } else { \OCP\Util::writeLog('Encryption library', 'couldn\'t export users private key, please check your servers openSSL configuration.' . \OCP\User::getUser(), \OCP\Util::ERROR); - \OCP\Util::writeLog('Encryption library', openssl_error_string(), \OCP\Util::ERROR); + while($errMsg = openssl_error_string()) { + \OCP\Util::writeLog('Encryption library', $errMsg, \OCP\Util::ERROR); + } } return $return; diff --git a/apps/files_encryption/lib/helper.php b/apps/files_encryption/lib/helper.php index 2cc905c2914..10447a07bb8 100755 --- a/apps/files_encryption/lib/helper.php +++ b/apps/files_encryption/lib/helper.php @@ -280,9 +280,22 @@ class Helper { * @return resource The pkey resource created */ public static function getOpenSSLPkey() { + static $res = null; + if (is_null($res)) { + $res = openssl_pkey_new(self::getOpenSSLConfig()); + } + return $res; + } + + /** + * Return an array of OpenSSL config options, default + config + * Used for multiple OpenSSL functions + * @return array The combined defaults and config settings + */ + public static function getOpenSSLConfig() { $config = array('private_key_bits' => 4096); - $config = array_merge(\OCP\Config::getSystemValue('openssl'), $config); - return openssl_pkey_new($config); + $config = array_merge(\OCP\Config::getSystemValue('openssl', array()), $config); + return $config; } /** diff --git a/config/config.sample.php b/config/config.sample.php index 6425baf87cb..51ef60588d6 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -217,6 +217,6 @@ $CONFIG = array( // Extra SSL options to be used for configuration 'openssl' => array( - //'config' => '/path/to/openssl.cnf', + //'config' => '/absolute/location/of/openssl.cnf', ), ); -- cgit v1.2.3