DataGrip 2021.2.4 SSH Tunnelling no longer works

I'm getting following error when connecting to a DB via SSH tunnel:

[2021-11-09 11:26:54] SSH tunnel creation failed:.
[2021-11-09 11:26:54] com.intellij.execution.ExecutionException: SSH: net.schmizz.sshj.transport.TransportException: Broken transport; encountered EOF.

the same DB connection was working couple of days ago.

I still can connect to that host under the same credentials via terminal and moreover SSH tunneling works in the DBeaver, but for some reason DataGrip still fails to connect.

I tried to change DataGrip runtime (now I'm using built one), delete ssh config (under ~/.ssh), change auth type with no result.

The whole stacktrace:

2021-11-09 11:31:56,962 [1076353]   WARN - om.intellij.ssh.impl.sshj.sshj - Failed to connect. Brief info: SSH connection to eugenemaximovich@10.60.7.198:22
* With altered connection settings:
- authMethods: GssApi, PublicKey(privateKeys=[*****], agent=ALL), Password, KeyboardInteractive
- connectTimeout: PT10S
- hostKeyVerifier: OpenSSH-like host key verifier (knownHostsFile=[*], strictHostKeyChecking=ASK, hashKnownHosts=true)
- user: eugenemaximovich
* With auth agent ssh-agent[/run/user/1000/keyring/ssh]
* Failed to connect to * port 22
net.schmizz.sshj.transport.TransportException: Broken transport; encountered EOF
at net.schmizz.sshj.transport.Reader.run(Reader.java:58)
2021-11-09 11:31:56,962 [1076353] WARN - unified.SshCredentialsEditorEx - net.schmizz.sshj.transport.TransportException: Broken transport; encountered EOF
com.intellij.ssh.SshTransportException: net.schmizz.sshj.transport.TransportException: Broken transport; encountered EOF
at com.intellij.ssh.impl.sshj.SshjConnectionUtilKt.setUpSessionForSshJ(SshjConnectionUtil.kt:211)
at com.intellij.ssh.impl.SshConnection.a(SshConnection.kt:256)
at com.intellij.ssh.impl.SshConnection.access$doSshjSshConnection(SshConnection.kt:31)
at com.intellij.ssh.impl.SshConnection$createSshSessionForSshj$1.invoke(SshConnection.kt:249)
at com.intellij.ssh.impl.SshConnection$createSshSessionForSshj$1.invoke(SshConnection.kt:31)
at com.intellij.ssh.Ssh.wrapBlockingSshCall(ssh.kt:406)
at com.intellij.ssh.Ssh.wrapBlockingSshCall$default(ssh.kt:388)
at com.intellij.ssh.impl.SshConnection.d(SshConnection.kt:246)
at com.intellij.ssh.impl.SshConnection.access$createSshSessionForSshj(SshConnection.kt:31)
at com.intellij.ssh.impl.SshConnection$checkCanAuthenticate$1.invoke(SshConnection.kt:154)
at com.intellij.ssh.impl.SshConnection$checkCanAuthenticate$1.invoke(SshConnection.kt:31)
at com.intellij.ssh.Ssh.wrapBlockingSshCall(ssh.kt:406)
at com.intellij.ssh.Ssh.wrapBlockingSshCall$default(ssh.kt:388)
at com.intellij.ssh.impl.SshConnection.checkCanAuthenticate(SshConnection.kt:133)
at com.intellij.ssh.SshConnectionService.checkCanAuthenticate(SshConnectionService.kt:188)
at com.intellij.ssh.Ssh.a(ssh.kt:266)
at com.intellij.ssh.Ssh.access$checkCanAuthenticate(ssh.kt:1)
at com.intellij.ssh.ConnectionBuilder.checkCanAuthenticate(ssh.kt:120)
at com.intellij.ssh.ui.unified.SshCredentialsEditorEx$1.a(SshCredentialsEditorEx.java:72)
at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:265)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: net.schmizz.sshj.transport.TransportException: Broken transport; encountered EOF
at net.schmizz.sshj.transport.Reader.run(Reader.java:58)
12 comments
Comment actions Permalink

