Merge branch '2.4' of https://github.com/MISP/MISP into 2.4

pull/1380/head
Iglocska 2016-07-20 12:38:04 +02:00
commit b14e6e2f5f
3 changed files with 7 additions and 3 deletions

View File

@ -4,7 +4,7 @@ $config = array (
'Security' =>
array (
'level' => 'medium',
'salt' => 'Rooraenietu8Eeyo<Qu2eeNfterd-dd+',
'salt' => '',
'cipherSeed' => '',
//'auth'=>array('CertAuth.Certificate'), // additional authentication methods
),

View File

@ -84,6 +84,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])) {

View File

@ -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 = '';