From: Jan Pavlinec Date: Fri, 12 Mar 2021 15:24:52 +0000 (+0100) Subject: luci-base: send failed/successfull login to syslog X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=refs%2Fpull%2F4925%2Fhead;p=project%2Fluci.git luci-base: send failed/successfull login to syslog Note: This change is relevant for systems that don't use uhttpd for LuCI. This log can be later used for fail2ban etc. Signed-off-by: Jan Pavlinec --- diff --git a/modules/luci-base/luasrc/dispatcher.lua b/modules/luci-base/luasrc/dispatcher.lua index 44c17c85f8..2f965b16a8 100644 --- a/modules/luci-base/luasrc/dispatcher.lua +++ b/modules/luci-base/luasrc/dispatcher.lua @@ -563,15 +563,13 @@ local function session_setup(user, pass) ubus_rpc_session = login.ubus_rpc_session, values = { token = sys.uniqueid(16) } }) - - io.stderr:write("luci: accepted login on /%s for %s from %s\n" - %{ rp, user or "?", http.getenv("REMOTE_ADDR") or "?" }) + nixio.syslog("info", tostring("luci: accepted login on /%s for %s from %s\n" + %{ rp, user or "?", 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 or "?", http.getenv("REMOTE_ADDR") or "?" }) + nixio.syslog("info", tostring("luci: failed login on /%s for %s from %s\n" + %{ rp, user or "?", http.getenv("REMOTE_ADDR") or "?" })) end local function check_authentication(method)