Yevhen Maksymovych,

Could you file and an issue in DataGrip bug tracker and attach IDE logs, out of 

ssh -vv eugenemaximovich@10.60.7.198 date 

and if it possible SSH server logs (OpenSSH logs where SSH server is hosted)?

By the way, are you working with cyberark?

0
Comment actions Permalink

Still an issue with PhpStorm 2021.3.3

0
Comment actions Permalink

vasily chernov

I have defined a regular SSH tunnel with username and host, authentication is via a key pair. Worked just fine two weeks ago, now I get the error when I try to use the remote DB.

I can connect to the ssh If I specify all the exact same parameters on the cli.

Error from the idea.log

2022-03-31 14:35:22,165 [15344120]   WARN - om.intellij.ssh.impl.sshj.sshj - While was authenticating com.intellij.ssh.impl.sshj.PlatformAuthPublickey(path=/home/rd/.ssh/readymage} 
net.schmizz.sshj.userauth.UserAuthException: Broken transport; encountered EOF
    at net.schmizz.sshj.userauth.UserAuthException$1.chain(UserAuthException.java:33)
    at net.schmizz.sshj.userauth.UserAuthException$1.chain(UserAuthException.java:26)
    at net.schmizz.concurrent.Promise.deliverError(Promise.java:95)
    at net.schmizz.sshj.userauth.UserAuthImpl.notifyError(UserAuthImpl.java:157)
    at net.schmizz.sshj.transport.TransportImpl.die(TransportImpl.java:575)
    at net.schmizz.sshj.transport.Reader.run(Reader.java:66)
Caused by: net.schmizz.sshj.transport.TransportException: Broken transport; encountered EOF
    at net.schmizz.sshj.transport.Reader.run(Reader.java:58)
2022-03-31 14:35:22,207 [15344162]   WARN - om.intellij.ssh.impl.sshj.sshj - Failed to connect. Brief info: SSH connection to rd@prod.ssh.eu.i.readymage.com:22
 * With altered connection settings:
  - authMethods: PublicKey(privateKeys=[/home/rd/.ssh/readymage, /home/rd/.ssh/id_rsa], agent=NO), GssApi, Password, KeyboardInteractive
  - hostKeyVerifier: OpenSSH-like host key verifier (knownHostsFile=[/home/rd/.ssh/known_hosts], strictHostKeyChecking=ASK, hashKnownHosts=true)
  - serverAlive: ServerAlive(interval=PT5M, countMax=3)
  - user: rd
 * Connected: Socket[addr=prod.ssh.eu.i.readymage.com/52.210.230.208,port=22,localport=43706]
 * Starting authentication
  => none (failure, new auth methods allowed by the server: publickey)
  => publickey /home/rd/.ssh/readymage (user auth exception: Broken transport; encountered EOF)
  => publickey /home/rd/.ssh/id_rsa (exception: Socket closed 
net.schmizz.sshj.transport.TransportException: Socket closed
    at net.schmizz.sshj.transport.TransportImpl.write(TransportImpl.java:424)
    at net.schmizz.sshj.transport.TransportImpl.sendServiceRequest(TransportImpl.java:327)
    at net.schmizz.sshj.transport.TransportImpl.reqService(TransportImpl.java:310)
    at net.schmizz.sshj.AbstractService.request(AbstractService.java:74)
    at net.schmizz.sshj.userauth.UserAuthImpl.authenticate(UserAuthImpl.java:66)
    at com.intellij.ssh.impl.sshj.AuthMethodGroup.o(SshjConnectionUtil.kt:756)
    at com.intellij.ssh.impl.sshj.AuthMethodGroup.authenticate(SshjConnectionUtil.kt:730)
    at com.intellij.ssh.impl.sshj.SshjConnectionUtilKt.v(SshjConnectionUtil.kt:545)
    at com.intellij.ssh.impl.sshj.SshjConnectionUtilKt.access$authenticate(SshjConnectionUtil.kt:1)
    at com.intellij.ssh.impl.sshj.SshjConnectionUtilKt$setUpSessionForSshJ$9.run(SshjConnectionUtil.kt:223)
    at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1736)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
    at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.net.SocketException: Socket closed
    at java.base/java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:113)
    at java.base/java.net.SocketOutputStream.write(SocketOutputStream.java:150)
    at net.schmizz.sshj.transport.TransportImpl.write(TransportImpl.java:421)
    ... 17 more
