Mercurial > prosody-modules
comparison mod_log_auth/mod_log_auth.lua @ 3941:6d1ec8099315
mod_log_auth: log hostname, too
author | tmolitor <thilo@eightysoft.de> |
---|---|
date | Tue, 10 Mar 2020 20:42:27 +0100 |
parents | dae655657a92 |
children |
comparison
equal
deleted
inserted
replaced
3940:675726ab06d3 | 3941:6d1ec8099315 |
---|---|
4 | 4 |
5 if mode == "failure" or mode == "all" then | 5 if mode == "failure" or mode == "all" then |
6 module:hook("authentication-failure", function (event) | 6 module:hook("authentication-failure", function (event) |
7 local session = event.session; | 7 local session = event.session; |
8 local username = session.username or session.sasl_handler and session.sasl_handler.username or "?"; | 8 local username = session.username or session.sasl_handler and session.sasl_handler.username or "?"; |
9 session.log("info", "Failed authentication attempt (%s) for user %s from IP: %s", | 9 session.log("info", "Failed authentication attempt (%s) for user %s@%s from IP: %s", |
10 event.condition or "unknown-condition", username, session.ip or "?"); | 10 event.condition or "unknown-condition", username, module.host, session.ip or "?"); |
11 end); | 11 end); |
12 end | 12 end |
13 | 13 |
14 if mode == "success" or mode == "all" then | 14 if mode == "success" or mode == "all" then |
15 module:hook("authentication-success", function (event) | 15 module:hook("authentication-success", function (event) |
16 local session = event.session; | 16 local session = event.session; |
17 session.log("info", "Successful authentication as %s from IP: %s", session.username, session.ip or "?"); | 17 session.log("info", "Successful authentication as %s@%s from IP: %s", session.username, module.host, session.ip or "?"); |
18 end); | 18 end); |
19 end | 19 end |