Add error log for authentication failure to allow fail2ban integration

This commit is contained in:
doc75 2018-02-20 01:55:57 +01:00 committed by fguillot
parent e9c452099e
commit da3d993243
1 changed files with 6 additions and 0 deletions

View File

@ -97,11 +97,17 @@ class AuthSubscriber extends BaseSubscriber implements EventSubscriberInterface
$username = $event->getUsername();
if (! empty($username)) {
// log login failure in web server log to allow fail2ban usage
error_log('Kanboard: user '.$username.' authentication failure');
$this->userLockingModel->incrementFailedLogin($username);
if ($this->userLockingModel->getFailedLogin($username) > BRUTEFORCE_LOCKDOWN) {
$this->userLockingModel->lock($username, BRUTEFORCE_LOCKDOWN_DURATION);
}
}
else {
// log login failure in web server log to allow fail2ban usage
error_log('Kanboard: user Unknown authentication failure');
}
}
}