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

[Feature Request] "over ssh" is not respecting ssh config #166

Closed
peh opened this issue Dec 29, 2017 · 37 comments
Closed

[Feature Request] "over ssh" is not respecting ssh config #166

peh opened this issue Dec 29, 2017 · 37 comments

Comments

@peh
Copy link

peh commented Dec 29, 2017

As a user i would like my ~/.ssh/config File to be respected when using the "over ssh" option.

Having a more sophisticated SSH configuration with e.g. a bastion host that is used to proxy connections is more or less best practice in todays cloud setups.
It would be great if TablePlus would support such things.
I understand that due to Apples Sandbox we would have to select the config file manually which is perfectly fine in my eyes!

It's basically the last feature missing for me to buy a License!

@huyphams
Copy link
Contributor

Hey @peh, thanks for your feedback. I'm an ssh-config user. I use it every day with more than 20 servers and it saves a lot of time for me. Lets me see if I can do it.

@peh
Copy link
Author

peh commented Jan 19, 2018

any progress? for now i am stuck with an ssh tunnel but it would be great to have the app doing everything for.

PS: i still bought the app it's to awesome to not pay for it!

@huyphams
Copy link
Contributor

Some users have requested this feature too, so I moved it to work in progress. You will see it soon 😄

@mkarnicki
Copy link

Lovely, great that it's work-in-progress now. I would definitely like to use a host name from my ssh-config instead of providing server IP (which is not very human friendly).

Does the "Import private key" actually import/copy the key file somewhere or just saves the key file path? The "import" is a bit confusing. I think the following would be clearer:
"[Choose | Select] private key file [path]"

Actually, if the "Over SSH -> Server" is not an IP (but a host from ssh-config), it would be sweeet if TablePlus took the IdentityFile path from the SSH config file, based on the host name. But that's an extra feature ;). PSequel allows for host name (instead of IP), but you still have to provide identity file path manually.

Hope this helps. Just purchased TablePlus, looking forward to making great use of it :).

@huyphams
Copy link
Contributor

huyphams commented Feb 5, 2018

Hey @peh @mkarnicki it respects ssh/config now:
Download (this is a build with production mode): https://www.dropbox.com/s/3orqil53ktk8yzk/TablePlus.zip?dl=0

respect config

@mkarnicki
Copy link

@huyphams (I removed my previous comment, chose the wrong host).

I confirm this works GREAT! Thank you, I'm excited about TablePlus :)!

@huyphams
Copy link
Contributor

huyphams commented Feb 6, 2018

Yup, I need to make this form more clear because you don't need to specify the username, password or the server port.
P/s: There is an annoying bug in 10.11, the white background in textfield, it gave me cancer 😄:
screen shot 2018-02-06 at 11 54 26 am

@davidolrik
Copy link

I think I have found one minor bug, when disconnecting and reconnecting the ssh connection the database connection is not reconnected.

@huyphams
Copy link
Contributor

huyphams commented Feb 8, 2018

Thanks @davidolrik, but is it hang or something?

@mkarnicki
Copy link

I can't confirm that, seems all is working well. @davidolrik please try to be as detailed as you can in your follow up comment, thanks.

@davidolrik
Copy link

Yes it hangs, the timer in the bottom left just keeps counting away.

It also happens if I leave the window open, and don't use it for extended periods of time.

@huyphams
Copy link
Contributor

huyphams commented Feb 8, 2018

hey, thanks for your helpful information.
We have two options:

  1. Auto-reconnect: stick on => TablePlus will try to reconnect if the connection failed in the background.
  2. Keeps connection alive: TablePlus sends a ping to sever to keep the connection alive.

If the connection failed while you sending a query, TablePlus also tries to reconnect first.

Seems TablePlus got trouble with ssh, everything is hanging because it waiting too long for ssh-timeout.

options

@davidolrik
Copy link

I think I know what the problem is.

The MySQL I'm connecting to is configured to aggressively close connections if they aren't used.
I think the cut-of-is set at around 10 seconds.

So the bug must be in the statement executer, that fails to notice that the connection has gone bad.

@davidolrik
Copy link

I have both of those options turned on.

@huyphams
Copy link
Contributor

huyphams commented Feb 8, 2018

That's too bad, I set the ping is 30 seconds 🤣probably I will put a config here, then users can set their period.

@davidolrik
Copy link

I don't have this problem in Sequel Pro, maybe they are pinging the connection before executing the query.

@huyphams
Copy link
Contributor

huyphams commented Feb 8, 2018

Sequel Pro uses sshd for tunneling see here, it's handled automatically by OS, and probably they sent ping more frequency.
Btw, I got the bug, will fix it in next update.

Thank you so much.

@davidolrik
Copy link

I found a different solution.

Immediately upon connecting, I execute set session wait_timeout=3600; which will let the ping work as intended. (This is specifically for MySQL)

@theflow
Copy link

theflow commented Feb 21, 2018