2022-03-31 14:35:22,218 [15344173]   WARN - tabaseErrorHandler$IOErrorInfo - Socket closed 
java.net.SocketException: Socket closed
    at java.base/java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:113)
    at java.base/java.net.SocketOutputStream.write(SocketOutputStream.java:150)
    at net.schmizz.sshj.transport.TransportImpl.write(TransportImpl.java:421)
    at net.schmizz.sshj.transport.TransportImpl.sendServiceRequest(TransportImpl.java:327)
    at net.schmizz.sshj.transport.TransportImpl.reqService(TransportImpl.java:310)
    at net.schmizz.sshj.AbstractService.request(AbstractService.java:74)
    at net.schmizz.sshj.userauth.UserAuthImpl.authenticate(UserAuthImpl.java:66)
    at com.intellij.ssh.impl.sshj.AuthMethodGroup.o(SshjConnectionUtil.kt:756)
    at com.intellij.ssh.impl.sshj.AuthMethodGroup.authenticate(SshjConnectionUtil.kt:730)
    at com.intellij.ssh.impl.sshj.SshjConnectionUtilKt.v(SshjConnectionUtil.kt:545)
    at com.intellij.ssh.impl.sshj.SshjConnectionUtilKt.access$authenticate(SshjConnectionUtil.kt:1)
    at com.intellij.ssh.impl.sshj.SshjConnectionUtilKt$setUpSessionForSshJ$9.run(SshjConnectionUtil.kt:223)
    at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1736)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
    at java.base/java.lang.Thread.run(Thread.java:829)

 

 

 

0
Comment actions Permalink

I'd also add, that I manage to establish tunnel to the host via DBeaver (that uses JSch under the hood). But seems like sshj (used by DataGrip) doesn't support some specific SSH server configuration. (Unfortunately I'm not aware of server config, it's just provided me as is)

vasily chernov is there by any chance some hidden DataGrip property that allows changing ssh client?

0
Comment actions Permalink

Yevhen Maksymovych,

Try to update to the latest DataGrip 2022.1 . I hope, it should help with the issue

 

0
Comment actions Permalink

vasily chernov The issue is present also after the update to 2022.1

0
Comment actions Permalink

Still exists for me. I use a workaround

1. added new script under Preferences - External tools that executes following command ssh -N -L 5433:[databaseUrl]:5432 [username]@[jumphostIp]

2. changed url:port in the connection properties of that DB to localhost:5433

3. execute that script from Tools/External Tools menu before connecting to the DB

Now I can work with the DB from the DataGrip, but it still strange that internal OS ssh client can connect to the host while sshJ cannot.

And yes, I have that problem not with every ssh tunnel, only with specific ones. I have another DBs that use different tunnels, and they work properly, but some specific ones still getting that error 

1
Comment actions Permalink

Yevhen Maksymovych, Orvils,

Could  you file issues in DataGrip bug tracker describing your problems?

0
Comment actions Permalink

For me this worked:
1. Set the config credentials in ~/.ssh/config
2. Set PHPStorm to use OpenSSH config and authentication agent

 

1
Comment actions Permalink

This is a regression also in JetBrains Gateway Client 2022.x (it was fixed in 2021.something)

0

Please sign in to leave a comment.