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

Error while authenticating using agent + private key or password prompt #121

Closed
SchoofsKelvin opened this issue Mar 16, 2019 · 7 comments
Closed
Labels
bug Something isn't working

Comments

@SchoofsKelvin
Copy link
Owner

I am having a similar issue in Windows 10 ver. 1809. My settings are the following:

"sshfs.configs": [
        {
            "host": "server",
            "label": "asd",
            "name": "asd",
            "port": 22,
            "root": "/",
            "username": "user",
            "agent": "//./pipe/openssh-ssh-agent",
            "privateKeyPath": "C:\\Users\\Someone\\Documents\\keys\\id_rsa",
            "passphrase": true
        }
]

When I try to connect I am getting this error:
"Error while connecting to SSH FS asd: All configured authentication methods failed"

The agent is already running as a service.
The private key has this form:

-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: AES-128-CBC, ...
...
-----END RSA PRIVATE KEY-----

If I replace the above settings with these and try to connect:

"sshfs.configs": [
        {
            "host": "server",
            "label": "asd",
            "name": "asd",
            "port": 22,
            "root": "/",
            "username": "user",
            "password": true
        }
]

It prompts me to enter my password again and again.
After the second prompt it throws this:
"Cannot read property 'resource' of undefined"

Of course it prompts me again to enter the password a 3rd time. I type the password again and it prompts me a 4th time, then if I press the escape button to cancel the 4th prompt it connects successfully.

Originally posted by @PanosBougas in #85 (comment)

@SchoofsKelvin
Copy link
Owner Author

@PanosBougas Can you post the log from Output > ssh-fs? (mind that it displays some data, e.g. host/username, you might want to replace those)

This might be partially related to #120, also mixing agent and private key authentication, at least for the first config. The re-prompting for the second config (and it working when cancelled) is quite strange, though. I'll see if I can find the cause of this.

@SchoofsKelvin SchoofsKelvin added bug Something isn't working waiting Waiting for confirmation, more information, ... labels Mar 16, 2019
@SchoofsKelvin SchoofsKelvin changed the title I am having a similar issue in Windows 10 ver. 1809. My settings are the following: Error while authenticating using agent + private key or password prompt Mar 16, 2019
@SchoofsKelvin
Copy link
Owner Author

This might take a while to properly fix. Either I have to do some hacky stuff to make the ssh2 library play nice, or I'll have to fork it and make it support what I need it to support. Neither will be easy or quick.

@PanosBougas
Copy link

PanosBougas commented Mar 17, 2019

@SchoofsKelvin Thanks for all of your hard work. I really appreciate it.
Below are the logs for each step of the connection process.

1st set of settings
sshfs_logs_per_step1.txt

2nd set of settings
sshfs_logs_per_step2.txt

I noticed that with both settings I get prompted for password/passphrase at least a 2nd time.
Between the 1st and the 2nd prompt, Output terminal gets restarted and logs of the first connection attempt are getting lost.

Also if I remove the agent from the 1st set of settings and leave the key and the passphrase the same thing happens.

I hope this info helps.

Again thanks for all the effort. 👍

@SchoofsKelvin
Copy link
Owner Author

Are you sure the key is in the agent? (ssh-add.exe -L)

I've figured out why it prompts multiple times for the password/passphrase (924b0a4...35b0b32) and released the fix in version 1.14.5 of the extension.

I'm not entirely sure if it also fixes your issue with the first config, though. It could be that the multi-prompting made the passphrase appear empty, but it's weird that the output shows no error (from the underlying ssh2 library).

@KonstantinosGiannakakis

Got the same problem on Ubuntu 18.10.
When I add "password" : true, it asks to give my password 2 times, and then fails to connect, but when I delete the above line in the .json file, then it logs me in. Only the resourse error is undefined pops up.

@PanosBougas
Copy link

@SchoofsKelvin

Things got better, but I am still having a second prompt when using the 2nd config. If I give the password at that second prompt it connects though.

The issue as I see it, is that the whole extension is being restarted ("Activating extensions" appears at bottom left of the screen) after giving the password at the first prompt. The only error I get is through the VS code notifications.

Cannot read property 'resource' of undefined

Then the second prompt appears and the only strange thing after the successful connection are 2 "!" at the right of the workspace which show the below message when you hover the mouse above them:

\ Cannot resolve workspace folder. Cannot resolve workspace folder
Besides that, everything else works as expected.

The 1st config is suffering from the extension restarting issue too, which causes the second prompt. I added the key to the ssh-agent.exe (thanks for pointing that out) also I removed the "passphrase" and "privateKeyPath", added the "password: true" and then I was able to connect.

I noticed that if I reload the VS Code I was able to connect on the first prompt without errors. But if I do a manual disconnect and try to re-connect again I got the extension restarting issue with the second prompt again.

@SchoofsKelvin
Copy link
Owner Author

SchoofsKelvin commented Mar 18, 2019

I'm able to kind of replicate the prompt-before-reload issue. Not getting the first error, though. It seems like vscode is trying to access newWorkspaceRoot/.vscode/settings.json before the reload happens. I'm not sure whether this behavior is new, but I'm looking for a way to fix it without assuming too many things (which could otherwise possibly break future features)

@SchoofsKelvin SchoofsKelvin removed the waiting Waiting for confirmation, more information, ... label Mar 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants