MongoDb Compass Error establishing SSH channel for Socks5 request

Hi there,
I can login into my server using SSH and private key without problem, but I’m having issues connecting to MongoDB on my server using Compass.
The connection is setup using SSH with private key.

I get an error during the Server opening procedures:

{"t":{"$date":"2024-07-01T14:18:59.568Z"},"s":"I","c":"COMPASS-DATA-SERVICE","id":1001000019,"ctx":"Connection 0","msg":"Server opening","attr":{"address":"127.0.0.1:27017"}}
{"t":{"$date":"2024-07-01T14:18:59.573Z"},"s":"I","c":"COMPASS-SSH-TUNNEL","id":1001000253,"ctx":"tunnel-0","msg":"Validated auth parameters","attr":{"success":true}}
{"t":{"$date":"2024-07-01T14:18:59.574Z"},"s":"I","c":"COMPASS-SSH-TUNNEL","id":1001000260,"ctx":"tunnel-0","msg":"Received Socks5 fowarding request","attr":{"srcAddr":"127.0.0.1","srcPort":64709,"dstAddr":"127.0.0.1","dstPort":27017}}
{"t":{"$date":"2024-07-01T14:18:59.679Z"},"s":"E","c":"COMPASS-SSH-TUNNEL","id":1001000265,"ctx":"tunnel-0","msg":"Error establishing SSH channel for Socks5 request","attr":{"srcAddr":"127.0.0.1","srcPort":64709,"dstAddr":"127.0.0.1","dstPort":27017,"error":"Error: (SSH) Channel open failure: open failed\n    at r (file:///Applications/MongoDB%20Compass.app/Contents/Resources/app.asar/build/589.49387817d7e3f7476bb2.renderer.js:2:449276)\n    at CHANNEL_OPEN_FAILURE (file:///Applications/MongoDB%20Compass.app/Contents/Resources/app.asar/build/589.49387817d7e3f7476bb2.renderer.js:2:208358)\n    at 92 (file:///Applications/MongoDB%20Compass.app/Contents/Resources/app.asar/build/589.49387817d7e3f7476bb2.renderer.js:2:373101)\n    at e.exports.M (file:///Applications/MongoDB%20Compass.app/Contents/Resources/app.asar/build/589.49387817d7e3f7476bb2.renderer.js:2:234565)\n    at F.decrypt (file:///Applications/MongoDB%20Compass.app/Contents/Resources/app.asar/build/589.49387817d7e3f7476bb2.renderer.js:2:330786)\n    at e.exports.H [as _parse] (file:///Applications/MongoDB%20Compass.app/Contents/Resources/app.asar/build/589.49387817d7e3f7476bb2.renderer.js:2:234089)\n    at e.exports.parse (file:///Applications/MongoDB%20Compass.app/Contents/Resources/app.asar/build/589.49387817d7e3f7476bb2.renderer.js:2:238581)\n    at Socket.<anonymous> (file:///Applications/MongoDB%20Compass.app/Contents/Resources/app.asar/build/589.49387817d7e3f7476bb2.renderer.js:2:210715)\n    at Socket.emit (node:events:514:28)\n    at addChunk (node:internal/streams/readable:376:12)"}}

Any clue ? Maybe is something related to my server that is missing?

Thanks

I’ve probably found the problem. It’s a configuration of sshd_config, the AllowTcpForwarding should be set to yes because it’s a bastion host connection.

https://jira.mongodb.org/browse/DOCS-9816

1 Like