Mercurial > prosody-modules
diff mod_restrict_federation/mod_restrict_federation.lua @ 6544:981c14bb8975
mod_restrict_federation: Allow some ad-hoc commands used by push services
This fixes push registration for Siskin, Conversations and Snikket Android+iOS
when used by restricted accounts.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 21 May 2026 18:32:31 +0100 |
| parents | ba2c344e1bdd |
| children | cfcd2d2f7119 |
line wrap: on
line diff
--- a/mod_restrict_federation/mod_restrict_federation.lua Tue May 19 13:31:35 2026 -0500 +++ b/mod_restrict_federation/mod_restrict_federation.lua Thu May 21 18:32:31 2026 +0100 @@ -17,6 +17,22 @@ return; end + if stanza.name == "iq" then + if stanza.attr.type == "result" or stanza.attr.type == "error" then + -- Allow responses to iqs + return; + end + local payload = stanza.tags[1]; + -- Allow push notification registration + if payload.name == "command" and payload.attr.xmlns == "http://jabber.org/protocol/commands" then + -- This should allow Tigase and p2 ad-hoc commands to pass through to push gateways + if node:match("^register%-") or node:match("^unregister%-") then + return; + end + end + end + + -- Block module:log("debug", "Forbidding outgoing %s stanza from <%s> to <%s>", stanza.name, stanza.attr.from, stanza.attr.to); local err_reply = st.error_reply(event.stanza, "auth", "policy-violation", "Communication with remote domains is not permitted"); @@ -33,6 +49,13 @@ return; end + if stanza.name == "iq" then + if stanza.attr.type == "result" or stanza.attr.type == "error" then + -- Allow responses to iqs + return; + end + end + local recipient_username = jid_node(stanza.attr.to); if not recipient_username then return;
