diff --git a/apps/settings/lib/AppInfo/Application.php b/apps/settings/lib/AppInfo/Application.php index 22993a79485..c3ed7b31e79 100644 --- a/apps/settings/lib/AppInfo/Application.php +++ b/apps/settings/lib/AppInfo/Application.php @@ -49,6 +49,7 @@ use OCA\Settings\Search\AppSearch; use OCA\Settings\Search\SectionSearch; use OCA\Settings\Search\UserSearch; use OCA\Settings\SetupChecks\CheckUserCertificates; +use OCA\Settings\SetupChecks\LegacySSEKeyFormat; use OCA\Settings\UserMigration\AccountMigrator; use OCA\Settings\WellKnown\ChangePasswordHandler; use OCA\Settings\WellKnown\SecurityTxtHandler; @@ -139,6 +140,7 @@ class Application extends App implements IBootstrap { ); }); $context->registerSetupCheck(CheckUserCertificates::class); + $context->registerSetupCheck(LegacySSEKeyFormat::class); $context->registerUserMigrator(AccountMigrator::class); } diff --git a/apps/settings/lib/Controller/CheckSetupController.php b/apps/settings/lib/Controller/CheckSetupController.php index bcfd2360300..829873f0069 100644 --- a/apps/settings/lib/Controller/CheckSetupController.php +++ b/apps/settings/lib/Controller/CheckSetupController.php @@ -64,7 +64,6 @@ use OC\Lock\DBLockingProvider; use OC\MemoryInfo; use OCA\Settings\SetupChecks\CheckUserCertificates; use OCA\Settings\SetupChecks\NeedsSystemAddressBookSync; -use OCA\Settings\SetupChecks\LdapInvalidUuids; use OCA\Settings\SetupChecks\LegacySSEKeyFormat; use OCA\Settings\SetupChecks\PhpDefaultCharset; use OCA\Settings\SetupChecks\PhpOutputBuffering; @@ -920,10 +919,7 @@ Raw output public function check() { $phpDefaultCharset = new PhpDefaultCharset(); $phpOutputBuffering = new PhpOutputBuffering(); - $legacySSEKeyFormat = new LegacySSEKeyFormat($this->l10n, $this->config, $this->urlGenerator); - //$checkUserCertificates = new CheckUserCertificates($this->l10n, $this->config, $this->urlGenerator); $supportedDatabases = new SupportedDatabase($this->l10n, $this->connection); - $ldapInvalidUuids = new LdapInvalidUuids($this->appManager, $this->l10n, $this->serverContainer); $needsSystemAddressBookSync = new NeedsSystemAddressBookSync($this->config, $this->l10n); return new DataResponse( @@ -974,12 +970,9 @@ Raw output 'imageMagickLacksSVGSupport' => $this->imageMagickLacksSVGSupport(), 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()], - //CheckUserCertificates::class => ['pass' => $checkUserCertificates->run(), 'description' => $checkUserCertificates->description(), 'severity' => $checkUserCertificates->severity(), 'elements' => $checkUserCertificates->elements()], 'isDefaultPhoneRegionSet' => $this->config->getSystemValueString('default_phone_region', '') !== '', SupportedDatabase::class => ['pass' => $supportedDatabases->run(), 'description' => $supportedDatabases->description(), 'severity' => $supportedDatabases->severity()], 'temporaryDirectoryWritable' => $this->isTemporaryDirectoryWritable(), - LdapInvalidUuids::class => ['pass' => $ldapInvalidUuids->run(), 'description' => $ldapInvalidUuids->description(), 'severity' => $ldapInvalidUuids->severity()], NeedsSystemAddressBookSync::class => ['pass' => $needsSystemAddressBookSync->run(), 'description' => $needsSystemAddressBookSync->description(), 'severity' => $needsSystemAddressBookSync->severity()], ] ); diff --git a/apps/settings/lib/SetupChecks/LegacySSEKeyFormat.php b/apps/settings/lib/SetupChecks/LegacySSEKeyFormat.php index 4814d3fba7c..44560590f74 100644 --- a/apps/settings/lib/SetupChecks/LegacySSEKeyFormat.php +++ b/apps/settings/lib/SetupChecks/LegacySSEKeyFormat.php @@ -28,14 +28,13 @@ namespace OCA\Settings\SetupChecks; use OCP\IConfig; use OCP\IL10N; use OCP\IURLGenerator; +use OCP\SetupCheck\ISetupCheck; +use OCP\SetupCheck\SetupResult; -class LegacySSEKeyFormat { - /** @var IL10N */ - private $l10n; - /** @var IConfig */ - private $config; - /** @var IURLGenerator */ - private $urlGenerator; +class LegacySSEKeyFormat implements ISetupCheck { + private IL10N $l10n; + private IConfig $config; + private IURLGenerator $urlGenerator; public function __construct(IL10N $l10n, IConfig $config, IURLGenerator $urlGenerator) { $this->l10n = $l10n; @@ -43,19 +42,18 @@ class LegacySSEKeyFormat { $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 getCategory(): string { + return 'security'; } - public function severity(): string { - return 'warning'; + public function getName(): string { + return $this->l10n->t('Checking for old server-side-encryption being disabled'); } - 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'); + public function run(): SetupResult { + if ($this->config->getSystemValueBool('encryption.legacy_format_support', false) === false) { + return new SetupResult(SetupResult::SUCCESS); + } + return new SetupResult(SetupResult::WARNING, $this->l10n->t('The old server-side-encryption format is enabled. We recommend disabling this.'), $this->urlGenerator->linkToDocs('admin-sse-legacy-format')); } } diff --git a/apps/settings/src/components/SetupCheck.vue b/apps/settings/src/components/SetupCheck.vue index f5317386a06..40d7ac429af 100644 --- a/apps/settings/src/components/SetupCheck.vue +++ b/apps/settings/src/components/SetupCheck.vue @@ -3,12 +3,24 @@ :description="t('settings', `It's important for the security and performance of your instance that everything is configured correctly. To help you with that we are doing some automatic checks. Please see the linked documentation for more information.`)">