aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/Command/Security/ExportCertificates.php35
-rw-r--r--core/register_command.php1
-rw-r--r--lib/composer/composer/autoload_classmap.php1
-rw-r--r--lib/composer/composer/autoload_static.php1
4 files changed, 38 insertions, 0 deletions
diff --git a/core/Command/Security/ExportCertificates.php b/core/Command/Security/ExportCertificates.php
new file mode 100644
index 00000000000..dcf34d4bce4
--- /dev/null
+++ b/core/Command/Security/ExportCertificates.php
@@ -0,0 +1,35 @@
+<?php
+
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+declare(strict_types=1);
+
+namespace OC\Core\Command\Security;
+
+use OC\Core\Command\Base;
+use OCP\ICertificateManager;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+
+class ExportCertificates extends Base {
+ public function __construct(
+ protected ICertificateManager $certificateManager,
+ ) {
+ parent::__construct();
+ }
+
+ protected function configure(): void {
+ $this
+ ->setName('security:certificates:export')
+ ->setDescription('export the certificate bundle');
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output): int {
+ $bundlePath = $this->certificateManager->getAbsoluteBundlePath();
+ $bundle = file_get_contents($bundlePath);
+ $output->writeln($bundle);
+ return 0;
+ }
+}
diff --git a/core/register_command.php b/core/register_command.php
index 2922e98671a..19d39c976b7 100644
--- a/core/register_command.php
+++ b/core/register_command.php
@@ -136,6 +136,7 @@ if ($config->getSystemValueBool('installed', false)) {
$application->add(Server::get(Command\SystemTag\Edit::class));
$application->add(Server::get(Command\Security\ListCertificates::class));
+ $application->add(Server::get(Command\Security\ExportCertificates::class));
$application->add(Server::get(Command\Security\ImportCertificate::class));
$application->add(Server::get(Command\Security\RemoveCertificate::class));
$application->add(Server::get(Command\Security\BruteforceAttempts::class));
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php
index a6f7f555df0..33ee831670e 100644
--- a/lib/composer/composer/autoload_classmap.php
+++ b/lib/composer/composer/autoload_classmap.php
@@ -1205,6 +1205,7 @@ return array(
'OC\\Core\\Command\\Preview\\ResetRenderedTexts' => $baseDir . '/core/Command/Preview/ResetRenderedTexts.php',
'OC\\Core\\Command\\Security\\BruteforceAttempts' => $baseDir . '/core/Command/Security/BruteforceAttempts.php',
'OC\\Core\\Command\\Security\\BruteforceResetAttempts' => $baseDir . '/core/Command/Security/BruteforceResetAttempts.php',
+ 'OC\\Core\\Command\\Security\\ExportCertificates' => $baseDir . '/core/Command/Security/ExportCertificates.php',
'OC\\Core\\Command\\Security\\ImportCertificate' => $baseDir . '/core/Command/Security/ImportCertificate.php',
'OC\\Core\\Command\\Security\\ListCertificates' => $baseDir . '/core/Command/Security/ListCertificates.php',
'OC\\Core\\Command\\Security\\RemoveCertificate' => $baseDir . '/core/Command/Security/RemoveCertificate.php',
diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php
index 54dfde87806..4d0981f7fe8 100644
--- a/lib/composer/composer/autoload_static.php
+++ b/lib/composer/composer/autoload_static.php
@@ -1238,6 +1238,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OC\\Core\\Command\\Preview\\ResetRenderedTexts' => __DIR__ . '/../../..' . '/core/Command/Preview/ResetRenderedTexts.php',
'OC\\Core\\Command\\Security\\BruteforceAttempts' => __DIR__ . '/../../..' . '/core/Command/Security/BruteforceAttempts.php',
'OC\\Core\\Command\\Security\\BruteforceResetAttempts' => __DIR__ . '/../../..' . '/core/Command/Security/BruteforceResetAttempts.php',
+ 'OC\\Core\\Command\\Security\\ExportCertificates' => __DIR__ . '/../../..' . '/core/Command/Security/ExportCertificates.php',
'OC\\Core\\Command\\Security\\ImportCertificate' => __DIR__ . '/../../..' . '/core/Command/Security/ImportCertificate.php',
'OC\\Core\\Command\\Security\\ListCertificates' => __DIR__ . '/../../..' . '/core/Command/Security/ListCertificates.php',
'OC\\Core\\Command\\Security\\RemoveCertificate' => __DIR__ . '/../../..' . '/core/Command/Security/RemoveCertificate.php',