matrix-appservice-slack
matrix-appservice-slack copied to clipboard
Bridge bot DMs ignored when encryption & pantalaimon are enabled
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 https://github.com/vector-im/element-meta/issues/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:
- Stand up pantalaimon (in my setup, it's reachable by
http://pantalaimon:8008
in Docker Swarm) - Postgres (my setup it's host
slack_db
) - 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_
- Proxy the appropriate host:port combinations with the subdomains chosen, etc
- Once 2-way comms work, open a DM with the bridge bot in Element. It will open an E2EE DM.
- Bridge bot sent the hello message, unencrypted.
- Send
help
command - 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.
This could be solved with an auto-invitation from the bridge bot, since it can open new unencrypted DMs on behalf of the user: https://github.com/matrix-org/matrix-appservice-slack/issues/471
Thinking outside the box here, might be useful for an admin command to open DMs with certain users with first-time setup info.
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"