Log mislukte logins als LOGIN_FAILED (fail2ban/rapportage), logger-threshold naar 5

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 10:21:08 +02:00
co-authored by Claude Sonnet 5.5
parent 506c88a5bd
commit 643f5fd9a7
7 changed files with 188 additions and 1 deletions
+13
View File
@@ -329,3 +329,16 @@ if (!function_exists('get_password_requirements_nl')) {
];
}
}
if (!function_exists('sanitize_log_user')) {
/**
* Make a username safe for use in a log line (prevents log injection):
* only [A-Za-z0-9_@.-+] is kept, everything else becomes "_", max 64 chars.
*/
function sanitize_log_user(string $user): string
{
$user = substr(preg_replace('/[^A-Za-z0-9_@.\-+]/', '_', $user), 0, 64);
return $user === '' ? '-' : $user;
}
}