diff options
6 files changed, 57 insertions, 6 deletions
diff --git a/lang/en.json b/lang/en.json index d79972b525..723e1cf3c9 100644 --- a/lang/en.json +++ b/lang/en.json @@ -211,6 +211,9 @@ "FileIntegrityWarningReuploadBis": "Try to reupload all the Matomo files in BINARY mode.", "First": "First", "Flatten": "Flatten", + "ForcedSSL": "Forced SSL Connection", + "ForceSSLRecommended": "We recommend using Matomo over secure SSL connections only. To prevent insecure access over http add %1$s to %2$s section in Matomo config.", + "NotPossibleWithoutHttps": "Attention: Doing this without having set up an SSL certificate for using HTTPS will break Matomo.", "ForExampleShort": "eg.", "Forums": "Forums", "FromReferrer": "from", diff --git a/plugins/Diagnostics/Diagnostic/ForceSSLCheck.php b/plugins/Diagnostics/Diagnostic/ForceSSLCheck.php new file mode 100644 index 0000000000..de21240bf0 --- /dev/null +++ b/plugins/Diagnostics/Diagnostic/ForceSSLCheck.php @@ -0,0 +1,47 @@ +<?php +/** + * Matomo - free/libre analytics platform + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ +namespace Piwik\Plugins\Diagnostics\Diagnostic; + +use Piwik\Config; +use Piwik\ProxyHttp; +use Piwik\Translation\Translator; + +/** + * Check that Matomo is configured to force SSL. + */ +class ForceSSLCheck implements Diagnostic +{ + /** + * @var Translator + */ + private $translator; + + public function __construct(Translator $translator) + { + $this->translator = $translator; + } + + public function execute() + { + $label = $this->translator->translate('General_ForcedSSL'); + + $forceSSLEnabled = (Config::getInstance()->General['force_ssl'] == 1); + + if ($forceSSLEnabled) { + return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK)); + } + + $comment = $this->translator->translate('General_ForceSSLRecommended', ['<code>force_ssl = 1</code>', '<code>General</code>']); + + if (!ProxyHttp::isHttps()) { + $comment .= '<br /><br />' . $this->translator->translate('General_NotPossibleWithoutHttps'); + } + + return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment)); + } +} diff --git a/plugins/Diagnostics/config/config.php b/plugins/Diagnostics/config/config.php index 4e300166e7..13bf140925 100644 --- a/plugins/Diagnostics/config/config.php +++ b/plugins/Diagnostics/config/config.php @@ -25,6 +25,7 @@ return array( DI\get('Piwik\Plugins\Diagnostics\Diagnostic\CronArchivingCheck'), DI\get('Piwik\Plugins\Diagnostics\Diagnostic\LoadDataInfileCheck'), Di\get('Piwik\Plugins\Diagnostics\Diagnostic\DbOverSSLCheck'), + Di\get('Piwik\Plugins\Diagnostics\Diagnostic\ForceSSLCheck'), ), // Allows other plugins to disable diagnostics that were previously registered 'diagnostics.disabled' => array(), diff --git a/plugins/Installation/tests/UI/expected-screenshots/Installation_system_check.png b/plugins/Installation/tests/UI/expected-screenshots/Installation_system_check.png index 3a062b354b..78c4726389 100644 --- a/plugins/Installation/tests/UI/expected-screenshots/Installation_system_check.png +++ b/plugins/Installation/tests/UI/expected-screenshots/Installation_system_check.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bb68af70649e9cddb356225201426e0dc288337cc04e554cdb32695e1cb06637 -size 170620 +oid sha256:90f29f1bb86b432a0a6bea8e452a6541be8b6c5740f7a03937f9fc84d14cb92d +size 193273 diff --git a/tests/UI/expected-screenshots/UIIntegrationTest_admin_home.png b/tests/UI/expected-screenshots/UIIntegrationTest_admin_home.png index 84efb7a331..54030b0475 100644 --- a/tests/UI/expected-screenshots/UIIntegrationTest_admin_home.png +++ b/tests/UI/expected-screenshots/UIIntegrationTest_admin_home.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c2a89178eac618daed49e09e8daac71d19c747cde4b1ccd285da13f83042630e -size 132890 +oid sha256:6dbec78825603a2add17d3aa536494925728af3bb088f2c6466baf664ea4aa72 +size 135740 diff --git a/tests/UI/expected-screenshots/UIIntegrationTest_dashboard2.png b/tests/UI/expected-screenshots/UIIntegrationTest_dashboard2.png index 694c183669..5c050db18d 100644 --- a/tests/UI/expected-screenshots/UIIntegrationTest_dashboard2.png +++ b/tests/UI/expected-screenshots/UIIntegrationTest_dashboard2.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:98f56e5a7d5f91d90e6d957f2df008fe02e9b33d84febf0a9897df1507a30329 -size 1532686 +oid sha256:82979a5bd36ba56a41ce7ad036406ababc8d1509783391d5e07f31589b50d651 +size 1535773 |