diff --git a/code/web/cron/createKeyFile.php b/code/web/cron/createKeyFile.php new file mode 100644 index 0000000000..c498c7207a --- /dev/null +++ b/code/web/cron/createKeyFile.php @@ -0,0 +1,34 @@ +` // lucas diff --git a/code/web/services/API/SystemAPI.php b/code/web/services/API/SystemAPI.php index b4e4ef1e3f..2a9d0f54f5 100644 --- a/code/web/services/API/SystemAPI.php +++ b/code/web/services/API/SystemAPI.php @@ -571,40 +571,6 @@ public function checkWhichUpdatesHaveRun($availableUpdates) { return $availableUpdates; } - /** @noinspection PhpUnused */ - function createKeyFile() { - global $serverName; - $passkeyFile = ROOT_DIR . "/../../sites/$serverName/conf/passkey"; - if (!file_exists($passkeyFile)) { - // Return the file path (note that all ini files are in the conf/ directory) - $methods = [ - 'aes-256-gcm', - 'aes-128-gcm', - ]; - foreach ($methods as $cipher) { - if (in_array($cipher, openssl_get_cipher_methods())) { - //Generate a 32 character password which will encode to 64 characters in hex notation - $key = bin2hex(openssl_random_pseudo_bytes(32)); - break; - } - } - $passkeyFhnd = fopen($passkeyFile, 'w'); - fwrite($passkeyFhnd, $cipher . ':' . $key); - fclose($passkeyFhnd); - - //Make sure the file is not readable by anyone except the aspen user - if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { - $runningOnWindows = true; - } else { - $runningOnWindows = false; - } - if (!$runningOnWindows) { - exec('chown aspen:aspen_apache ' . $passkeyFile); - exec('chmod 440 ' . $passkeyFile); - } - } - } - function doesKeyFileExist() { global $serverName; $passkeyFile = ROOT_DIR . "/../../sites/$serverName/conf/passkey";