Question: Net-SSH Gem Unable to Sign in Using jruby-pageant public key

Question

Net-SSH Gem Unable to Sign in Using jruby-pageant public key

Answers 0
Added at 2016-11-21 22:11
Tags
Question

I am unable to use public key authentication through JRuby 1.7.24 using net-ssh 2.9.2 and jruby-pageant 1.1.1

A call to Net::SSH.start(@server, @userid, auth_methods: @auth_methods, verbose: :debug) yields the following stack trace:

D, [2016-11-21T14:53:38.006000 #21956] DEBUG -- net.ssh.transport.session[11c2]: establishing connection to <some server>
D, [2016-11-21T14:53:38.054000 #21956] DEBUG -- net.ssh.transport.session[11c2]: connection established
I, [2016-11-21T14:53:38.055000 #21956]  INFO -- net.ssh.transport.server_version[11c4]: negotiating protocol version
D, [2016-11-21T14:53:38.071000 #21956] DEBUG -- net.ssh.transport.server_version[11c4]: remote is `SSH-2.0-OpenSSH_5.3'
D, [2016-11-21T14:53:38.072000 #21956] DEBUG -- net.ssh.transport.server_version[11c4]: local is `SSH-2.0-Ruby/Net::SSH_2.9.2 java'
D, [2016-11-21T14:53:38.086000 #21956] DEBUG -- tcpsocket[11c6]: read 608 bytes
D, [2016-11-21T14:53:38.087000 #21956] DEBUG -- tcpsocket[11c6]: received packet nr 0 type 20 len 604
I, [2016-11-21T14:53:38.088000 #21956]  INFO -- net.ssh.transport.algorithms[11c8]: got KEXINIT from server
I, [2016-11-21T14:53:38.090000 #21956]  INFO -- net.ssh.transport.algorithms[11c8]: sending KEXINIT
D, [2016-11-21T14:53:38.091000 #21956] DEBUG -- tcpsocket[11c6]: queueing packet nr 0 type 20 len 1564
D, [2016-11-21T14:53:38.092000 #21956] DEBUG -- tcpsocket[11c6]: sent 1568 bytes
I, [2016-11-21T14:53:38.093000 #21956]  INFO -- net.ssh.transport.algorithms[11c8]: negotiating algorithms
D, [2016-11-21T14:53:38.095000 #21956] DEBUG -- net.ssh.transport.algorithms[11c8]: negotiated:
* kex: diffie-hellman-group-exchange-sha1
* host_key: ssh-rsa
* encryption_server: 3des-cbc
* encryption_client: 3des-cbc
* hmac_client: hmac-sha1
* hmac_server: hmac-sha1
* compression_client: none
* compression_server: none
* language_client:
    * language_server:
    D, [2016-11-21T14:53:38.096000 #21956] DEBUG -- net.ssh.transport.algorithms[11c8]: exchanging keys
D, [2016-11-21T14:53:38.622000 #21956] DEBUG -- tcpsocket[11c6]: queueing packet nr 1 type 34 len 20
D, [2016-11-21T14:53:38.623000 #21956] DEBUG -- tcpsocket[11c6]: sent 24 bytes
D, [2016-11-21T14:53:38.634000 #21956] DEBUG -- tcpsocket[11c6]: read 152 bytes
D, [2016-11-21T14:53:38.635000 #21956] DEBUG -- tcpsocket[11c6]: received packet nr 1 type 31 len 148
D, [2016-11-21T14:53:38.649000 #21956] DEBUG -- tcpsocket[11c6]: queueing packet nr 2 type 32 len 140
D, [2016-11-21T14:53:38.650000 #21956] DEBUG -- tcpsocket[11c6]: sent 144 bytes
D, [2016-11-21T14:53:38.673000 #21956] DEBUG -- tcpsocket[11c6]: read 720 bytes
D, [2016-11-21T14:53:38.674000 #21956] DEBUG -- tcpsocket[11c6]: received packet nr 2 type 33 len 700
D, [2016-11-21T14:53:38.712000 #21956] DEBUG -- tcpsocket[11c6]: queueing packet nr 3 type 21 len 20
D, [2016-11-21T14:53:38.713000 #21956] DEBUG -- tcpsocket[11c6]: sent 24 bytes
D, [2016-11-21T14:53:38.714000 #21956] DEBUG -- tcpsocket[11c6]: received packet nr 3 type 21 len 12
D, [2016-11-21T14:53:38.721000 #21956] DEBUG -- net.ssh.authentication.session[11ca]: beginning authentication of `<some user>'
D, [2016-11-21T14:53:38.732000 #21956] DEBUG -- tcpsocket[11c6]: queueing packet nr 4 type 5 len 28
D, [2016-11-21T14:53:38.733000 #21956] DEBUG -- tcpsocket[11c6]: sent 52 bytes
D, [2016-11-21T14:53:38.771000 #21956] DEBUG -- tcpsocket[11c6]: read 52 bytes
D, [2016-11-21T14:53:38.773000 #21956] DEBUG -- tcpsocket[11c6]: received packet nr 4 type 6 len 28
D, [2016-11-21T14:53:38.774000 #21956] DEBUG -- net.ssh.authentication.session[11ca]: trying publickey
D, [2016-11-21T14:53:38.776000 #21956] DEBUG -- net.ssh.authentication.agent[11cc]: connecting to Pageant ssh-agent (via java connector)
E, [2016-11-21T14:53:38.799000 #21956] ERROR -- net.ssh.authentication.session[11ca]: all authorization methods failed (tried publickey)

In the connect! method we find the debug statement "connecting to Pageant ... " However, we don't see any print statement after that neither saying the connection succeeded, nor the agent proxy is not running.

def connect!
  debug { "connecting to Pageant ssh-agent (via java connector)" }
  @agent_proxy = JRubyPageant.create
  unless @agent_proxy.is_running
    **raise AgentNotAvailable, "Pageant is not running!"**
  end
  debug { "connection to Pageant ssh-agent (via java connector) succeeded" }
rescue AgentProxyException => e
  error { "could not connect to Pageant ssh-agent (via java connector)" }
  raise AgentNotAvailable, e.message, e.backtrace
end

There seems to be some issue connecting in the jars included in jruby_pageant, but I don't have any visibility into what exactly is failing.

And using ssh through putty allows me to connect via public key.

I see the current issue is currently open against net-ssh: https://github.com/net-ssh/net-ssh/issues/433

But I am not running on Cygwin.

Let me know if you need any more information.

Answers to

Net-SSH Gem Unable to Sign in Using jruby-pageant public key

Source Show
◀ Wstecz