Changeset

5531:af2778f4ee29

mod_firewall: scripts: spam-blocking.pfw: Add special handling for MUC invites
author Matthew Wild <mwild1@gmail.com>
date Thu, 08 Jun 2023 11:28:56 +0100
parents 5530:8226ac08484e
children 5532:d84757f9adcb
files mod_firewall/scripts/spam-blocking.pfw
diffstat 1 files changed, 20 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_firewall/scripts/spam-blocking.pfw	Thu Jun 08 11:28:06 2023 +0100
+++ b/mod_firewall/scripts/spam-blocking.pfw	Thu Jun 08 11:28:56 2023 +0100
@@ -97,6 +97,13 @@
 TYPE: groupchat
 PASS.
 
+# Mediated MUC invitations are naturally from 'strangers' and have special
+# handling. We lean towards accepting them, unless overridden by custom rules.
+NOT FROM FULL JID?
+NOT INSPECT: body
+INSPECT: {http://jabber.org/protocol/muc#user}x/invite
+JUMP CHAIN=user/spam_check_muc_invite
+
 # Non-chat message types often generate pop-ups in clients,
 # so we won't accept them from strangers
 NOT TYPE: chat
@@ -138,6 +145,18 @@
 
 ##################################################################
 
+#### Rules for MUC invitations ###################################
+
+::user/spam_check_muc_invite
+
+# This chain can be used to inspect the invitation and determine
+# the appropriate action. Otherwise, we proceed with the default
+# action below.
+JUMP CHAIN=user/spam_check_muc_invite_custom
+
+# Allow mediated MUC invitations by default
+PASS.
+
 #### Stanzas reaching this chain will be rejected ################
 ::user/spam_reject
 
@@ -151,7 +170,7 @@
 
 ##################################################################
 
-#### Stanzas that may be spam, but we're not sure either way######
+#### Stanzas that may be spam, but we're not sure either way #####
 ::user/spam_handle_unknown
 
 # This chain can be used by other scripts