mirror of
https://github.com/nextcloud/server.git
synced 2026-04-05 09:06:35 -04:00
Add setup check that links to the migration documentation
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
parent
8928bbe969
commit
603d7dab5e
6 changed files with 77 additions and 2 deletions
|
|
@ -54,6 +54,7 @@ return array(
|
|||
'OCA\\Settings\\Settings\\Personal\\Security\\TwoFactor' => $baseDir . '/../lib/Settings/Personal/Security/TwoFactor.php',
|
||||
'OCA\\Settings\\Settings\\Personal\\Security\\WebAuthn' => $baseDir . '/../lib/Settings/Personal/Security/WebAuthn.php',
|
||||
'OCA\\Settings\\Settings\\Personal\\ServerDevNotice' => $baseDir . '/../lib/Settings/Personal/ServerDevNotice.php',
|
||||
'OCA\\Settings\\SetupChecks\\LegacySSEKeyFormat' => $baseDir . '/../lib/SetupChecks/LegacySSEKeyFormat.php',
|
||||
'OCA\\Settings\\SetupChecks\\PhpDefaultCharset' => $baseDir . '/../lib/SetupChecks/PhpDefaultCharset.php',
|
||||
'OCA\\Settings\\SetupChecks\\PhpOutputBuffering' => $baseDir . '/../lib/SetupChecks/PhpOutputBuffering.php',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ class ComposerStaticInitSettings
|
|||
'OCA\\Settings\\Settings\\Personal\\Security\\TwoFactor' => __DIR__ . '/..' . '/../lib/Settings/Personal/Security/TwoFactor.php',
|
||||
'OCA\\Settings\\Settings\\Personal\\Security\\WebAuthn' => __DIR__ . '/..' . '/../lib/Settings/Personal/Security/WebAuthn.php',
|
||||
'OCA\\Settings\\Settings\\Personal\\ServerDevNotice' => __DIR__ . '/..' . '/../lib/Settings/Personal/ServerDevNotice.php',
|
||||
'OCA\\Settings\\SetupChecks\\LegacySSEKeyFormat' => __DIR__ . '/..' . '/../lib/SetupChecks/LegacySSEKeyFormat.php',
|
||||
'OCA\\Settings\\SetupChecks\\PhpDefaultCharset' => __DIR__ . '/..' . '/../lib/SetupChecks/PhpDefaultCharset.php',
|
||||
'OCA\\Settings\\SetupChecks\\PhpOutputBuffering' => __DIR__ . '/..' . '/../lib/SetupChecks/PhpOutputBuffering.php',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ use OC\DB\SchemaWrapper;
|
|||
use OC\IntegrityCheck\Checker;
|
||||
use OC\Lock\NoopLockingProvider;
|
||||
use OC\MemoryInfo;
|
||||
use OCA\Settings\SetupChecks\LegacySSEKeyFormat;
|
||||
use OCA\Settings\SetupChecks\PhpDefaultCharset;
|
||||
use OCA\Settings\SetupChecks\PhpOutputBuffering;
|
||||
use OCP\AppFramework\Controller;
|
||||
|
|
@ -687,6 +688,7 @@ Raw output
|
|||
public function check() {
|
||||
$phpDefaultCharset = new PhpDefaultCharset();
|
||||
$phpOutputBuffering = new PhpOutputBuffering();
|
||||
$legacySSEKeyFormat = new LegacySSEKeyFormat($this->l10n, $this->config, $this->urlGenerator);
|
||||
return new DataResponse(
|
||||
[
|
||||
'isGetenvServerWorking' => !empty(getenv('PATH')),
|
||||
|
|
@ -729,6 +731,7 @@ Raw output
|
|||
'reverseProxyGeneratedURL' => $this->urlGenerator->getAbsoluteURL('index.php'),
|
||||
PhpDefaultCharset::class => ['pass' => $phpDefaultCharset->run(), 'description' => $phpDefaultCharset->description(), 'severity' => $phpDefaultCharset->severity()],
|
||||
PhpOutputBuffering::class => ['pass' => $phpOutputBuffering->run(), 'description' => $phpOutputBuffering->description(), 'severity' => $phpOutputBuffering->severity()],
|
||||
LegacySSEKeyFormat::class => ['pass' => $legacySSEKeyFormat->run(), 'description' => $legacySSEKeyFormat->description(), 'severity' => $legacySSEKeyFormat->severity(), 'linkToDocumentation' => $legacySSEKeyFormat->linkToDocumentation()],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
|
|
|||
63
apps/settings/lib/SetupChecks/LegacySSEKeyFormat.php
Normal file
63
apps/settings/lib/SetupChecks/LegacySSEKeyFormat.php
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2020 Morris Jobke <hey@morrisjobke.de>
|
||||
*
|
||||
* @author DMorris Jobke <hey@morrisjobke.de>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace OCA\Settings\SetupChecks;
|
||||
|
||||
use OCP\IConfig;
|
||||
use OCP\IL10N;
|
||||
use OCP\IURLGenerator;
|
||||
|
||||
class LegacySSEKeyFormat {
|
||||
/** @var IL10N */
|
||||
private $l10n;
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
/** @var IURLGenerator */
|
||||
private $urlGenerator;
|
||||
|
||||
public function __construct(IL10N $l10n, IConfig $config, IURLGenerator $urlGenerator) {
|
||||
$this->l10n = $l10n;
|
||||
$this->config = $config;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
}
|
||||
|
||||
public function description(): string {
|
||||
return $this->l10n->t('The old server-side-encryption format is enabled. We recommend disabling this.');
|
||||
}
|
||||
|
||||
public function severity(): string {
|
||||
return 'warning';
|
||||
}
|
||||
|
||||
public function run(): bool {
|
||||
return $this->config->getSystemValueBool('encryption.legacy_format_support', false) === false;
|
||||
}
|
||||
|
||||
public function linkToDocumentation(): string {
|
||||
return $this->urlGenerator->linkToDocs('admin-sse-legacy-format');
|
||||
}
|
||||
}
|
||||
|
|
@ -595,6 +595,7 @@ class CheckSetupControllerTest extends TestCase {
|
|||
'reverseProxyGeneratedURL' => 'https://server/index.php',
|
||||
'OCA\Settings\SetupChecks\PhpDefaultCharset' => ['pass' => true, 'description' => 'PHP configuration option default_charset should be UTF-8', 'severity' => 'warning'],
|
||||
'OCA\Settings\SetupChecks\PhpOutputBuffering' => ['pass' => true, 'description' => 'PHP configuration option output_buffering must be disabled', 'severity' => 'error'],
|
||||
'OCA\Settings\SetupChecks\LegacySSEKeyFormat' => ['pass' => true, 'description' => 'The old server-side-encryption format is enabled. We recommend disabling this.', 'severity' => 'warning', 'linkToDocumentation' => ''],
|
||||
]
|
||||
);
|
||||
$this->assertEquals($expected, $this->checkSetupController->check());
|
||||
|
|
|
|||
|
|
@ -490,6 +490,7 @@
|
|||
|
||||
OC.SetupChecks.addGenericSetupCheck(data, 'OCA\\Settings\\SetupChecks\\PhpDefaultCharset', messages)
|
||||
OC.SetupChecks.addGenericSetupCheck(data, 'OCA\\Settings\\SetupChecks\\PhpOutputBuffering', messages)
|
||||
OC.SetupChecks.addGenericSetupCheck(data, 'OCA\\Settings\\SetupChecks\\LegacySSEKeyFormat', messages)
|
||||
|
||||
} else {
|
||||
messages.push({
|
||||
|
|
@ -509,7 +510,7 @@
|
|||
},
|
||||
|
||||
addGenericSetupCheck: function(data, check, messages) {
|
||||
var setupCheck = data[check] || { pass: true, description: '', severity: 'info'}
|
||||
var setupCheck = data[check] || { pass: true, description: '', severity: 'info', linkToDocumentation: null}
|
||||
|
||||
var type = OC.SetupChecks.MESSAGE_TYPE_INFO
|
||||
if (setupCheck.severity === 'warning') {
|
||||
|
|
@ -518,9 +519,14 @@
|
|||
type = OC.SetupChecks.MESSAGE_TYPE_ERROR
|
||||
}
|
||||
|
||||
var message = setupCheck.description;
|
||||
if (setupCheck.linkToDocumentation) {
|
||||
message += ' ' + t('core', 'For more details see the <a target="_blank" rel="noreferrer noopener" href="{docLink}">documentation</a>.', {docLink: setupCheck.linkToDocumentation});
|
||||
}
|
||||
|
||||
if (!setupCheck.pass) {
|
||||
messages.push({
|
||||
msg: setupCheck.description,
|
||||
msg: message,
|
||||
type: type,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue