[Pkg-owncloud-commits] [owncloud] 02/62: Add check for availability of /dev/urandom
David Prévot
taffit at moszumanska.debian.org
Tue Jun 23 23:39:32 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag v8.0.5beta
in repository owncloud.
commit f9e258437f77bb81929b01d85201d8f39cfd3a0f
Author: Lukas Reschke <lukas at owncloud.com>
Date: Wed May 27 18:43:17 2015 +0200
Add check for availability of /dev/urandom
Backport of https://github.com/owncloud/core/pull/16565 to stable8
---
core/js/setupchecks.js | 5 +++++
settings/ajax/checksetup.php | 18 ++++++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js
index d43a356..e6b375d 100644
--- a/core/js/setupchecks.js
+++ b/core/js/setupchecks.js
@@ -64,6 +64,11 @@
t('core', 'cURL is not installed, some functionality might not work. Please install the PHP cURL extension. Future versions will require installed cURL.')
);
}
+ if(!data.isUrandomAvailable) {
+ messages.push(
+ t('core', '/dev/urandom is not readable by PHP which is highly discouraged for security reasons. Further information can be found in our <a href="{docLink}">documentation</a>.', {docLink: data.securityDocs})
+ );
+ }
} else {
messages.push(t('core', 'Error occurred while checking server setup'));
}
diff --git a/settings/ajax/checksetup.php b/settings/ajax/checksetup.php
index 3e226c5..7114ba8 100644
--- a/settings/ajax/checksetup.php
+++ b/settings/ajax/checksetup.php
@@ -10,6 +10,22 @@ OCP\JSON::callCheck();
\OC::$server->getSession()->close();
+/**
+ * Whether /dev/urandom is available to the PHP controller
+ *
+ * @return bool
+ */
+function isUrandomAvailable() {
+ if(@file_exists('/dev/urandom')) {
+ $file = fopen('/dev/urandom', 'rb');
+ if($file) {
+ fclose($file);
+ return true;
+ }
+ }
+ return false;
+}
+
// no warning when has_internet_connection is false in the config
$hasInternet = true;
if (OC_Util::isInternetConnectionEnabled()) {
@@ -21,5 +37,7 @@ OCP\JSON::success(
'serverHasInternetConnection' => $hasInternet,
'dataDirectoryProtected' => OC_Util::isHtaccessWorking(),
'hasCurlInstalled' => function_exists('curl_init'),
+ 'isUrandomAvailable' => isUrandomAvailable(),
+ 'securityDocs' => \OC::$server->getURLGenerator()->linkToDocs('admin-security'),
)
);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list