Skip to content

Commit

Permalink
Add occ command to download the crl from marketplace + allow to use t…
Browse files Browse the repository at this point in the history
…he crl from data when checking apps ....
  • Loading branch information
DeepDiver1975 committed May 30, 2017
1 parent f0fe5a8 commit 93ed808
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 0 deletions.
1 change: 1 addition & 0 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<command>OCA\Market\Command\InstallApp</command>
<command>OCA\Market\Command\ListApps</command>
<command>OCA\Market\Command\UpgradeApp</command>
<command>OCA\Market\Command\UpdateCrl</command>
</commands>
<navigation role="admin">
<route>market.page.index</route>
Expand Down
63 changes: 63 additions & 0 deletions lib/Command/UpdateCrl.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php
/**
* @author Thomas Müller <[email protected]>
*
* @copyright Copyright (c) 2016, ownCloud GmbH
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* 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, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/

namespace OCA\Market\Command;

use OC\IntegrityCheck\Checker;
use OCA\Market\MarketService;
use OCP\IConfig;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class UpdateCrl extends Command {

/** @var MarketService */
private $marketService;
/** @var IConfig */
private $config;
/** @var Checker */
private $checker;

public function __construct(MarketService $marketService, IConfig $config, Checker $checker) {
parent::__construct();
$this->marketService = $marketService;
$this->config = $config;
$this->checker = $checker;
}

protected function configure() {
$this
->setName('market:update-crl')
->setDescription('Downloads the current certificate revocation list from the marketplace');
}

protected function execute(InputInterface $input, OutputInterface $output) {
$output->writeln("Downloading certificate revocation list ...");
$crl = $this->marketService->downloadCrl();
$output->writeln("Validating certificate revocation list ...");
$this->checker->validateCrl($crl);
$output->writeln("Writing intermediate.crl.pem ...");
$target = $this->config->getSystemValue('datadirectory') . '/intermediate.crl.pem';
file_put_contents($target, $crl);
$output->writeln("Done.");
}
}
5 changes: 5 additions & 0 deletions lib/MarketService.php
Original file line number Diff line number Diff line change
Expand Up @@ -421,4 +421,9 @@ private function queryData($key, $uri) {

}

public function downloadCrl() {
$response = $this->httpGet($this->storeUrl . '/code-signing/intermediate.crl.pem');
return $response->getBody();
}

}

0 comments on commit 93ed808

Please sign in to comment.