Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e2ee not working #890

Open
kerneus opened this issue Feb 3, 2023 · 2 comments
Open

e2ee not working #890

kerneus opened this issue Feb 3, 2023 · 2 comments

Comments

@kerneus
Copy link

kerneus commented Feb 3, 2023

Hello!
My bridge cannot send me decryption keys.
Synapse 1.75.0
mautrix-telegram 0.12.2
Python 3.9
tail -f ../mautrix-telegram/mautrix-telegram.log device = await self.get_or_fetch_device_by_key(evt.sender, session.sender_key) File "/opt/mautrix-telegram/venv/lib/python3.9/site-packages/mautrix/crypto/device_lists.py", line 227, in get_or_fetch_device_by_key device = await self.crypto_store.find_device_by_key(user_id, identity_key) File "/opt/mautrix-telegram/venv/lib/python3.9/site-packages/mautrix/crypto/store/asyncpg/store.py", line 482, in find_device_by_key trust=TrustState(row["trust"]), File "/usr/lib/python3.9/enum.py", line 360, in __call__ return cls.__new__(cls, value) File "/usr/lib/python3.9/enum.py", line 678, in __new__ raise ve_exc ValueError: 1 is not a valid TrustState [2023-02-03 10:45:15,204] [[email protected]] Exception in Matrix event handler Traceback (most recent call last): File "/opt/mautrix-telegram/venv/lib/python3.9/site-packages/mautrix/appservice/as_handler.py", line 311, in try_handle await handler_func(event) File "/opt/mautrix-telegram/venv/lib/python3.9/site-packages/mautrix/bridge/matrix.py", line 1024, in int_handle_event await self.handle_encrypted(evt) File "/opt/mautrix-telegram/venv/lib/python3.9/site-packages/mautrix/bridge/matrix.py", line 797, in handle_encrypted decrypted = await self.e2ee.decrypt(evt, wait_session_timeout=3) File "/opt/mautrix-telegram/venv/lib/python3.9/site-packages/mautrix/bridge/e2ee.py", line 210, in decrypt decrypted = await self.crypto.decrypt_megolm_event(evt) File "/opt/mautrix-telegram/venv/lib/python3.9/site-packages/mautrix/crypto/decrypt_megolm.py", line 70, in decrypt_megolm_event device = await self.get_or_fetch_device_by_key(evt.sender, session.sender_key) File "/opt/mautrix-telegram/venv/lib/python3.9/site-packages/mautrix/crypto/device_lists.py", line 227, in get_or_fetch_device_by_key device = await self.crypto_store.find_device_by_key(user_id, identity_key) File "/opt/mautrix-telegram/venv/lib/python3.9/site-packages/mautrix/crypto/store/asyncpg/store.py", line 482, in find_device_by_key trust=TrustState(row["trust"]), File "/usr/lib/python3.9/enum.py", line 360, in __call__ return cls.__new__(cls, value) File "/usr/lib/python3.9/enum.py", line 678, in __new__ raise ve_exc ValueError: 1 is not a valid TrustState [2023-02-03 10:46:16,921] [[email protected].@user:matrix.com] Failed to handle Telegram update Traceback (most recent call last): File "/opt/mautrix-telegram/venv/lib/python3.9/site-packages/mautrix_telegram/abstract_user.py", line 272, in _update_catch await self._update(update) File "/opt/mautrix-telegram/venv/lib/python3.9/site-packages/mautrix_telegram/abstract_user.py", line 335, in _update await self.update_message(update) File "/opt/mautrix-telegram/venv/lib/python3.9/site-packages/mautrix_telegram/abstract_user.py", line 696, in update_message return await portal.handle_telegram_message(self, sender, update) File "/opt/mautrix-telegram/venv/lib/python3.9/site-packages/mautrix_telegram/portal.py", line 3350, in handle_telegram_message converted = await self._msg_conv.convert(source, intent, is_bot, evt) File "/opt/mautrix-telegram/venv/lib/python3.9/site-packages/mautrix_telegram/portal_util/message_convert.py", line 162, in convert converted = await convert_media(source=source, intent=intent, evt=evt, client=client) File "/opt/mautrix-telegram/venv/lib/python3.9/site-packages/mautrix_telegram/portal_util/message_convert.py", line 459, in _convert_document file = await util.transfer_file_to_matrix( File "/opt/mautrix-telegram/venv/lib/python3.9/site-packages/mautrix_telegram/util/file_transfer.py", line 312, in transfer_file_to_matrix return await _unlocked_transfer_file_to_matrix( File "/opt/mautrix-telegram/venv/lib/python3.9/site-packages/mautrix_telegram/util/file_transfer.py", line 408, in _unlocked_transfer_file_to_matrix db_file.thumbnail = await transfer_thumbnail_to_matrix( File "/opt/mautrix-telegram/venv/lib/python3.9/site-packages/mautrix_telegram/util/file_transfer.py", line 180, in transfer_thumbnail_to_matrix file = await client.download_file(thumbnail_loc) File "/opt/mautrix-telegram/venv/lib/python3.9/site-packages/telethon/client/downloads.py", line 492, in download_file return await self._download_file( File "/opt/mautrix-telegram/venv/lib/python3.9/site-packages/telethon/client/downloads.py", line 540, in _download_file async for chunk in self._iter_download( File "/opt/mautrix-telegram/venv/lib/python3.9/site-packages/telethon/requestiter.py", line 74, in __anext__ if await self._load_next_chunk(): File "/opt/mautrix-telegram/venv/lib/python3.9/site-packages/telethon/client/downloads.py", line 66, in _load_next_chunk cur = await self._request() File "/opt/mautrix-telegram/venv/lib/python3.9/site-packages/telethon/client/downloads.py", line 76, in _request result = await self.client._call(self._sender, self.request) File "/opt/mautrix-telegram/venv/lib/python3.9/site-packages/telethon/client/users.py", line 88, in _call result = await future telethon.errors.rpcerrorlist.FileReferenceExpiredError: The file reference has expired and is no longer valid or it belongs to self-destructing media and cannot be resent (caused by GetFileRequest) [2023-02-03 10:46:21,423] [[email protected]] Got IntentError while trying to send encryption error message. This likely means the bridge bot is not in the room, which can happen if you force-enable e2ee on the homeserver without enabling it by default on the bridge (bridge -> encryption -> default). [2023-02-03 10:46:27,475] [[email protected]] Didn't get IVZUzq10nGAEHSus+zLlgmmwLPwDVQRCA5lUzXfHD1c, giving up on $i1kCvgJ85xuRGlYgWNMUzawOfxOZta-e6li4JCXkNMk [2023-02-03 10:46:27,593] [[email protected]] Got IntentError while trying to send encryption error message. This likely means the bridge bot is not in the room, which can happen if you force-enable e2ee on the homeserver without enabling it by default on the bridge (bridge -> encryption -> default).

@maltee1
Copy link
Contributor

maltee1 commented Feb 3, 2023

Did you read the error message and follow the instructions in it?

@kerneus
Copy link
Author

kerneus commented Feb 3, 2023

Did you read the error message and follow the instructions in it?

 encryption:
        # Allow encryption, work in group chat rooms with e2ee enabled
        allow: true
        # Default to encryption, force-enable encryption in all portals the bridge creates
        # This will cause the bridge bot to be in private chats for the encryption to work properly.
        default: true
        # Whether to use MSC2409/MSC3202 instead of /sync long polling for receiving encryption-related data.
        appservice: false
        # Require encryption, drop any unencrypted messages.
        require: true
        # Enable key sharing? If enabled, key requests for rooms where users are in will be fulfilled.
        # You must use a client that supports requesting keys from other users to use this feature.
        allow_key_sharing: true
        # What level of device verification should be required from users?
        #
        # Valid levels:
        #   unverified - Send keys to all device in the room.
        #   cross-signed-untrusted - Require valid cross-signing, but trust all cross-signing keys.
        #   cross-signed-tofu - Require valid cross-signing, trust cross-signing keys on first use (and reject changes).
        #   cross-signed-verified - Require valid cross-signing, plus a valid user signature from the bridge bot.
        #                           Note that creating user signatures from the bridge bot is not currently possible.
        #   verified - Require manual per-device verification
        #              (currently only possible by modifying the `trust` column in the `crypto_device` database table).
        verification_levels:
            # Minimum level for which the bridge should send keys to when bridging messages from Telegram to Matrix.
            receive: unverified
            # Minimum level that the bridge should accept for incoming Matrix messages.
            send: unverified
            # Minimum level that the bridge should require for accepting key requests.
            share: unverified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants