RocketChat / RocketChat/Rocket.Chat
Federation is not working - crypt.error ([InvalidAsn1Error]: Expected 0x30: got 0xe2)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Description:
Federation is not working.
I have a setup of two Rocket.Chat servers with "Federation" enabled. According to the "Test setup" button it should work fine on both sites. Also i am able to search and add an external user from the other server, but the messages don't get transmitted.
The log of Rocket.Chat shows "crypt.error ([InvalidAsn1Error]: Expected 0x30: got 0xe2)"
(for details see "Relevant logs" below).
Steps to reproduce:
- setup Federation on two Rocket.Chat servers (standard snap installation)
- add external user (on one site / or on both sites)
- write a chat message to this external user
Expected behavior:
The chat message should be trasnmitted to the user on the other Rocket.Chat server.
Actual behavior:
Nothing happens - the user won't be notified about an arriving chat message. Only an error message occurres in Rocket.Chat logs.
(for details see "Relevant logs" below)
Server Setup Information:
- Version of Rocket.Chat Server: 3.15.0
- Operating System: Ubuntu 20.04
- Deployment Method: snap
- Number of Running Instances: 2
- NodeJS Version: v12.22.1
- MongoDB Version: 3.6.14 / wiredTiger (oplog activated)
Client Setup Information
- Desktop App or Browser Version: Google Chrome Version 91.0.4472 (or Rocket.Chat App)
- Operating System: Windows 10 / Manjaro Linux
Relevant logs:
I20210706-20:15:09.343(2) server.js:204 Federation ➔ crypt.error Error [InvalidAsn1Error]: Expected 0x30: got 0xe2
at newInvalidAsn1Error (/snap/rocketchat-server/1478/programs/server/npm/node_modules/asn1/lib/ber/errors.js:7:13)
at Reader.readString (/snap/rocketchat-server/1478/programs/server/npm/node_modules/asn1/lib/ber/reader.js:169:11)
at Object.publicImport (/snap/rocketchat-server/1478/programs/server/npm/node_modules/node-rsa/src/formats/pkcs8.js:154:44)
at Object.detectAndImport (/snap/rocketchat-server/1478/programs/server/npm/node_modules/node-rsa/src/formats/formats.js:66:48)
at NodeRSA.module.exports.NodeRSA.importKey (/snap/rocketchat-server/1478/programs/server/npm/node_modules/node-rsa/src/NodeRSA.js:183:22)
at new NodeRSA (/snap/rocketchat-server/1478/programs/server/npm/node_modules/node-rsa/src/NodeRSA.js:73:18)
at FederationKeysModel.loadKey (app/models/server/models/FederationKeys.js:19:10)
at encrypt (app/federation/server/lib/crypt.js:58:25)
at federationRequest (app/federation/server/lib/http.js:16:11)
at federationRequestToPeer (app/federation/server/lib/http.js:42:12)
at dispatchEvents (app/federation/server/handler/index.js:65:3)
at dispatchEvent (app/federation/server/handler/index.js:70:2)
at app/federation/server/hooks/afterSaveMessage.js:26:2
at /snap/rocketchat-server/1478/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40
I20210706-20:15:09.344(2) server.js:204 Federation ➔ http.error [IGNORED] Error Error: Could not encrypt
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with app/models/server/models/FederationKeys.js at loadKey, then trace the stack through app/federation/server/lib/crypt.js and app/federation/server/lib/http.js. Reproduce a message between the two configured Federation servers and determine why key handling reaches the ASN.1 error. Done means messages are transmitted and the Federation crypt.error no longer occurs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js
- Domain
- backend, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100