Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeoff Waggott <gwaggott@gmail.com>2018-04-02 04:36:58 +0300
committerBenaka <diosmosis@users.noreply.github.com>2018-04-02 04:36:58 +0300
commit0a46f181bf69cc6627f5dc67aab32684fdf76574 (patch)
tree989901d9292f225c2644a99f9a9faae68593d048 /plugins/Diagnostics
parentec2bb305723fbb43d302947c4833071a68ad4f93 (diff)
Mysql SSL connection support from pull request #8049 (#10866)
* Mysql SSL connection support from pull request #8049 * updated minified js * Add ssl_no_verify config option for skipping certificate verification (works only on some PHP setups). * Remove TODO comment from DbOverSSLCheck diagnostic, will create issue. * Skip test if SSL is not enabled * Undo changes to piwik.js for tests. * Tweak to DbSSLTest.
Diffstat (limited to 'plugins/Diagnostics')
-rw-r--r--plugins/Diagnostics/Diagnostic/DbOverSSLCheck.php62
-rw-r--r--plugins/Diagnostics/config/config.php1
2 files changed, 63 insertions, 0 deletions
diff --git a/plugins/Diagnostics/Diagnostic/DbOverSSLCheck.php b/plugins/Diagnostics/Diagnostic/DbOverSSLCheck.php
new file mode 100644
index 0000000000..07b8942da5
--- /dev/null
+++ b/plugins/Diagnostics/Diagnostic/DbOverSSLCheck.php
@@ -0,0 +1,62 @@
+<?php
+
+namespace Piwik\Plugins\Diagnostics\Diagnostic;
+
+use Piwik\Common;
+use Piwik\Config;
+use Piwik\Db;
+use Piwik\Translation\Translator;
+
+/**
+ * Check if Piwik is connected with database through ssl.
+ */
+class DbOverSSLCheck implements Diagnostic
+{
+ /**
+ * @var Translator
+ */
+ private $translator;
+
+ public function __construct(Translator $translator)
+ {
+ $this->translator = $translator;
+ }
+
+ public function execute()
+ {
+ $enable_ssl = Config::getInstance()->database['enable_ssl'];
+ if (!$enable_ssl) {
+ return array();
+ }
+
+ $label = $this->translator->translate('Installation_SystemCheckDatabaseSSL');
+
+ $cipher = Db::fetchRow("show status like 'Ssl_cipher'");
+ if(!empty($cipher['Value'])) {
+ return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK, $this->translator->translate('Installation_SystemCheckDatabaseSSLCipher') . ': ' . $cipher['Value']));
+ }
+
+ //no cipher, not working
+ $comment = sprintf($this->translator->translate('Installation_SystemCheckDatabaseSSLNotWorking'), "enable_ssl") . "<br />";
+
+ // test ssl support
+ $ssl_support = Db::fetchRow("SHOW VARIABLES LIKE 'have_ssl'");
+ if(!empty($ssl_support['Value'])) {
+ switch ($ssl_support['Value']) {
+ case 'YES':
+ $comment .= $this->translator->translate('Installation_SystemCheckDatabaseSSLOn');
+ break;
+ case 'DISABLED':
+ $comment .= $this->translator->translate('Installation_SystemCheckDatabaseSSLDisabled');
+ break;
+ case 'NO':
+ $comment .= $this->translator->translate('Installation_SystemCheckDatabaseSSLNo');
+ break;
+ }
+ }
+
+ $comment .= '<br />' . '<a target="_blank" href="?module=Proxy&action=redirect&url=http://piwik.org/faq/"> FAQ on piwik.org</a>';
+
+ return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment));
+ }
+}
diff --git a/plugins/Diagnostics/config/config.php b/plugins/Diagnostics/config/config.php
index 566b476535..4e300166e7 100644
--- a/plugins/Diagnostics/config/config.php
+++ b/plugins/Diagnostics/config/config.php
@@ -24,6 +24,7 @@ return array(
DI\get('Piwik\Plugins\Diagnostics\Diagnostic\NfsDiskCheck'),
DI\get('Piwik\Plugins\Diagnostics\Diagnostic\CronArchivingCheck'),
DI\get('Piwik\Plugins\Diagnostics\Diagnostic\LoadDataInfileCheck'),
+ Di\get('Piwik\Plugins\Diagnostics\Diagnostic\DbOverSSLCheck'),
),
// Allows other plugins to disable diagnostics that were previously registered
'diagnostics.disabled' => array(),