Commit 3de0f4dc authored by Franco Fichtner's avatar Franco Fichtner

csrf: (re)generate secret on GUI restart

(cherry picked from commit d6411ae0)
(cherry picked from commit b78720b8)
parent e8d34822
......@@ -963,6 +963,7 @@ function system_webgui_start()
global $config;
chdir('/usr/local/www');
@unlink('/usr/local/www/csrf/csrf-secret.php');
/* defaults */
$portarg = "80";
......
......@@ -425,6 +425,8 @@ function csrf_get_secret()
}
if (is_writable($dir)) {
$secret = csrf_generate_secret();
touch($file);
chmod($file, 0600);
$fh = fopen($file, 'w');
fwrite($fh, '<?php $secret = "'.$secret.'";' . PHP_EOL);
fclose($fh);
......
<?php $secret = "3f27f3793cfb16c2700474d5c613487e258143d9";
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment