[TASK] Add OpenSSL verification to system environment check 26/19626/3
authorNicole Cordes <typo3@cordes.co>
Fri, 5 Apr 2013 20:15:24 +0000 (22:15 +0200)
committerJigal van Hemert <jigal@xs4all.nl>
Sat, 6 Apr 2013 06:37:03 +0000 (08:37 +0200)
Add OpenSSL verification to system environment check to be able to require
rsa and saltedpassword extensions.

Change-Id: I2eedc03569f93478eac426807f83c348c5788b42
Resolves: #46959
Releases: 6.1
Reviewed-on: https://review.typo3.org/19626
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Jigal van Hemert
Tested-by: Jigal van Hemert
typo3/sysext/install/Classes/SystemEnvironment/Check.php

index c503203..4b41459 100644 (file)
@@ -107,6 +107,7 @@ class Check {
                $statusArray[] = $this->checkDocRoot();
                $statusArray[] = $this->checkSqlSafeMode();
                $statusArray[] = $this->checkOpenBaseDir();
+               $statusArray[] = $this->checkOpenSslInstalled();
                $statusArray[] = $this->checkSuhosinLoaded();
                $statusArray[] = $this->checkSuhosinRequestMaxVars();
                $statusArray[] = $this->checkSuhosinPostMaxVars();
@@ -505,6 +506,36 @@ class Check {
        }
 
        /**
+        * Check accessibility and functionality of OpenSSL
+        */
+       protected function checkOpenSslInstalled() {
+               if (extension_loaded('openssl')) {
+                       $testKey = @openssl_pkey_new();
+                       if (is_resource($testKey)) {
+                               openssl_free_key($testKey);
+                               $status = new OkStatus();
+                               $status->setTitle('OpenSSL installed properly');
+                       } else {
+                               $status = new ErrorStatus();
+                               $status->setTitle('OpenSSL extension not working');
+                               $status->setMessage(
+                                       'Something went wrong while trying to create a new private key. ' .
+                                       'Please check your OpenSSL integration to verify the extension is installed correctly.'
+                               );
+                       }
+               } else {
+                       $status = new ErrorStatus();
+                       $status->setTitle('OpenSSL extension not loaded');
+                       $status->setMessage(
+                               'OpenSSL is an extension to encrypt/decrypt data between requests. ' .
+                               'TYPO3 CMS needs it to be able to store passwords encrypted to improve the security on database layer.'
+                       );
+               }
+
+               return $status;
+       }
+
+       /**
         * Check enabled suhosin
         *
         * @return NoticeStatus|OkStatus