diff options
author | Jo-Philipp Wich <jo@mein.io> | 2018-01-17 18:49:08 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2018-01-17 18:49:42 +0100 |
commit | a441721d32d06d18368bf236ad127ffccad0bef8 (patch) | |
tree | f80262a71c82f9561904c94d1ff26a02d449a108 /modules/luci-base | |
parent | 0fdec7a4bc68f65457aedc4dbc96a27eef66f814 (diff) |
luci-base: log login attempts
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base')
-rw-r--r-- | modules/luci-base/luasrc/dispatcher.lua | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/modules/luci-base/luasrc/dispatcher.lua b/modules/luci-base/luasrc/dispatcher.lua index e4f77f18d8..16b32548e6 100644 --- a/modules/luci-base/luasrc/dispatcher.lua +++ b/modules/luci-base/luasrc/dispatcher.lua @@ -191,6 +191,9 @@ local function session_setup(user, pass, allowed_users) timeout = tonumber(luci.config.sauth.sessiontime) }) + local rp = context.requestpath + and table.concat(context.requestpath, "/") or "" + if type(login) == "table" and type(login.ubus_rpc_session) == "string" then @@ -199,8 +202,14 @@ local function session_setup(user, pass, allowed_users) 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) end + + io.stderr:write("luci: failed login on /%s for %s from %s\n" + %{ rp, user, http.getenv("REMOTE_ADDR") or "?" }) end return nil, nil @@ -358,7 +367,7 @@ function dispatch(request) "https://github.com/openwrt/luci/issues" ) - if track.sysauth then + if track.sysauth and not ctx.authsession then local authen = track.sysauth_authenticator local _, sid, sdat, default_user, allowed_users |