Exemplo n.º 1
0
 /**
  * {@inheritdoc }
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $path = $input->getOption('path');
     $privateKeyPath = $input->getOption('privateKey');
     $keyBundlePath = $input->getOption('certificate');
     if (is_null($path) || is_null($privateKeyPath) || is_null($keyBundlePath)) {
         $documentationUrl = $this->urlGenerator->linkToDocs('developer-code-integrity');
         $output->writeln('This command requires the --path, --privateKey and --certificate.');
         $output->writeln('Example: ./occ integrity:sign-app --path="/Users/lukasreschke/Programming/myapp/" --privateKey="/Users/lukasreschke/private/myapp.key" --certificate="/Users/lukasreschke/public/mycert.crt"');
         $output->writeln('For more information please consult the documentation: ' . $documentationUrl);
         return null;
     }
     $privateKey = $this->fileAccessHelper->file_get_contents($privateKeyPath);
     $keyBundle = $this->fileAccessHelper->file_get_contents($keyBundlePath);
     if ($privateKey === false) {
         $output->writeln(sprintf('Private key "%s" does not exists.', $privateKeyPath));
         return null;
     }
     if ($keyBundle === false) {
         $output->writeln(sprintf('Certificate "%s" does not exists.', $keyBundlePath));
         return null;
     }
     $rsa = new RSA();
     $rsa->loadKey($privateKey);
     $x509 = new X509();
     $x509->loadX509($keyBundle);
     $x509->setPrivateKey($rsa);
     $this->checker->writeAppSignature($path, $x509, $rsa);
     $output->writeln('Successfully signed "' . $path . '"');
 }
Exemplo n.º 2
0
 /**
  * @param string $file the xml file to be loaded
  * @return null|array where null is an indicator for an error
  */
 public function parse($file)
 {
     if (!file_exists($file)) {
         return null;
     }
     libxml_use_internal_errors(true);
     $loadEntities = libxml_disable_entity_loader(false);
     $xml = simplexml_load_file($file);
     libxml_disable_entity_loader($loadEntities);
     if ($xml == false) {
         libxml_clear_errors();
         return null;
     }
     $array = $this->xmlToArray($xml);
     if (is_null($array)) {
         return null;
     }
     if (!array_key_exists('info', $array)) {
         $array['info'] = array();
     }
     if (!array_key_exists('remote', $array)) {
         $array['remote'] = array();
     }
     if (!array_key_exists('public', $array)) {
         $array['public'] = array();
     }
     if (!array_key_exists('types', $array)) {
         $array['types'] = array();
     }
     if (array_key_exists('documentation', $array) && is_array($array['documentation'])) {
         foreach ($array['documentation'] as $key => $url) {
             // If it is not an absolute URL we assume it is a key
             // i.e. admin-ldap will get converted to go.php?to=admin-ldap
             if (!$this->httpHelper->isHTTPURL($url)) {
                 $url = $this->urlGenerator->linkToDocs($url);
             }
             $array['documentation'][$key] = $url;
         }
     }
     if (array_key_exists('types', $array)) {
         if (is_array($array['types'])) {
             foreach ($array['types'] as $type => $v) {
                 unset($array['types'][$type]);
                 if (is_string($type)) {
                     $array['types'][] = $type;
                 }
             }
         } else {
             $array['types'] = array();
         }
     }
     return $array;
 }
Exemplo n.º 3
0
	/**
	 * @return DataResponse
	 */
	public function check() {
		return new DataResponse(
			[
				'serverHasInternetConnection' => $this->isInternetConnectionWorking(),
				'dataDirectoryProtected' => $this->util->isHtaccessWorking($this->config),
				'isMemcacheConfigured' => $this->isMemcacheConfigured(),
				'memcacheDocs' => $this->urlGenerator->linkToDocs('admin-performance'),
				'isUrandomAvailable' => $this->isUrandomAvailable(),
				'securityDocs' => $this->urlGenerator->linkToDocs('admin-security'),
			]
		);
	}
Exemplo n.º 4
0
 /**
  * @return DataResponse
  */
 public function check()
 {
     return new DataResponse(['serverHasInternetConnection' => $this->isInternetConnectionWorking(), 'isMemcacheConfigured' => $this->isMemcacheConfigured(), 'memcacheDocs' => $this->urlGenerator->linkToDocs('admin-performance'), 'isUrandomAvailable' => $this->isUrandomAvailable(), 'securityDocs' => $this->urlGenerator->linkToDocs('admin-security'), 'isUsedTlsLibOutdated' => $this->isUsedTlsLibOutdated(), 'phpSupported' => $this->isPhpSupported(), 'forwardedForHeadersWorking' => $this->forwardedForHeadersWorking(), 'reverseProxyDocs' => $this->urlGenerator->linkToDocs('admin-reverse-proxy'), 'isCorrectMemcachedPHPModuleInstalled' => $this->isCorrectMemcachedPHPModuleInstalled(), 'hasPassedCodeIntegrityCheck' => $this->checker->hasPassedCheck(), 'codeIntegrityCheckerDocumentation' => $this->urlGenerator->linkToDocs('admin-code-integrity')]);
 }
 /**
  * @return DataResponse
  */
 public function check()
 {
     return new DataResponse(['serverHasInternetConnection' => $this->isInternetConnectionWorking(), 'dataDirectoryProtected' => $this->util->isHtaccessWorking($this->config), 'isMemcacheConfigured' => $this->isMemcacheConfigured(), 'memcacheDocs' => $this->urlGenerator->linkToDocs('admin-performance'), 'isUrandomAvailable' => $this->isUrandomAvailable(), 'securityDocs' => $this->urlGenerator->linkToDocs('admin-security'), 'isUsedTlsLibOutdated' => $this->isUsedTlsLibOutdated(), 'phpSupported' => $this->isPhpSupported(), 'forwardedForHeadersWorking' => $this->forwardedForHeadersWorking(), 'reverseProxyDocs' => $this->urlGenerator->linkToDocs('admin-reverse-proxy'), 'isCorrectMemcachedPHPModuleInstalled' => $this->isCorrectMemcachedPHPModuleInstalled()]);
 }