annotate mod_log_auth/mod_log_auth.lua @ 2491:5fbca7de2088

mod_smacks: Send out more ack requests where needed Under some circumstances it was possible that more than "max_unacked_stanzas" where left in the outgoing stanza queue without forcing an ack. This could happen, when more stanzas entered the queue while the last ack request was still unanswered. Now the test "#queue > max_unacked_stanzas" is done upon receiving an ack as well as when sending out stanzas, which fixes this bug.
author tmolitor <thilo@eightysoft.de>
date Sun, 12 Feb 2017 19:27:50 +0100
parents 9d43095d915f
children 8b21f13b08c5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1427
322a076f53e8 mod_log_auth: Add ability to log IPs of successful authentications too
Matthew Wild <mwild1@gmail.com>
parents: 1097
diff changeset
1 local mode = module:get_option_string("log_auth_ips", "failure");
322a076f53e8 mod_log_auth: Add ability to log IPs of successful authentications too
Matthew Wild <mwild1@gmail.com>
parents: 1097
diff changeset
2 assert(({ all = true, failure = true, success = true })[mode], "Unknown log mode: "..tostring(mode).." - valid modes are 'all', 'failure', 'success'");
407
41feaf7fd8ac mod_auth_log: New module (currently) to log failed auth attempts and their IP address, requires trunk
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
3
1427
322a076f53e8 mod_log_auth: Add ability to log IPs of successful authentications too
Matthew Wild <mwild1@gmail.com>
parents: 1097
diff changeset
4 if mode == "failure" or mode == "all" then
322a076f53e8 mod_log_auth: Add ability to log IPs of successful authentications too
Matthew Wild <mwild1@gmail.com>
parents: 1097
diff changeset
5 module:hook("authentication-failure", function (event)
2084
9d43095d915f mod_log_auth: Include username, if known
Kim Alvefur <zash@zash.se>
parents: 1427
diff changeset
6 module:log("info", "Failed authentication attempt (%s) for user %s from IP: %s", event.condition or "unknown-condition", event.session.username or "?", event.session.ip or "?");
1427
322a076f53e8 mod_log_auth: Add ability to log IPs of successful authentications too
Matthew Wild <mwild1@gmail.com>
parents: 1097
diff changeset
7 end);
322a076f53e8 mod_log_auth: Add ability to log IPs of successful authentications too
Matthew Wild <mwild1@gmail.com>
parents: 1097
diff changeset
8 end
322a076f53e8 mod_log_auth: Add ability to log IPs of successful authentications too
Matthew Wild <mwild1@gmail.com>
parents: 1097
diff changeset
9
322a076f53e8 mod_log_auth: Add ability to log IPs of successful authentications too
Matthew Wild <mwild1@gmail.com>
parents: 1097
diff changeset
10 if mode == "success" or mode == "all" then
322a076f53e8 mod_log_auth: Add ability to log IPs of successful authentications too
Matthew Wild <mwild1@gmail.com>
parents: 1097
diff changeset
11 module:hook("authentication-success", function (event)
322a076f53e8 mod_log_auth: Add ability to log IPs of successful authentications too
Matthew Wild <mwild1@gmail.com>
parents: 1097
diff changeset
12 local session = event.session;
322a076f53e8 mod_log_auth: Add ability to log IPs of successful authentications too
Matthew Wild <mwild1@gmail.com>
parents: 1097
diff changeset
13 module:log("info", "Successful authentication as %s from IP: %s", session.username, session.ip or "?");
322a076f53e8 mod_log_auth: Add ability to log IPs of successful authentications too
Matthew Wild <mwild1@gmail.com>
parents: 1097
diff changeset
14 end);
322a076f53e8 mod_log_auth: Add ability to log IPs of successful authentications too
Matthew Wild <mwild1@gmail.com>
parents: 1097
diff changeset
15 end