It's not respecting the ssh/config for me. Is there any way to see some debug output of the connection attempt?

@huyphams
Copy link
Contributor

huyphams commented Feb 21, 2018

Hey can you share me the screenshot of your connection config (Please blur the sensitive information)? this is mine with ssh/config.

screen shot 2018-02-21 at 7 59 26 pm

@theflow
Copy link

theflow commented Feb 21, 2018

yeah, I saw the comments earlier, mine looks the same. Are you actually parsing the ssh/config or relying on a library that uses it? Anything that could be wrong in the .ssh/config format? (it works with ssh)

connection___

@huyphams
Copy link
Contributor

I used the official API from libssh to handle the config. This is my ssh config.

Host tinydev
HostName <the host ip>
User root

The location of the config is ~/.ssh/config.

@nifoc
Copy link

nifoc commented Mar 21, 2018

I think I'm running into the same problem.

.ssh/config

Host mysite.io
  HostName IP_HERE
  User daniel
  Port 20022
  ForwardAgent yes
  PreferredAuthentications publickey
  IdentitiesOnly yes
  IdentityFile ~/.ssh/mysite

TablePlus (no manual IdentityFile)

bildschirmfoto 2018-03-21 um 22 21 55-optimized

Clicking "Connect" does "nothing". It doesn't connect and simply runs into a timeout (I think).
Is there any way to debug the TablePlus SSH connection?
Running ssh mysite.io in a terminal works without any issues,


Update: Setting "Server" to the IP and manually selecting the correct IdentityFile seems to work.

@zyqxd
Copy link

zyqxd commented Apr 5, 2018

Anyone still having trouble with connecting over ssh? This is my config, using build 98

Host bastion_staging
  Hostname host
  Port 22
  User dzhang
  ProxyCommand none
  ForwardAgent yes
  UseKeychain yes
  IdentitiesOnly yes
  IdentityFile ~/.ssh/identity

screen shot 2018-04-05 at 2 29 18 pm

@huyphams
Copy link
Contributor

huyphams commented Apr 6, 2018

Hey looks like TablePlus can't handle identity let me check.

@zyqxd
Copy link

zyqxd commented Apr 10, 2018

@huyphams is there any work arounds? I tried explicitly importing an identity, still no dice.

@huyphams
Copy link
Contributor

huyphams commented Apr 10, 2018

I'm trying with the IdentityFile, I will report you asap.

@2b
Copy link

2b commented Apr 15, 2018

Hello.

I have same problem. Build 100 from Setapp. Connection works only when I write username and manually choose ssh key.

screen capture on 2018-04-15 at 20-39-03

@2b
Copy link

2b commented Apr 15, 2018

I've completely emptied ~/.ssh/config, to make sure that problem isn't in additional ssh-parametres or spaces-markup, so I just added next 3 rows to ~/.ssh/config:

Host localhost
Hostname 127.0.0.1
User root

And result was the same.

@zyqxd
Copy link

zyqxd commented Apr 19, 2018

@huyphams I believe my issue is actually related to #344

@huyphams
Copy link
Contributor

huyphams commented Apr 19, 2018

Hey, @itsdeezy thanks for pointing it out. We have a release tomorrow, because of time constraints so I can't ship this bugfix in that release 101.
We can expect that it will be fixed (or supported) in build 102 (next week).

@huyphams
Copy link
Contributor

Hi @itsdeezy I have implemented keyboard interactive support in this build: https://www.dropbox.com/s/fghht69ib70jdpn/TablePlus.zip?dl=0
Can you give it a try?

@zyqxd
Copy link

zyqxd commented Apr 30, 2018

hey @huyphams,
tried out build 103, seems like 2fa is getting to where it asks for my login on my phone. However, it's stuck at the Connecting to database... stage.
screen shot 2018-04-30 at 12 28 00 pm

Any way I can run this in verbose? maybe a console mode so I can give you some logs?

@huyphams
Copy link
Contributor

huyphams commented Apr 30, 2018

Unfortunately, I turned off the logger on production. There is no two-factor authentication in SSH. It's keyboard-interactive. The two-factor authentication is a method that server sends a question to the client and verify the connection by keyboard-interactive support after connecting.
I have tested with my setup and it works, probably there are some edge cases that I missed.
Thanks for the report, I will try to reproduce it.

@sfdye
Copy link

sfdye commented Sep 16, 2019

Does Tableplus supports these two ssh config options?

   AddKeysToAgent yes
   UseKeychain yes   

I can't get it to work on 2.8.2 (256) 😞

@christoph-kluge
Copy link

Since I stumbled across this ticket first and I've still tried to figure out why it's not working. I thought it might be useful to add some references to the other tickets here.

If you use Include-statements then this could be a potential reason. This seems to be not implemented yet. Here are the referencing tickets #608 and #775

@mpyw
Copy link

mpyw commented Jun 17, 2022

This comment helped me:
#2531 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests