mirror of https://github.com/MISP/MISP
fix: Remove the default defined salt #625
parent
af2f355cb4
commit
4f169a8ffa
|
@ -4,7 +4,7 @@ $config = array (
|
|||
'Security' =>
|
||||
array (
|
||||
'level' => 'medium',
|
||||
'salt' => 'Rooraenietu8Eeyo<Qu2eeNfterd-dd+',
|
||||
'salt' => '',
|
||||
'cipherSeed' => '',
|
||||
//'auth'=>array('CertAuth.Certificate'), // additional authentication methods
|
||||
),
|
||||
|
|
|
@ -81,6 +81,11 @@ class AppController extends Controller {
|
|||
$this->loadModel('User');
|
||||
$auth_user_fields = $this->User->describeAuthFields();
|
||||
|
||||
//if fresh installation (salt empty) generate a new salt
|
||||
if (!Configure::read('Security.salt')) {
|
||||
$this->loadModel('Server');
|
||||
$this->Server->serverSettingsSaveValue('Security.salt', $this->User->generateRandomPassword(32));
|
||||
}
|
||||
// check if Apache provides kerberos authentication data
|
||||
$envvar = Configure::read('ApacheSecureAuth.apacheEnv');
|
||||
if (isset($_SERVER[$envvar])) {
|
||||
|
|
|
@ -431,8 +431,7 @@ class User extends AppModel {
|
|||
return $key;
|
||||
}
|
||||
|
||||
public function generateRandomPassword() {
|
||||
$length = 12;
|
||||
public function generateRandomPassword($length = 12) {
|
||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-+=!@#$%&*()<>/?';
|
||||
$charLen = strlen($characters) - 1;
|
||||
$key = '';
|
||||
|
|
Loading…
Reference in New Issue