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

migrate to ssh2 0.5+ #386

Merged
merged 2 commits into from
Apr 14, 2016
Merged

migrate to ssh2 0.5+ #386

merged 2 commits into from
Apr 14, 2016

Conversation

trevj
Copy link
Contributor

@trevj trevj commented Apr 13, 2016

Yeah, this was fun. Fixes:
UWNetworksLab/uProxy-p2p#2320

Summary:

  • no need for the ssh2-streams alias
  • implement randombytes' callback (forgot to do this first time around, I guess - ssh2 0.5+ uses it)
  • I had to monkey patch browserify's process shim (otherwise ssh2-streams won't load)

The monkey patching stuff isn't great. Rather than getting it perfect I'd like to start moving the ssh module into its own browserified file which could be included by whichever module wants it - this would also avoid duplicating the source (1MB+) between the digitalocean and cloudsocial modules.

Note that while this gets us closer to EC support, some quick hacking suggests there are still some missing pieces: namely, I think ssh2 wants Node.js 5+ but browserify currently gives us Node.js 4. Still, getting closer :-)


This change is Reviewable

@@ -25,5 +25,9 @@ module.exports = function(size) {
buffer[i] = Math.floor(Math.random() * 256);
}
}
return buffer;
if (cb) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Having a callback could simplify switching to the cryptographically secure core.crypto fill (in cases where there is a callback you won't even need to maintain a separate buffer). I won't assert whether or not that's something that needs to be done in this pull request, but I do think it's something worth getting done soon, as Math.random is pretty bad.

@agallant
Copy link
Collaborator

Comments added, some thoughts/TODOs but nothing blocking (monkey patching is always a bit ugly regardless as you said). Let me know if you'd like me to take a stab at using core.crypto for randombytes, since I've worked with it in a few other places.

@trevj
Copy link
Contributor Author

trevj commented Apr 14, 2016

Please take a look at using core.crypto, that would be great!

I'm investigating Travis failures...this all works fine for me locally, in any version node...then will submit. Thanks!

@trevj trevj force-pushed the trevj-ssh2-0.5.0 branch from e6424cb to 68cff2b Compare April 14, 2016 16:09
@trevj trevj merged commit 599d5ca into master Apr 14, 2016
@trevj trevj deleted the trevj-ssh2-0.5.0 branch April 14, 2016 19:45
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.

2 participants