File tree Expand file tree Collapse file tree 4 files changed +38
-0
lines changed
Expand file tree Collapse file tree 4 files changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /**
4+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
5+ * SPDX-License-Identifier: AGPL-3.0-only
6+ */
7+ declare (strict_types=1 );
8+
9+ namespace OC \Core \Command \Security ;
10+
11+ use OC \Core \Command \Base ;
12+ use OCP \ICertificateManager ;
13+ use Symfony \Component \Console \Input \InputInterface ;
14+ use Symfony \Component \Console \Output \OutputInterface ;
15+
16+ class ExportCertificates extends Base {
17+ public function __construct (
18+ protected ICertificateManager $ certificateManager ,
19+ ) {
20+ parent ::__construct ();
21+ }
22+
23+ protected function configure (): void {
24+ $ this
25+ ->setName ('security:certificates:export ' )
26+ ->setDescription ('export the certificate bundle ' );
27+ }
28+
29+ protected function execute (InputInterface $ input , OutputInterface $ output ): int {
30+ $ bundlePath = $ this ->certificateManager ->getAbsoluteBundlePath ();
31+ $ bundle = file_get_contents ($ bundlePath );
32+ $ output ->writeln ($ bundle );
33+ return 0 ;
34+ }
35+ }
Original file line number Diff line number Diff line change 136136 $ application ->add (Server::get (Command \SystemTag \Edit::class));
137137
138138 $ application ->add (Server::get (Command \Security \ListCertificates::class));
139+ $ application ->add (Server::get (Command \Security \ExportCertificates::class));
139140 $ application ->add (Server::get (Command \Security \ImportCertificate::class));
140141 $ application ->add (Server::get (Command \Security \RemoveCertificate::class));
141142 $ application ->add (Server::get (Command \Security \BruteforceAttempts::class));
Original file line number Diff line number Diff line change 12051205 'OC \\Core \\Command \\Preview \\ResetRenderedTexts ' => $ baseDir . '/core/Command/Preview/ResetRenderedTexts.php ' ,
12061206 'OC \\Core \\Command \\Security \\BruteforceAttempts ' => $ baseDir . '/core/Command/Security/BruteforceAttempts.php ' ,
12071207 'OC \\Core \\Command \\Security \\BruteforceResetAttempts ' => $ baseDir . '/core/Command/Security/BruteforceResetAttempts.php ' ,
1208+ 'OC \\Core \\Command \\Security \\ExportCertificates ' => $ baseDir . '/core/Command/Security/ExportCertificates.php ' ,
12081209 'OC \\Core \\Command \\Security \\ImportCertificate ' => $ baseDir . '/core/Command/Security/ImportCertificate.php ' ,
12091210 'OC \\Core \\Command \\Security \\ListCertificates ' => $ baseDir . '/core/Command/Security/ListCertificates.php ' ,
12101211 'OC \\Core \\Command \\Security \\RemoveCertificate ' => $ baseDir . '/core/Command/Security/RemoveCertificate.php ' ,
Original file line number Diff line number Diff line change @@ -1238,6 +1238,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
12381238 'OC \\Core \\Command \\Preview \\ResetRenderedTexts ' => __DIR__ . '/../../.. ' . '/core/Command/Preview/ResetRenderedTexts.php ' ,
12391239 'OC \\Core \\Command \\Security \\BruteforceAttempts ' => __DIR__ . '/../../.. ' . '/core/Command/Security/BruteforceAttempts.php ' ,
12401240 'OC \\Core \\Command \\Security \\BruteforceResetAttempts ' => __DIR__ . '/../../.. ' . '/core/Command/Security/BruteforceResetAttempts.php ' ,
1241+ 'OC \\Core \\Command \\Security \\ExportCertificates ' => __DIR__ . '/../../.. ' . '/core/Command/Security/ExportCertificates.php ' ,
12411242 'OC \\Core \\Command \\Security \\ImportCertificate ' => __DIR__ . '/../../.. ' . '/core/Command/Security/ImportCertificate.php ' ,
12421243 'OC \\Core \\Command \\Security \\ListCertificates ' => __DIR__ . '/../../.. ' . '/core/Command/Security/ListCertificates.php ' ,
12431244 'OC \\Core \\Command \\Security \\RemoveCertificate ' => __DIR__ . '/../../.. ' . '/core/Command/Security/RemoveCertificate.php ' ,
You can’t perform that action at this time.
0 commit comments