Mercurial > prosody-modules
view mod_log_auth/mod_log_auth.lua @ 1733:9abd3dce619a
mod_smacks: Handle the read timeout event (0.10+ only) and send an ack request, close the connection the second time if unanswerd
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 11 May 2015 15:07:52 +0200 |
parents | 322a076f53e8 |
children | 9d43095d915f |
line wrap: on
line source
local mode = module:get_option_string("log_auth_ips", "failure"); assert(({ all = true, failure = true, success = true })[mode], "Unknown log mode: "..tostring(mode).." - valid modes are 'all', 'failure', 'success'"); if mode == "failure" or mode == "all" then module:hook("authentication-failure", function (event) module:log("info", "Failed authentication attempt (%s) from IP: %s", event.condition or "unknown-condition", event.session.ip or "?"); end); end if mode == "success" or mode == "all" then module:hook("authentication-success", function (event) local session = event.session; module:log("info", "Successful authentication as %s from IP: %s", session.username, session.ip or "?"); end); end