From be8d749599a11229435141d85cfe5eba2dcf96d2 Mon Sep 17 00:00:00 2001 From: Jan Pavlinec Date: Fri, 12 Mar 2021 16:24:52 +0100 Subject: 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 --- modules/luci-base/luasrc/dispatcher.lua | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) 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) -- cgit v1.2.3