security: Use more secure password hashes (#8213)

* More secure password hashes
Use PHP 5.5 password_hash(), currently uses bcrypt
increase password field length as per php documentation

* Use password_hash()/password_verify() for cookies too

* forgot to update db_schema.yaml
This commit is contained in:
Tony Murray
2018-02-08 17:08:21 -06:00
committed by Neil Lathwood
parent 496575ea99
commit 1188b53192
5 changed files with 42 additions and 54 deletions

View File

@@ -2,7 +2,6 @@
<?php
use LibreNMS\Authentication\Auth;
use Phpass\PasswordHash;
$options = getopt('u:rdvh');
if (isset($options['h']) || !isset($options['u'])) {
@@ -96,8 +95,7 @@ try {
exit;
}
$hasher = new PasswordHash(8, false);
$token = $session['session_username'] . '|' . $hasher->HashPassword($session['session_username'] . $session['session_token']);
$token = $session['session_username'] . '|' . password_hash($session['session_username'] . $session['session_token'], PASSWORD_DEFAULT);
$auth = $authorizer->reauthenticate($session['session_value'], $token);
if ($auth) {