oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.57k stars 2.72k forks source link

SSH-ed25519 incompatabilities causing ssh not working with bun #7130

Open ProgressifyDev opened 10 months ago

ProgressifyDev commented 10 months ago

What version of Bun is running?

1.0.11+f7f6233ea

What platform is your computer?

Darwin 21.6.0 x86_64 i386

What steps can reproduce the bug?

Basically, I am using ssh2 to connect and process information from SFTP.

const conn = new Client();
      conn
        .on("ready", () => {
          Logger.log("Connection is ready.");
          conn.sftp(async (err, sftp) => {
       ....
        })
        .on("error", (err) => reject(err))
        .connect({
          ...credentials,
          readyTimeout: 60000,
        });

When I try to connect using bun --watch index.ts , it gives me this error

Error: Cannot parse privateKey: Unsupported OpenSSH private key type: ssh-ed25519

Running it on nodejs v16.20.1 works flawlessly

Reading documentation regarding Bun, ssh2 and node, leads me to believe it has something to do with the engine itself.

From SSH2 and this issue

  [node.js](http://nodejs.org/) -- v10.16.0 or newer

    node v12.0.0 or newer for Ed25519 key support

What is the expected behavior?

Successful connection with sftp

What do you see instead?

Error: Cannot parse privateKey: Unsupported OpenSSH private key type: ssh-ed25519

Additional information

May be related to these two

https://github.com/oven-sh/bun/issues/6418 https://github.com/oven-sh/bun/issues/6417

elmpp commented 10 months ago

Any workaround here @ProgressifyDev ?

This is one of the most frustrating bugs I've ever encountered - whole project dependent on bun yet I can't spin up a ssh server

Tried everything

ProgressifyDev commented 10 months ago

I just bit the bullet and used a node container to handle the rest of the flow. Bun was just used to handle websocket feedback and take the initial REST requests, then a node docker container handles the processing. Both are tied together using BullMQ....

Shame really, I chose Bun for the processing speed.

ProgressifyDev commented 6 months ago

May be fixed with https://github.com/oven-sh/bun/pull/7256 but I have yet to verify it, I just came back to check if this issue was somehow resolved

elmpp commented 5 months ago

May be fixed with #7256 but I have yet to verify it, I just came back to check if this issue was somehow resolved

It looks like that hasn't fixed it. This line within the SSH2 library still resolves to false

@ProgressifyDev

chicken-suop commented 3 months ago

What a pity this doesn't work