From 6a7a9d668e5a23ad5d1c0a1630c7b2c2b82ef19c Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sat, 31 Oct 2020 13:53:19 +0100 Subject: [PATCH] Restore ngx logging used by fail2ban to detect failed logging attempt --- helpers.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/helpers.lua b/helpers.lua index c70463e..0fcd332 100644 --- a/helpers.lua +++ b/helpers.lua @@ -381,11 +381,15 @@ function authenticate(user, password) ensure_user_password_uses_strong_hash(connected, user, password) end cache:add(user.."-password", password, conf["session_timeout"]) + ngx.log(ngx.NOTICE, "Connected as: "..user) logger.info("User "..user.." succesfully authenticated from "..ngx.var.remote_addr) return user -- Else, the username/email or the password is wrong else + -- N.B. : the ngx.log is important and is related to the regex used by + -- the fail2ban rule to detect (and ban) failed login attempts + ngx.log(ngx.ERR, "Connection failed for: "..user) logger.error("Authentication failure for user "..user.." from "..ngx.var.remote_addr) return false end