Problem with Key Agent & Key Forwarding since latest updates

Resolved

Problem with Key Agent & Key Forwarding since latest updates

avatar
david29
Disabled

I recently updated to 2019.1.3.0, then to 2019.1.5.0, and finally to 2019.1.6.0 (64-bit) on Windows 10. There seems to be a problem with the Key Agent since about version 2019.1.3.0.

When I start the Key Agent Manager I am prompted to enter the private key's password, I can then see the key's details (version: SSH2, key size 4096, etc). When I try to start an SSH terminal session I get the following message:

"An unknown SSH error was encountered"

"Disconnecting"

All my SSH connections are set up in pretty much the same way with an override terminal type set to "linux", and on the advanced tab both the "Use SSH authentication agent" and "Allow SSH authentication agent forwarding" ticket

I have enabled logging and this is the log output:

[16/05/2019 15:07:05] Setting up connection

[16/05/2019 15:07:05] Connecting as *********

[16/05/2019 15:07:05] SSH banner: SSH-2.0-OpenSSH_7.2

[16/05/2019 15:07:05] Sending kex init

[16/05/2019 15:07:05] Received kex init

[16/05/2019 15:07:05] Selected algorithms: curve25519-sha256@libssh.org, ssh-ed25519, chacha20-poly1305@openssh.com, chacha20-poly1305@openssh.com, implicit by cipher, implicit by cipher, none, none

[16/05/2019 15:07:05] Sending Ed25519 kex init

[16/05/2019 15:07:05] Received Ed25519 kex reply

[16/05/2019 15:07:05] Successfully authentified server

[16/05/2019 15:07:05] Sending new keys message

[16/05/2019 15:07:05] Sending userauth service request

[16/05/2019 15:07:05] Received new keys message

[16/05/2019 15:07:05] Received service accepted message

[16/05/2019 15:07:05] Agent has no keys

[16/05/2019 15:07:05] Disconnecting

The thing is, the key is certainly valid. I tested it by loading Git Bash, then starting the agent and adding my key:

eval `ssh-agent -s`

ssh-add -k

I then type my password and ssh to the same server. Once connected, I can verify the agent forwarded the key by typing:

ssh -vT git@bitbucket.org

After a few seconds I can see my connection to BitBucket was successful:

"logged in as *********"

If someone could take a look at this issue it would be greatly appreciated

Thanks,

All Comments (16)

avatar

Hello,

Thank you for the report, we'll take a look at the issue. If we have any further questions to help us find out what's wrong, we'll ask you.

As a workaround, you could use the legacy terminal. You can set this by going in File > Options > Types > Terminal, and checking "Use legacy terminal".

Regards,

Hubert Mireault

avatar
david29
Disabled

I can confirm the legacy terminal is working correctly. After changing the setting to use the legacy terminal, I restarted RDM, enabled the Key Agent Manager, and connected to a server. My SSH key is forwarded correctly to that server and I can connect to BitBucket

Thanks

avatar

Hi,

I have tried to reproduce your bug but without success. There is something I would like you to try: could you stop the Key Agent Manager, and try connecting with one of your sessions, without changing it, using the legacy terminal. I wish to know if the connection is really established using the agent: the legacy terminal is trying all the credentials it can get until they all failed. And to be sure, you're using an RSA key, is that correct?

Thanks

Denis Vincent

avatar

I can confirm, this is still the case with

2019.1.25.0 64-bit

Today I tried nearly all possible combinations to use a password protected private key with the agent - no way!

For the purpose of reproducing could you please describe what exactly I should do to make you believe something is wrong here?

The following is my test szenario.

1. local RDM data source type SQLite

2. Add Credential Entry -> Private Key

Private Key Type: Data

-> paste the key ( I tried password protected putty format and password protected ssh-keygen format )

-> Enter the passphrase for the private key

-> Uncheck [ ] Always prompt for passphrase

Advanced -> [x] Automatically load to key agent

3. OK to Save

Now I start the SSH Key Agent and it will show the key as

SSH2 4096 SSH_RSA <no comment> <fingerprint>

Btw. I tried different SSH-key algorithm including ones generated with the RDM SSH keygenerator.

Then I created a new Session with

GENERAL

Host: <ip of host>

Username: username to use

Password: <empty>

PRIVATE KEY

<no private key>

ADVANCED

[x] Use SSH authentication agent

Result:

An unknown SSH error was encountered.

Disconnecting

I have the following additional questions to this procedure. How does RDM determine which key to use by this method which is described in the docs?

Let's assume I have 100 SSH-Keys stored in the SSH-Agent. Which one will be used??

When I remove the checkbox [ ] Use SSH authentication agent from the credential entry and configure the SSH-Key for the remote session manually as

PRIVATE KEY

Private Key type: Repository

Vault: SSH logins\id_rsa_rdp

Passphrase: <greyed out>

the connection works !!!

Thanks for that great tool but you should definitely invest some time in fixing this. Using SSH-Keys via Agent, where the agent unlocks the keys is an essential feature!

Regards

Peter

avatar

@krasnojarsk Hi Peter

I believe there is something wrong, I just can not reproduce it. I also do not have enough info to debug this problem, and did not get any answers to my last questions.

So the first thing you could do to help me correct this would be to post the logs for the failed connection. In the "Advanced" tab, check "Verbose", check "Enable logging", specify a file path in the "Log path" text field, set the "Log mode" to "Event". One other thing that could help me solve this issue is if you could try using the Putty key agent (Pageant) and see if you get the same result. You can either use RDM's Key Agent Manager or the standard Putty key agent, but only one at a time (they both refuse to start if the other is active).

To answer your question, if the agent has more than one key, they are tried one after the other. In order to save time and processing power, the server is first asked if it knows a key. Once it is established that a key is know by the server, a full authentication request with signature is sent to complete the client authentication.

Sorry if it looked like we were ignoring this issue. But in order to solve this, I will need feedback.

Regards

Denis Vincent

avatar

I will try to log the problem next week in a traceable way, e.g. screenshots, logs etc. if my normal work allows it.

avatar

Hello Denis,

I had time to do some tests. I added 2 PDFs (containing Screenshots and the logs) to this post. As far as I can tell, the agent always thinks it has no key for that connection.

I first tried a connection via SSH with an SSH-Key Credential and that worked. After that I used the agent with the same key, the agent with the same key from a file in openssh format and the agent with the same key from file in putty format. - Nothing worked!

To your answer, that you can not reproduce it I have to say it is not hard to create an SSH key pair and test it on a server.

Regards

Peter

avatar

Hi Peter,

I am still trying to figure out what is going wrong. Could you do a test for me: use the legacy terminal with verbose and send me the resulting logs when connecting using the key agent.

Regards

Denis Vincent

avatar

What do you mean exactly by "Legacy Terminal"?

avatar

Hi Peter,

The legacy terminal is the previous implementation for the SSH terminal. You can set it in File -> Option -> Types -> Terminal and check "Use legacy terminal".

But this should change nothing to the problem with the Key Agent Manager, because we recently put the finger on the bug. On the other hand, while we make the required changes, there is a work around. Once all your setup is done, close RDM and restart it, then start the Key Agent Manager just once. It should work as expected. If you interact with the Key Agent Manager after that, all new modifications will not be seen by other agent clients like the terminal.

I will be working on this issue as soon as possible. It will require some amount of work though so I can not give you any time frame for now. It could range from a week to a month I guess.

Regards

Denis Vincent