luci-base: log login attempts
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
0fdec7a4bc
commit
a441721d32
1 changed files with 10 additions and 1 deletions
|
@ -191,6 +191,9 @@ local function session_setup(user, pass, allowed_users)
|
||||||
timeout = tonumber(luci.config.sauth.sessiontime)
|
timeout = tonumber(luci.config.sauth.sessiontime)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
local rp = context.requestpath
|
||||||
|
and table.concat(context.requestpath, "/") or ""
|
||||||
|
|
||||||
if type(login) == "table" and
|
if type(login) == "table" and
|
||||||
type(login.ubus_rpc_session) == "string"
|
type(login.ubus_rpc_session) == "string"
|
||||||
then
|
then
|
||||||
|
@ -199,8 +202,14 @@ local function session_setup(user, pass, allowed_users)
|
||||||
values = { token = sys.uniqueid(16) }
|
values = { token = sys.uniqueid(16) }
|
||||||
})
|
})
|
||||||
|
|
||||||
|
io.stderr:write("luci: accepted login on /%s for %s from %s\n"
|
||||||
|
%{ rp, user, http.getenv("REMOTE_ADDR") or "?" })
|
||||||
|
|
||||||
return session_retrieve(login.ubus_rpc_session)
|
return session_retrieve(login.ubus_rpc_session)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
io.stderr:write("luci: failed login on /%s for %s from %s\n"
|
||||||
|
%{ rp, user, http.getenv("REMOTE_ADDR") or "?" })
|
||||||
end
|
end
|
||||||
|
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
@ -358,7 +367,7 @@ function dispatch(request)
|
||||||
"https://github.com/openwrt/luci/issues"
|
"https://github.com/openwrt/luci/issues"
|
||||||
)
|
)
|
||||||
|
|
||||||
if track.sysauth then
|
if track.sysauth and not ctx.authsession then
|
||||||
local authen = track.sysauth_authenticator
|
local authen = track.sysauth_authenticator
|
||||||
local _, sid, sdat, default_user, allowed_users
|
local _, sid, sdat, default_user, allowed_users
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue