diff mod_audit_auth/mod_audit_auth.lua @ 4933:530d116b7f68

mod_audit*: modules for audit logging in prosody These are to be seen as proof-of-concept for now.
author Jonas Schäfer <jonas@wielicki.name>
date Tue, 26 Apr 2022 22:32:44 +0200
parents
children 08dea42a302a
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mod_audit_auth/mod_audit_auth.lua	Tue Apr 26 22:32:44 2022 +0200
@@ -0,0 +1,15 @@
+module:depends("audit");
+
+module:hook("authentication-failure", function(event)
+	local session = event.session;
+	module:audit(session.sasl_handler.username, "authentication-failure", {
+		session = session,
+	});
+end)
+
+module:hook("authentication-success", function(event)
+	local session = event.session;
+	module:audit(session.sasl_handler.username, "authentication-success", {
+		session = session,
+	});
+end)