matrix-org / pantalaimon

E2EE aware proxy daemon for matrix clients.
Apache License 2.0
279 stars 41 forks source link

Encrypted rooms cannot send message #163

Open catfromplan9 opened 6 months ago

catfromplan9 commented 6 months ago

Latest matrix-nio release, latest pantalaimon compiled from git (because your latest release has been broken for the last 12 or so months!). I have tried a few different configurations, but using git release of pantalaimon and latest stable release of matrix-nio seems to have least amount of problems. Reading encrypted rooms works fine. Sending and reading in unencrypted rooms works fine. Whenever I try to send a message to an encrypted room, I get a few "Missing session for device XXXXXXX" but nothing else until my client times out.

catfromplan9 commented 6 months ago

Forgot to mention: Using pantalaimon 0.10.5 with matrix-nio 0.19.0 can send messages in some encrypted rooms, but half the unencrypted and encrypted rooms will not work and i get an immediate error from pantalaimon telling me it failed to sync when i send the message - The internal Pantalaimon client did not manage to sync with the server.. Additionally, if I start using pantalaimon with the matrix-nio 0.19.0, the device it creates on my account is not an encrypted one and so it won't work. Creating the session with an up to date matrix-nio and then downgrading it afterward resolves this. Using an up to date matrix-nio with pantalaimon 0.10.5 breaks media, as you know I'm sure.

crisukbot commented 5 months ago

I have the same problem. Do you know how to fix it?

catfromplan9 commented 5 months ago

I have the same problem. Do you know how to fix it?

Not a full fix, but here is the hacky solution I am happy with:

--- a/pantalaimon/daemon.py     2024-01-19 17:17:10.010235297 +0000
+++ b/pantalaimon/daemon.py     2024-01-19 17:17:21.477075027 +0000
@@ -940,8 +940,7 @@
         # Don't encrypt reactions for now - they are weird and clients
         # need to support them like this.
         # TODO: Fix when MSC1849 is fully supported by clients.
-        if request.match_info["event_type"] == "m.reaction":
-            encrypt = False
+        encrypt = False

         msgtype = request.match_info["event_type"]

I am using Gentoo, so I just placed this file in /etc/portage/patches/dev-python/pantalaimon/disable_encryption.patch and reinstalled it. This will disable encryption for all outgoing messages. Me personally, I don't mind doing this.