And create a filter definition in */etc/fail2ban/filter.d/friendica.conf*:
[Definition]
- failregex = ^.*Login\.php.*failed login attempt.*from IP <HOST>.*$
+ failregex = ^.*authenticate\: failed login attempt.*\"ip\"\:\"<HOST>\".*$
ignoreregex =
Additionally you have to define the number of failed logins before the ban should be activated.
* @brief Logs the given message at the given log level
*
* @param string $msg
- * @param int $level
+ * @param string $level
*
* @throws \Exception
* @deprecated since 2019.03 Use Logger::debug() Logger::info() , ... instead
*/
- public static function log($msg, $level = 3)
+ public static function log($msg, $level = LogLevel::INFO)
{
if (!isset(self::$logger)) {
return;
}
- $loglevel = self::mapLegacyDebugLevel($level);
-
$stamp1 = microtime(true);
- self::$logger->log($loglevel, $msg);
+ self::$logger->log($level, $msg);
self::getApp()->saveTimestamp($stamp1, "file");
}
);
}
} catch (Exception $e) {
- Logger::notice('authenticate: failed login attempt', ['username' => Strings::escapeTags($username), 'ip' => $_SERVER['REMOTE_ADDR']]);
+ Logger::notice('authenticate: failed login attempt', ['action' => 'login', 'username' => Strings::escapeTags($username), 'ip' => $_SERVER['REMOTE_ADDR']]);
info('Login failed. Please check your credentials.' . EOL);
$a->internalRedirect();
}