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

Why key type ecdsa-sha2-nistp256 is unsupported? #568

Closed
fsdevblog opened this issue Jan 18, 2018 · 1 comment
Closed

Why key type ecdsa-sha2-nistp256 is unsupported? #568

fsdevblog opened this issue Jan 18, 2018 · 1 comment

Comments

@fsdevblog
Copy link

I'am trying to use net-ssh and receive the error described bellow

jruby-9.1.15.0 :001 > require "net/ssh"
 => true 
jruby-9.1.15.0 :002 > Net::SSH.start('myhost.dev', 'username' password: 'password', verbose: Logger::DEBUG){|ssh| puts ssh.exec!('hostname')}
D, [2018-01-17T14:24:29.633089 #26123] DEBUG -- net.ssh.transport.session[7d0]: establishing connection to myhost.dev:22
D, [2018-01-17T14:24:29.884816 #26123] DEBUG -- net.ssh.transport.session[7d0]: connection established
I, [2018-01-17T14:24:29.888234 #26123]  INFO -- net.ssh.transport.server_version[7d2]: negotiating protocol version
D, [2018-01-17T14:24:29.888926 #26123] DEBUG -- net.ssh.transport.server_version[7d2]: local is `SSH-2.0-Ruby/Net::SSH_4.2.0 java'
D, [2018-01-17T14:24:29.952538 #26123] DEBUG -- net.ssh.transport.server_version[7d2]: remote is `SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8'
NotImplementedError: unsupported key type `ecdsa-sha2-nistp256'
        from /home/qpi/.rvm/gems/jruby-9.1.15.0@some_gem/gems/net-ssh-4.2.0/lib/net/ssh/buffer.rb:286:in `read_keyblob'

Error was raised from buffer.rb:286:in read_keyblob. Here the part of code which raising the error

unless defined?(OpenSSL::PKey::EC)
    raise NotImplementedError, "unsupported key type `#{type}'"

Ok.. lets check, defined OpenSSL::PKey::EC or not:

jruby-9.1.15.0 :003 > defined?(OpenSSL::PKey::EC) ? 'defined' : 'not defined'
 => "defined"

What am I doing wrong?

When i use ruby (not jruby), everything works fine

@fsdevblog
Copy link
Author

fsdevblog commented Jan 30, 2018

Not a real solution but I found a hack that does the trick for me.
Before Net::SSH.start, put these 2 lines.

Net::SSH::Transport::Algorithms::ALGORITHMS.values.each { |algs| algs.reject! { |a| a =~ /^ecd(sa|h)-sha2/ } }
Net::SSH::KnownHosts::SUPPORTED_TYPE.reject! { |t| t =~ /^ecd(sa|h)-sha2/ }

https://stackoverflow.com/questions/48301264/why-key-type-ecdsa-sha2-nistp256-is-unsupported

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

No branches or pull requests

1 participant