TablePlus-Windows icon indicating copy to clipboard operation
TablePlus-Windows copied to clipboard

SSH invalid privatekey windows

Open huyphams opened this issue 3 years ago • 9 comments

Moved from: https://github.com/TablePlus/TablePlus/issues/2104

I'm having trouble with connecting to a MySQL database over SSH using TablePlus on Windows. I manually selected the private key and entered the ip address and user to connect with. After trying to connect or testing I get the "invalid private key" message.

I've verified that the key is correct by manually connecting using Powershell The permissions are read-only (don't know if that matters) I've tried running TablePlus as administrator I've also tried to rename the key to something with an extension (id_rsa -> id_rsa.priv) to ensure this isn't some weird Windows issue. I read there should be an option to enable ssh logging, but I can't seem to find this option on the Windows version. Build: 140 Windows build: 2004

Can someone help me with this issue?

huyphams avatar Oct 01 '20 03:10 huyphams

I was able to find a workaround by converting SSH key to the older RSA format (-m rsa flag for openssh, more details here: https://stackoverflow.com/questions/53134212/invalid-privatekey-when-using-jsch) but it doesn't seem to help really. Instead of throwing "Invalid Key", it throws the same error that occurs when you try to use password-protected key: 'waiting for initial communication packet', system error: 10060, basically it still doesn't work at all but now has no idea what's happening and just not able to establish connection. Tried MariaDB, MySQL, Redis — different errors, same meaning. I think its support for ssh is just broken / outdated.

A bit frustrating that developers seem to more involved into features, but this bug seems to be ignored for half a year. I cannot use it for anything except local environment because of this unfortunately.

dantaeusb avatar Mar 26 '21 15:03 dantaeusb

We're using the newest version of libssh (which is also used by github.com) so I don't think it was broken or outdated, I believe it was misconfigured or some other issues, unfortunately, turning on debug log isn't easy on Windows. We have debug log on macOS and Linux but not on Windows due to this reason.

huyphams avatar Mar 26 '21 15:03 huyphams

Anyway I can help? I love TablePlus in general and really want to use it, but paying $60 and being unable to do basic things is frustrating.

I'll try to disable other ssh-related windows features/programs, I've seen folks in relevant issues been talking about reverting git for windows helped in some cases, maybe it's some kind of interference here. I'll update this issue if I'll be able to find anything.

dantaeusb avatar Mar 26 '21 15:03 dantaeusb

I'm using TablePlus on Windows too, and the SSH works just fine (there are also a lot of users on Windows). I'm using a key which was generated by the command ssh-keygen -t rsa -b 4096 -C "[email protected]" Make sure that the key works before putting it in TablePlus.

huyphams avatar Mar 26 '21 15:03 huyphams

Sure thing, I was able to ssh -> mysql-client / redis-cli without any problem, it works just fine. Couple of notes about my config: I'm on Insider Preview, WSL2 enabled and using OpenVPN to our cluster. So it's "over SSH over VPN" connection, but shouldn't be a problem theoretically.

UPD: Tried to attach process in VS, got nothing but "Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll" when database view window is closed. Don't think it's relevant :(

I'm not really familiar with VS debugger but if anything I'll do my best to help.

dantaeusb avatar Mar 26 '21 15:03 dantaeusb

I want to add that on another Windows installation with the same Windows Dev Ring version everything works fine so far (same key, same host, same TablePlus version). Uninstalling Git for Windows on another environment had no effect, however I want to mention that I decided not to install it on a new environment.

For anyone having similar problem — I used workaround with ssh tunneling (ssh -fNL local_port:localhost:3306 remote_user@remote_host)

dantaeusb avatar Apr 20 '21 13:04 dantaeusb

I found this: https://stackoverflow.com/questions/65145221/mysql-could-not-connect-the-ssh-tunnel-access-denied-for-none

Maybe will help you.

The solution here was to convert the OpenSSH private key to an RSA private key.
ssh-keygen -p -m PEM -f C:/Users/username/.ssh/id_rsa

@dantaeusb

rizaldirnm avatar Aug 17 '21 05:08 rizaldirnm

If you have a chance, please install this patch: https://www.dropbox.com/s/eqztxlh2bai0lyd/TablePlusUpdate.exe?dl=0 And enable SSH debug log in Menu > Help > Enable SSH Debug Log to see the issue.

huyphams avatar Jul 14 '22 08:07 huyphams

Oh I'm sorry, I'm not having that Windows machine with me right now. I would assume there was some incompatibility in rare occasions with other ssh libraries. For the last year, everything was fine for me on all platforms. I'll try to reproduce that if I'll have a chance.

dantaeusb avatar Jul 14 '22 11:07 dantaeusb