mirror of
https://github.com/YunoHost/SSOwat.git
synced 2024-09-03 20:06:27 +02:00
Restore ngx logging used by fail2ban to detect failed logging attempt
This commit is contained in:
parent
229939dfbc
commit
6a7a9d668e
1 changed files with 4 additions and 0 deletions
|
@ -381,11 +381,15 @@ function authenticate(user, password)
|
||||||
ensure_user_password_uses_strong_hash(connected, user, password)
|
ensure_user_password_uses_strong_hash(connected, user, password)
|
||||||
end
|
end
|
||||||
cache:add(user.."-password", password, conf["session_timeout"])
|
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)
|
logger.info("User "..user.." succesfully authenticated from "..ngx.var.remote_addr)
|
||||||
return user
|
return user
|
||||||
|
|
||||||
-- Else, the username/email or the password is wrong
|
-- Else, the username/email or the password is wrong
|
||||||
else
|
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)
|
logger.error("Authentication failure for user "..user.." from "..ngx.var.remote_addr)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue