GordianDotNet / VSMonoDebugger

Enables Visual Studio 2017 to deploy and debug a mono application on remote linux machines via SSH.
MIT License
49 stars 25 forks source link

Private key issues #20

Closed sjaffesr closed 4 years ago

sjaffesr commented 4 years ago

I have just installed VSMonoDebugger and am having issues with the SSH key. The documentation says the entries "SSH Password" and "SSH Private key file" are optional, but when I leave them both empty I am getting an error message: "Decoding of private key file failed: Value cannot be null." However, it still connects and I am able to deploy/run/debug as expected. Just to avoid the error message I tried to create a private key. First I used ssh-keygen. I got an error it was unable to use the OPENSSH created file. So I tried using puttygen, but it was also unable to use this file. There seems to be at least two problems: displaying an error message even though I am following the documentation (optional entries left blank) and trying to use SSH private key files. Thanks for helping with this.

BDisp commented 4 years ago

It is really a problem. If you use the password, it passes as plain text: "adapterArgs": "-pw yourPwd user@domain: 22 -batch -T vsdbg --interpreter = vscode"

If a private key is used (more secure), the password is not required and it passes like this: "adapterArgs": "-i yourPKfile.ppk user@domain: 22 -lot -T vsdbg --interpreter = vscode"

So it looks like this repository is old and is not updated.

sjaffesr commented 4 years ago

I still think there is an issue with it complaining if the password and private key entries are blank in the Settings dialog, but I found a workaround for now:

On the Linux box, run "ssh-keygen" to generate a public/private key pair. Append the public key on to the end of the file authorized_keys. The private key is in OPENSSH format which is incompatible with VSMonoDebugger. Copy id_rsa to id_rsa.openssh, then run command

ssh-keygen -p -N "" -m pem -f id_rsa

Now you have a private key in RSA PEM format. Copy this file over to the Windows PC and enter that file name in the VSMonoDebugger Settings entry "SSH private key file". No more error messages.

BDisp commented 4 years ago

Of course, you have to have a private key if you enter the file, but the problem is that you have to enter the password without any need. So the project should not ask for the password if we provide the private key file, so on the command line it always passes the password as text.

GordianDotNet commented 4 years ago

@sjaffesr Yes this is a bug! I have not thought of the case of using neither password nor private key for ssh. As soon as I get back to this project, I will intercept the error message. But the better alternative is to login via private key file ;-)

GordianDotNet commented 4 years ago

Fixed in version 1.5.0