zodern / meteor-up

Production Quality Meteor Deployment to Anywhere
http://meteor-up.com/
MIT License
1.27k stars 280 forks source link

Issue with Ubuntu 22 which uses latest ssh2 #1358

Open varunwyest opened 4 months ago

varunwyest commented 4 months ago

Mup version (mup --version): 1.5.10 Mup config

Output of command

Started TaskList: Setup Docker
[20.81.187.213] - Setup Docker
node:events:496
      throw er; // Unhandled 'error' event
      ^

Error: All configured authentication methods failed
    at doNextAuth (C:\Users\varun\AppData\Roaming\nvm\v20.11.0\node_modules\mup\node_modules\ssh2-classic\lib\client.js:413:17)
    at tryNextAuth (C:\Users\varun\AppData\Roaming\nvm\v20.11.0\node_modules\mup\node_modules\ssh2-classic\lib\client.js:484:5)
    at SSH2Stream.onUSERAUTH_FAILURE (C:\Users\varun\AppData\Roaming\nvm\v20.11.0\node_modules\mup\node_modules\ssh2-classic\lib\client.js:597:5)
    at SSH2Stream.emit (node:events:518:28)
    at parsePacket (C:\Users\varun\AppData\Roaming\nvm\v20.11.0\node_modules\mup\node_modules\ssh2-streams\lib\ssh.js:3682:10)
    at SSH2Stream._transform (C:\Users\varun\AppData\Roaming\nvm\v20.11.0\node_modules\mup\node_modules\ssh2-streams\lib\ssh.js:701:13)
    at Transform._write (node:internal/streams/transform:171:8)
    at writeOrBuffer (node:internal/streams/writable:564:12)
    at _write (node:internal/streams/writable:493:10)
    at Writable.write (node:internal/streams/writable:502:10)
    at Socket.ondata (node:internal/streams/readable:1007:22)
    at Socket.emit (node:events:518:28)
    at addChunk (node:internal/streams/readable:559:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
    at Readable.push (node:internal/streams/readable:390:5)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
Emitted 'error' event on Client instance at:
    at doNextAuth (C:\Users\varun\AppData\Roaming\nvm\v20.11.0\node_modules\mup\node_modules\ssh2-classic\lib\client.js:415:12)
    at tryNextAuth (C:\Users\varun\AppData\Roaming\nvm\v20.11.0\node_modules\mup\node_modules\ssh2-classic\lib\client.js:484:5)
    [... lines matching original stack trace ...]
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
  level: 'client-authentication'
}

Node.js v20.11.0
timsun28 commented 3 months ago

To fix this issue you can make the following changes on the server when connected to it through ssh: Open file /etc/ssh/sshd_config with a text editor like nano. Add the line PubkeyAcceptedKeyTypes=+ssh-rsa to the end of the file and save Restart the service sshd with sudo systemctl restart sshd.service or just restart the server.

I haven't found a real fix yet for this package.

dorianboulch commented 3 months ago

The problem is not from meteor up, but from SSH itself. ssh-rsa is deprecated because SHA-1 is from now considered as insecured. You should consider using ED25519 algorithm for your new SSH keys.

thomastraum commented 1 month ago

thank you! I was stuck on this

ssh-keygen -t ed25519 -C "your_email@example.com" ssh-copy-id -i ~/.ssh/id_ed25519.pub yourname@server

one: {
     host: 'yourserver',
     username: 'yourname',
     pem: '~/.ssh/id_ed25519'
   }
thomastraum commented 1 month ago

actually hours later this wont work, since mup deploy wont auth with node. so @timsun28's workaround seems the right idea

zodern commented 1 month ago

We were using a very old ssh client. I wonder if this is any better with mup@1.5.11-beta.1. Otherwise, maybe we could detect when this issue might be happening and show a more informative message.