Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read in private key contents on connect #1424

Merged
merged 1 commit into from
Jul 9, 2023

Conversation

worksofliam
Copy link
Contributor

Changes

Fixes #1422.

Newer versions of node_ssh (and therefore ssh2) require us read the file and pass the buffer.

Checklist

  • have tested my change
  • updated relevant documentation
  • Remove any/all console.logs I added
  • eslint is not complaining
  • have added myself to the contributors' list in CONTRIBUTING.md
  • for feature PRs: PR only includes one feature enhancement.

@worksofliam worksofliam added this to the 2.0.0 release milestone Jul 8, 2023
@worksofliam
Copy link
Contributor Author

To test this:

  1. Use 1.9.4 release to connect with a private key and it should work.
  2. With the master branch, try using the same connection with a private key on master and it should fail.
  3. Try using this branch to connect and it should be successful.

Copy link
Collaborator

@chrjorgensen chrjorgensen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@worksofliam I don't get any errors when running master branch and connection using a private key? It works as release 1.9.4?

@worksofliam
Copy link
Contributor Author

@chrjorgensen can you confirm you also npm installed after switching between branches?

Edmund was getting this issue on master.

@worksofliam
Copy link
Contributor Author

worksofliam commented Jul 9, 2023

Ok, looking it further and it seems that ssh2 now only supports these formats: OpenSSH, RFC4716, or PPK format

@edmundreinhardt, can you npm i on master (not this PR) and see if the problem continues? Also ensure your key is one of the above formats.

@chrjorgensen
Copy link
Collaborator

@worksofliam Ah, I didn't do npm i before testing the master branch - so I've run on the old SSH2 extension. After doing npm i it fails as expected. Will test further...

@chrjorgensen chrjorgensen self-requested a review July 9, 2023 21:57
Copy link
Collaborator

@chrjorgensen chrjorgensen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@worksofliam Your PR works as expected and fixes the private key problem. Good work!

@chrjorgensen chrjorgensen merged commit de4b6b1 into master Jul 9, 2023
@chrjorgensen chrjorgensen mentioned this pull request Jul 10, 2023
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

privateKey must be read (for 2.0.0)
2 participants