Add IP address to authentication error logs
This commit is contained in:
@@ -95,10 +95,11 @@ class AuthSubscriber extends BaseSubscriber implements EventSubscriberInterface
|
|||||||
{
|
{
|
||||||
$this->logger->debug('Subscriber executed: '.__METHOD__);
|
$this->logger->debug('Subscriber executed: '.__METHOD__);
|
||||||
$username = $event->getUsername();
|
$username = $event->getUsername();
|
||||||
|
$ipAddress = $this->request->getIpAddress();
|
||||||
|
|
||||||
if (! empty($username)) {
|
if (! empty($username)) {
|
||||||
// log login failure in web server log to allow fail2ban usage
|
// log login failure in web server log to allow fail2ban usage
|
||||||
error_log('Kanboard: user '.$username.' authentication failure');
|
error_log('Kanboard: user '.$username.' authentication failure with IP address: '.$ipAddress);
|
||||||
$this->userLockingModel->incrementFailedLogin($username);
|
$this->userLockingModel->incrementFailedLogin($username);
|
||||||
|
|
||||||
if ($this->userLockingModel->getFailedLogin($username) > BRUTEFORCE_LOCKDOWN) {
|
if ($this->userLockingModel->getFailedLogin($username) > BRUTEFORCE_LOCKDOWN) {
|
||||||
@@ -107,7 +108,7 @@ class AuthSubscriber extends BaseSubscriber implements EventSubscriberInterface
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// log login failure in web server log to allow fail2ban usage
|
// log login failure in web server log to allow fail2ban usage
|
||||||
error_log('Kanboard: user Unknown authentication failure');
|
error_log('Kanboard: user Unknown authentication failure with IP address: '.$ipAddress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user