--- a/admin/cli/install.php +++ b/admin/cli/install.php @@ -479,8 +479,10 @@ if ($interactive) { } } +$saltlength = floor(rand(40,200)); + // Finally we have all info needed for config.php -$configphp = install_generate_configphp($database, $CFG); +$configphp = install_generate_configphp($database, $CFG, null, $saltlength); umask(0137); if (($fh = fopen($configfile, 'w')) !== false) { fwrite($fh, $configphp); diff --git a/lib/installlib.php b/lib/installlib.php index 1dbb55b..aefef93 100644 --- a/lib/installlib.php +++ b/lib/installlib.php @@ -130,7 +130,7 @@ function install_db_validate($database, $dbhost, $dbuser, $dbpass, $dbname, $pre * @param bool $userealpath allows symbolic links in dirroot * @return string */ -function install_generate_configphp($database, $cfg, $userealpath=false) { +function install_generate_configphp($database, $cfg, $userealpath=false, $saltlength) { $configphp = 'directorypermissions = 00777; // try 02777 on a server in Safe Mode'."\r\n"; $configphp .= "\r\n"; - $configphp .= '$CFG->passwordsaltmain = '.var_export(complex_random_string(), true).";\r\n"; + $configphp .= '$CFG->passwordsaltmain = '.var_export(complex_random_string($saltlength), true).";\r\n"; $configphp .= "\r\n"; $configphp .= 'require_once("$CFG->dirroot/lib/setup.php");'."\r\n\r\n"; -- 1.6.3.3