diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-02-04 16:17:47 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-02-04 16:17:47 +0100 |
commit | 1619968a033dcbaa1c94d735d53c3ca0bfd3a469 (patch) | |
tree | f16f090950db9b4079f5deb539d5e99a1469dfef | |
parent | 52ce83993d16edf7ddacede5968ef5c32459479c (diff) | |
parent | 4db563850535bf3c4b212bd1804bf1ab4cd01b64 (diff) | |
download | nextcloud-server-1619968a033dcbaa1c94d735d53c3ca0bfd3a469.tar.gz nextcloud-server-1619968a033dcbaa1c94d735d53c3ca0bfd3a469.zip |
Merge pull request #22111 from owncloud/use-intermediate-certificate
Use intermediate root authority + sign other release channels
-rw-r--r-- | core/command/integrity/signcore.php | 10 | ||||
-rw-r--r-- | lib/private/integritycheck/checker.php | 22 | ||||
-rw-r--r-- | lib/private/integritycheck/iterator/excludefoldersbypathfilteriterator.php | 9 | ||||
-rw-r--r-- | resources/codesigning/core.crt | 46 | ||||
-rw-r--r-- | resources/codesigning/root.crt | 98 | ||||
-rw-r--r-- | tests/lib/command/integrity/SignCoreTest.php | 19 | ||||
-rw-r--r-- | tests/lib/integritycheck/checkertest.php | 12 |
7 files changed, 135 insertions, 81 deletions
diff --git a/core/command/integrity/signcore.php b/core/command/integrity/signcore.php index 531a4d33aa3..e5c2de73e00 100644 --- a/core/command/integrity/signcore.php +++ b/core/command/integrity/signcore.php @@ -59,7 +59,8 @@ class SignCore extends Command { ->setName('integrity:sign-core') ->setDescription('Sign core using a private key.') ->addOption('privateKey', null, InputOption::VALUE_REQUIRED, 'Path to private key to use for signing') - ->addOption('certificate', null, InputOption::VALUE_REQUIRED, 'Path to certificate to use for signing'); + ->addOption('certificate', null, InputOption::VALUE_REQUIRED, 'Path to certificate to use for signing') + ->addOption('path', null, InputOption::VALUE_REQUIRED, 'Path of core to sign'); } /** @@ -68,8 +69,9 @@ class SignCore extends Command { protected function execute(InputInterface $input, OutputInterface $output) { $privateKeyPath = $input->getOption('privateKey'); $keyBundlePath = $input->getOption('certificate'); - if(is_null($privateKeyPath) || is_null($keyBundlePath)) { - $output->writeln('--privateKey and --certificate are required.'); + $path = $input->getOption('path'); + if(is_null($privateKeyPath) || is_null($keyBundlePath) || is_null($path)) { + $output->writeln('--privateKey, --certificate and --path are required.'); return null; } @@ -91,7 +93,7 @@ class SignCore extends Command { $x509 = new X509(); $x509->loadX509($keyBundle); $x509->setPrivateKey($rsa); - $this->checker->writeCoreSignature($x509, $rsa); + $this->checker->writeCoreSignature($x509, $rsa, $path); $output->writeln('Successfully signed "core"'); } diff --git a/lib/private/integritycheck/checker.php b/lib/private/integritycheck/checker.php index c256fe66d32..e6f9f9a1457 100644 --- a/lib/private/integritycheck/checker.php +++ b/lib/private/integritycheck/checker.php @@ -90,6 +90,8 @@ class Checker { // FIXME: Once the signing server is instructed to sign daily, beta and // RCs as well these need to be included also. $signedChannels = [ + 'daily', + 'testing', 'stable', ]; if(!in_array($this->environmentHelper->getChannel(), $signedChannels, true)) { @@ -113,16 +115,22 @@ class Checker { * Enumerates all files belonging to the folder. Sensible defaults are excluded. * * @param string $folderToIterate + * @param string $root * @return \RecursiveIteratorIterator * @throws \Exception */ - private function getFolderIterator($folderToIterate) { + private function getFolderIterator($folderToIterate, $root = '') { $dirItr = new \RecursiveDirectoryIterator( $folderToIterate, \RecursiveDirectoryIterator::SKIP_DOTS ); + if($root === '') { + $root = \OC::$SERVERROOT; + } + $root = rtrim($root, '/'); + $excludeGenericFilesIterator = new ExcludeFileByNameFilterIterator($dirItr); - $excludeFoldersIterator = new ExcludeFoldersByPathFilterIterator($excludeGenericFilesIterator); + $excludeFoldersIterator = new ExcludeFoldersByPathFilterIterator($excludeGenericFilesIterator, $root); return new \RecursiveIteratorIterator( $excludeFoldersIterator, @@ -234,14 +242,16 @@ class Checker { * * @param X509 $certificate * @param RSA $rsa + * @param string $path */ public function writeCoreSignature(X509 $certificate, - RSA $rsa) { - $iterator = $this->getFolderIterator($this->environmentHelper->getServerRoot()); - $hashes = $this->generateHashes($iterator, $this->environmentHelper->getServerRoot()); + RSA $rsa, + $path) { + $iterator = $this->getFolderIterator($path, $path); + $hashes = $this->generateHashes($iterator, $path); $signatureData = $this->createSignatureData($hashes, $certificate, $rsa); $this->fileAccessHelper->file_put_contents( - $this->environmentHelper->getServerRoot() . '/core/signature.json', + $path . '/core/signature.json', json_encode($signatureData, JSON_PRETTY_PRINT) ); } diff --git a/lib/private/integritycheck/iterator/excludefoldersbypathfilteriterator.php b/lib/private/integritycheck/iterator/excludefoldersbypathfilteriterator.php index c3994197fc6..67bcd423b68 100644 --- a/lib/private/integritycheck/iterator/excludefoldersbypathfilteriterator.php +++ b/lib/private/integritycheck/iterator/excludefoldersbypathfilteriterator.php @@ -24,7 +24,7 @@ namespace OC\IntegrityCheck\Iterator; class ExcludeFoldersByPathFilterIterator extends \RecursiveFilterIterator { private $excludedFolders = []; - public function __construct(\RecursiveIterator $iterator) { + public function __construct(\RecursiveIterator $iterator, $root = '') { parent::__construct($iterator); $appFolders = \OC::$APPSROOTS; @@ -33,9 +33,10 @@ class ExcludeFoldersByPathFilterIterator extends \RecursiveFilterIterator { } $this->excludedFolders = array_merge([ - rtrim(\OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data'), '/'), - rtrim(\OC::$SERVERROOT.'/themes', '/'), - rtrim(\OC::$SERVERROOT.'/config', '/'), + rtrim($root . '/data', '/'), + rtrim($root .'/themes', '/'), + rtrim($root.'/config', '/'), + rtrim($root.'/apps', '/'), ], $appFolders); } diff --git a/resources/codesigning/core.crt b/resources/codesigning/core.crt index 0692e940186..62f87c9d30c 100644 --- a/resources/codesigning/core.crt +++ b/resources/codesigning/core.crt @@ -1,24 +1,24 @@ -----BEGIN CERTIFICATE----- -MIID/TCCAeUCAhAAMA0GCSqGSIb3DQEBCwUAMHkxFjAUBgNVBAoTDW93bkNsb3Vk -IEluYy4xEjAQBgNVBAcTCUxleGluZ3Rvbj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x9Xv+ptO8Po7sTuNYP0CMH +EOQN+/q8tYlSm2VW+dAlaJ+zVZwZldhVjL+lSH4E9ktWn3PmgNQeKfcnJISUbus6 +ZtsYDF/X96/Z2ZQvMXOKksgvU6XlvIxllcyebC9Bxe/h0D63GCO2tqN5CWQzIIqn +apUynPX8BlLaaExqYGERwlUi/yOGaUVPUjEPVehviOQYgAqxlrkJk1dWeCrwUori +CXpi+IUYkidfgiJ9F88M3ElpwqIaXp7G3/4oHBuE2u6M+L+1/vqPJeTCAWUxxpJE +yYmM+db6D4TySFpQPENNzPS8bpR6T8w2hRumkldC42HrnyJJbpjOieTXhXzjdPvZ +IEP9JGtkhB2du6nBF2MNAq2TqRXpcfQrQEbnQ13aV9bl+roTwwO+SOWK/wgvdOMI +STQ0Xk0sTGlmQjPYPkibVceaWMR3sX4cNt5c33YhJys5jxHoAh42km4nN9tfykR5 +crl5lBlKjXh2GP0+omSO3x1jX4+iQPCW2TWoyKkUdLu/hGHG2w8RrTeme+kATECH +YSu356M= +-----END CERTIFICATE----- diff --git a/resources/codesigning/root.crt b/resources/codesigning/root.crt index 201164feb0c..cbd82898bab 100644 --- a/resources/codesigning/root.crt +++ b/resources/codesigning/root.crt @@ -1,36 +1,66 @@ -----BEGIN CERTIFICATE----- -MIIGVDCCBDygAwIBAgIJAJGMJhEr5q3dMA0GCSqGSIb3DQEBCwUAMHkxFjAUBgNV -BAoTDW93bkNsb3VkIEluYy4xEjAQBgNVBAcTCUxleGluZ3RvbjEPMA0GA1UECBMG -Qm9zdG9uMQswCQYDVQQGEwJVUzEtMCsGA1UEAxMkb3duQ2xvdWQgQ29kZSBTaWdu -aW5nIFJvb3QgQXV0aG9yaXR5MB4XDTE2MDIwMzE3MDYyOVoXDTI2MDEzMTE3MDYy -OVoweTEWMBQGA1UEChMNb3duQ2xvdWQgSW5jLjESMBAGA1UEBxMJTGV4aW5ndG9u -MQ8wDQYDVQQIEwZCb3N0b24xCzAJBgNVBAYTAlVTMS0wKwYDVQQDE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lsy9jG4OIelse3+e1KBWNsGtU90asnUHgyMXVL8gp +ocznGvWceAhkcogUCUCXq1Rh/mKcGQdi2z0g/X+MGzfA9Ij4NQZLnNPh2UjgxCtG +KWPUzs0t/xoCtJh1WpwqTrOUcYqFAaBa282sD/O8tX4t076aGKdbhfo6tvaOFwDU +iRPgdMol++BFnfCld53Yivg2+S6+xo1wzuPkNjVFXHjx9vMyiov/HHKqJoBsuCwU +7VegzM/6Cvh32lSZfUHsfynCab/7vv923KyaANWxb0QsHZSSt+mmOK3ZmC96vCEa +55IGNckOvOGW9yCIz3Q0kEj2hoJs1bw0SkwGWs7N1TkugQjM/S7/Im1LJUxdtqQK +Zjn+8U6U3TR1aKLYEdqHCGcVoRXKDG/S40FHxyeV/9buTI7SSvhzZfj+qasmJe1L +Kd08UdS/im8RwbVSS1mih5hbAHg= -----END CERTIFICATE-----
\ No newline at end of file diff --git a/tests/lib/command/integrity/SignCoreTest.php b/tests/lib/command/integrity/SignCoreTest.php index 885c6fc664e..ff1f6b23a95 100644 --- a/tests/lib/command/integrity/SignCoreTest.php +++ b/tests/lib/command/integrity/SignCoreTest.php @@ -63,7 +63,7 @@ class SignCoreTest extends TestCase { $outputInterface ->expects($this->at(0)) ->method('writeln') - ->with('--privateKey and --certificate are required.'); + ->with('--privateKey, --certificate and --path are required.'); $this->invokePrivate($this->signCore, 'execute', [$inputInterface, $outputInterface]); } @@ -86,7 +86,7 @@ class SignCoreTest extends TestCase { $outputInterface ->expects($this->at(0)) ->method('writeln') - ->with('--privateKey and --certificate are required.'); + ->with('--privateKey, --certificate and --path are required.'); $this->invokePrivate($this->signCore, 'execute', [$inputInterface, $outputInterface]); } @@ -105,6 +105,11 @@ class SignCoreTest extends TestCase { ->method('getOption') ->with('certificate') ->will($this->returnValue('certificate')); + $inputInterface + ->expects($this->at(2)) + ->method('getOption') + ->with('path') + ->will($this->returnValue('certificate')); $this->fileAccessHelper ->expects($this->at(0)) @@ -134,6 +139,11 @@ class SignCoreTest extends TestCase { ->method('getOption') ->with('certificate') ->will($this->returnValue('certificate')); + $inputInterface + ->expects($this->at(2)) + ->method('getOption') + ->with('path') + ->will($this->returnValue('certificate')); $this->fileAccessHelper ->expects($this->at(0)) @@ -168,6 +178,11 @@ class SignCoreTest extends TestCase { ->method('getOption') ->with('certificate') ->will($this->returnValue('certificate')); + $inputInterface + ->expects($this->at(2)) + ->method('getOption') + ->with('path') + ->will($this->returnValue('certificate')); $this->fileAccessHelper ->expects($this->at(0)) diff --git a/tests/lib/integritycheck/checkertest.php b/tests/lib/integritycheck/checkertest.php index dec3ea84a64..fac60b0c123 100644 --- a/tests/lib/integritycheck/checkertest.php +++ b/tests/lib/integritycheck/checkertest.php @@ -465,7 +465,7 @@ class CheckerTest extends TestCase { $rsa->loadKey($rsaPrivateKey); $x509 = new X509(); $x509->loadX509($keyBundle); - $this->checker->writeCoreSignature($x509, $rsa); + $this->checker->writeCoreSignature($x509, $rsa, \OC::$SERVERROOT . '/tests/data/integritycheck/app/'); } public function testWriteCoreSignatureWithUnmodifiedHtaccess() { @@ -495,7 +495,7 @@ class CheckerTest extends TestCase { $rsa->loadKey($rsaPrivateKey); $x509 = new X509(); $x509->loadX509($keyBundle); - $this->checker->writeCoreSignature($x509, $rsa); + $this->checker->writeCoreSignature($x509, $rsa, \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessUnmodified/'); } public function testWriteCoreSignatureWithInvalidModifiedHtaccess() { @@ -506,10 +506,6 @@ class CheckerTest extends TestCase { "signature": "qpDddYGgAKNR3TszOgjPXRphUl2P9Ym5OQaetltocgZASGDkOun5D64+1D0QJRKb4SG2+48muxGOHyL2Ngos4NUrrSR+SIkywZacay82YQBCEdr7\/4MjW1WHRPjvboLwEJwViw0EdAjsWRpD68aPnzUGrGsy2BsCo06P5iwjk9cXcHxdjC9R39npvoC3QNvQ2jmNIbh1Lc4U97dbb+CsXEQCLU1OSa9p3q6cEFV98Easwt7uF\/DzHK+CbeZlxVZ0DwLh2\/ylT1PyGou8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Q96x6A4EH9Y9mZlYozH\/eqmxPbTK8n89\/p7Ydun4rI+B2iiLnY8REWWy6+UQ\r\nV204fGUkJqW5CrKy3P3XvY9X\r\n-----END CERTIFICATE-----" }'; - $this->environmentHelper - ->expects($this->any()) - ->method('getServerRoot') - ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithInvalidModifiedContent/')); $this->fileAccessHelper ->expects($this->once()) ->method('file_put_contents') @@ -524,7 +520,7 @@ class CheckerTest extends TestCase { $rsa->loadKey($rsaPrivateKey); $x509 = new X509(); $x509->loadX509($keyBundle); - $this->checker->writeCoreSignature($x509, $rsa); + $this->checker->writeCoreSignature($x509, $rsa, \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithInvalidModifiedContent/'); } public function testWriteCoreSignatureWithValidModifiedHtaccess() { @@ -554,7 +550,7 @@ class CheckerTest extends TestCase { $rsa->loadKey($rsaPrivateKey); $x509 = new X509(); $x509->loadX509($keyBundle); - $this->checker->writeCoreSignature($x509, $rsa); + $this->checker->writeCoreSignature($x509, $rsa, \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent'); } public function testVerifyCoreSignatureWithoutSignatureData() { |