Hi Ken,
On 13 November 2017 at 15:03, Ken Adams <
kenad...@gmail.com> wrote:
> I've been looking into mod_firewall as a possible option to get this done
> but not 100% sure yet on how to craft up firewall rules file to key in on
> the proper XML portion of the communication to block/deny and send a reply
> to the user stating it's not allowed.
We spoke briefly in the chatroom about this last week. Sorry for the
delay responding here... had a busy couple of weeks and I'm behind
with email.
The main problem with "blocking file transfers" is that it's a very
broad requirement. Hence asking exactly what you were aiming for.
There are a number of different (standardized) ways to transfer files
in XMPP. And any given client is able to invent its own non-standard
file transfer mechanism, for example. And then of course someone could
just copy and paste the contents of a file into a message. So really
consider exactly what your requirements are, and what you are aiming
for.
Now, you mentioned Gajim in the subject. So if we are limiting to
that, blocking just standard protocols should be enough (Gajim
supports plugins, but let's ignore that for now).
Here's an example mod_firewall script that should cover everything:
#####
::deliver
## File transfer protocols
# Block XEP-0096 SI File Transfer
KIND: iq
TYPE: set
PAYLOAD:
http://jabber.org/protocol/si
JUMP CHAIN=user/reject-file-transfer
# Block XEP-0234 Jingle File Transfer
KIND: iq
TYPE: set
PAYLOAD: urn:xmpp:jingle:1
INSPECT: jingle@action=session-initiate
INSPECT: jingle/content/{urn:xmpp:jingle:apps:file-transfer:5}description
JUMP CHAIN=user/reject-file-transfer
# Block XEP-0363 HTTP File Upload
KIND: iq
TYPE: set
PAYLOAD: urn:xmpp:http:upload:0
## Underlying transports
# Block XEP-0047 In-band Bytestreams
KIND: iq
PAYLOAD:
http://jabber.org/protocol/ibb
JUMP CHAIN=user/reject-file-transfer
# Block XEP-0065 SOCKS5 Bytestreams
KIND: iq
PAYLOAD:
http://jabber.org/protocol/bytestreams
JUMP CHAIN=user/reject-file-transfer
::user/reject-file-transfer
BOUNCE=policy-violation (File transfers are not allowed)
#####
Disclaimer: it's not even tested, no guarantees that it blocks
everything (or that it doesn't block legitimate things). It's just
something that may help. Feedback welcome.
Good luck!
Regards,
Matthew