chengpohi / edql

Elasticsearch Query GUI Client
https://plugins.jetbrains.com/plugin/16364-elasticsearch-query--edql
Apache License 2.0
35 stars 1 forks source link

SSH tunnel involving ProxyCommand / Include / Host / Match exec does not work #20

Closed james-johnston-thumbtack closed 9 months ago

james-johnston-thumbtack commented 1 year ago

My OpenSSH configuration contains some entries to use a ProxyCommand, like this:

Host *.tt
    ProxyCommand ~/.okta/ttsft %h
Match exec "/usr/local/bin/sft resolve -q  %h"
    ProxyCommand "/usr/local/bin/sft" proxycommand  %h

These entries exist in a ~/.ssh/config_special file which is included from the main ~/.ssh/config file:

Match all
Include ~/.ssh/config_special

This works great with other IntelliJ SSH features. For example, if I go to Settings --> Tools --> SSH Configurations, and pick a Host of ".tt" and Authentication type of "OpenSSH config and authentication agent". I also set "Configuration files parser" to "OpenSSH" in the Advanced Settings of IntelliJ as well. Then, the connection works great. Other plugins are able to reuse this SSH connection with great success.

Unfortunately, EDQL does not seem to reuse this common IntelliJ SSH functionality, and whatever functionality it does have, it does not support ProxyCommand and/or Include and/or the matching (Host/Match exec) functionality. Thus, I am getting this error when I try to test the connection:

Screenshot 2023-02-12 at 7 40 32 PM

Notice the "UnknownHostException" indicating that it failed to recognize the "Host *.tt" direction, or possibly the associated ProxyCommand.

Some ideas and requests:

  1. It is an inconvenience that this plugin does not reuse the SSH configuration from IntelliJ, and makes me reenter things from scratch. Most other plugins allow me to choose my SSH configuration from the list of existing ones I have configured. Could this plugin also do so?
  2. Similarly, the OpenSSH config parsing and connection parsing doesn't seem to work correctly. Again, can this be reused from IntelliJ, which does work?
  3. At the very least, ensure that directives from my configuration like: "Host", "Match exec", "ProxyCommand", "Include" can be supported?

I am suspicious that if the right code is reused from IntelliJ, then the problem will solve itself since other plugins do not have this issue. But option # 3 could be an alternative to investigate.

chengpohi commented 1 year ago

Hello @james-johnston-thumbtack , Thanks your details feedback.

EDQL doesn't use the Intellij existed ssh configuration, it use mwiede jsch directly to implement ssh proxy. this decision is decided when I didn't notice there is already have a ssh configuration feature in Intellij, now that I think I should use it not do my self.

I will take a look at intellij ssh configuration and start rewriting the ssh configuration in this week, maybe it can release on saturday or sunday. Thanks again 👍👍👍

chengpohi commented 1 year ago

Hi @james-johnston-thumbtack , after I look at Intellij existed SSH Configuration feature. I found it's only work on Intellij Ultimate version and since it's an ultimate feature. it's hard used by third plugin feature. so I think it's still better to configure by plugin self.

I have just choosen option 3 and release a new version: 1.9.17, could you try manual install it whether fix your issue? I have tested openagent type and it works.

https://plugins.jetbrains.com/plugin/16364-elasticsearch-query--edql/versions/stable/291805

james-johnston-thumbtack commented 1 year ago

I installed the update, restarted IntelliJ, and then confirmed that v1.9.17 is loaded by checking the version in the Plugins page.

Unfortunately I still get the exact same error as in the screenshot:

Connect failed: Run failed: com.jcraft.jsch.JSchException: java.net.UnknownHostException: ssh-jumphost.development.tt
chengpohi commented 1 year ago

@james-johnston-thumbtack ok, got it. I try to reproduce it again.

chengpohi commented 1 year ago

Hi @james-johnston-thumbtack , I found rewrite ssh configuration: parser, execute proxycommand need more effort on it, still need more time on this feature.

chengpohi commented 9 months ago

Hi @james-johnston-thumbtack please try the latest version: v1.9.32, and also you can download from Jetbrains market v1.9.32.

but for now edql only support openssh config: ProxyJump and ProxyCommand , In future If intellij share ssh configuration in community version, we can use it to replace ssh proxy.

Thanks your feedback.