Changeset

6124:bdbf12a2a854

mod_anti_spam: Add some debug logs This can be useful to diagnose issues when spam slips through.
author Matthew Wild <mwild1@gmail.com>
date Mon, 30 Dec 2024 13:52:38 +0000
parents 6123:f6bbf42c341c
children 6125:a54b94a3e994
files mod_anti_spam/mod_anti_spam.lua
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_anti_spam/mod_anti_spam.lua	Mon Dec 30 13:51:35 2024 +0000
+++ b/mod_anti_spam/mod_anti_spam.lua	Mon Dec 30 13:52:38 2024 +0000
@@ -145,6 +145,8 @@
 	local from_bare = jid_bare(event.stanza.attr.from);
 	if not is_from_stranger(from_bare, event) then return; end
 
+	module:log("debug", "Processing message from stranger...");
+
 	if is_spammy_server(event.origin) then
 		return block_spam(event, "known-spam-source", "drop");
 	end
@@ -156,6 +158,8 @@
 	if is_spammy_content(event.stanza) then
 		return block_spam(event, "spam-content", "drop");
 	end
+
+	module:log("debug", "Allowing message through");
 end, 500);
 
 module:hook("presence/bare", function (event)
@@ -163,11 +167,19 @@
 		return;
 	end
 
+	module:log("debug", "Processing subscription request...");
+
 	if is_spammy_server(event.origin) then
 		return block_spam(event, "known-spam-source", "drop");
 	end
 
+	module:log("debug", "Not from known spam source server");
+
 	if is_spammy_sender(event.stanza) then
 		return block_spam(event, "known-spam-jid", "drop");
 	end
+
+	module:log("debug", "Not from known spam source JID");
+
+	module:log("debug", "Allowing subscription request through");
 end, 500);