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

Bridge bot DMs ignored when encryption & pantalaimon are enabled #591

Open
JohnStarich opened this issue Apr 28, 2021 · 2 comments
Open
Labels
e2ee Related to End to End Encryption. T-Defect Bugs, crashes, hangs, vulnerabilities, or other reported problems.

Comments

@JohnStarich
Copy link

JohnStarich commented Apr 28, 2021

Describe the bug
(I'm new to bridging, apologies for any obvious blunders.)

I've set up the slack bridge with pantalaimon and my own home server. I have 2 way messages working in rooms, S->M & M->S.

When opening the DM via Element it was created with E2EE (see element-hq/element-meta#1264), then the bot sent an unencrypted hello message. Seems suspect, but not a big deal.

However, when I attempted to enable puppeting (as a user, not admin) by sending login, the bot doesn't respond.

Instead, I see this in the log:

Apr-28 02:14:34.781 ERROR EncryptedEventBroker !some_dm:example.com has no bridge users in the room
Apr-28 02:14:34.785 INFO bridge 10.0.0.5 - - [28/Apr/2021:02:14:34 +0000] "PUT /transactions/282?access_token=<REDACTED> HTTP/1.1" 200 2 "-" "Synapse/1.31.0"

To Reproduce
Steps to reproduce the behavior:

  1. Stand up pantalaimon (in my setup, it's reachable by http://pantalaimon:8008 in Docker Swarm)
  2. Postgres (my setup it's host slack_db)
  3. Use the following slack bridge config. I attempted to swap homeserver.url to pantalaimon too, but no dice.
db:
    connectionString: postgresql://user:pass@slack_db/slack_bridge
    engine: postgres
encryption:
    enabled: true
    pantalaimon_url: http://pantalaimon:8008
homeserver:
    server_name: example.com
    url: https://matrix.example.com
inbound_uri_prefix: https://sub.example.com/
matrix_admin_room: '!room:example.com'
oauth2:
    client_id: "<redacted>"
    client_secret: <redacted>
    redirect_prefix: https://sub2.example.com/
puppeting:
    enabled: true
rtm:
    enable: true
    log_level: silent
slack_hook_port: 9898
username_prefix: slack_
  1. Proxy the appropriate host:port combinations with the subdomains chosen, etc
  2. Once 2-way comms work, open a DM with the bridge bot in Element. It will open an E2EE DM.
  3. Bridge bot sent the hello message, unencrypted.
  4. Send help command
  5. Bridge bot won't reply

Expected behavior
Bridge bot should reply

Desktop:

  • OS: macOS
  • Browser – N/A
  • Element version: 1.7.26

Additional context

  • Running all services (synapse, pantalaimon, slack bridge) in Docker Swarm "stacks"

Thanks in advance! 😄 If you have any pointers for where the problem could be, I may be able to help put a PR together.

@JohnStarich
Copy link
Author

This could be solved with an auto-invitation from the bridge bot, since it can open new unencrypted DMs on behalf of the user: #471

Thinking outside the box here, might be useful for an admin command to open DMs with certain users with first-time setup info.

@JohnStarich
Copy link
Author

I've confirmed that creating a new room outside Element (without E2EE) does fix the commands.

Here's a script similar to what I used to create the room, for others' sake:

#!/usr/bin/env bash

read -p 'Username (e.g. @x:matrix.org): ' -r username
read -p 'Password: ' -s -r password
homeserver_domain=matrix.example.com
homeserver_url="https://$homeserver_domain"

curl -XPOST -d '{"type":"m.login.password", "user":"'"$username"'", "password":"'"$password"'"}' "$homeserver_url/_matrix/client/r0/login"
echo

echo 'Copy above access token and paste it here, then hit Enter.'
read -p 'Access token: ' -s -r access_token

curl -XPOST -d '{
    "invite": ["@slackbot:'"$homeserver_domain"'"],
    "preset": "private_chat",
    "is_direct": true
}' "$homeserver_url/_matrix/client/r0/createRoom?access_token=$access_token"

@jaller94 jaller94 added T-Defect Bugs, crashes, hangs, vulnerabilities, or other reported problems. e2ee Related to End to End Encryption. labels May 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e2ee Related to End to End Encryption. T-Defect Bugs, crashes, hangs, vulnerabilities, or other reported problems.
Projects
None yet
Development

No branches or pull requests

2 participants