Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Error connecting to postgres database through ssh tunnel #1156

Closed
dvibert opened this issue Jan 18, 2017 · 15 comments
Closed

Error connecting to postgres database through ssh tunnel #1156

dvibert opened this issue Jan 18, 2017 · 15 comments

Comments

@dvibert
Copy link

dvibert commented Jan 18, 2017

Hello,

i'm unable to connect to a postgres database through ssh tunnel. The connection is established and authentication succeeded but i'm disconnected. Here is the stacktrace :

2017-01-17 16:40:27.585 - DBeaver 3.8.3 is starting
2017-01-17 16:40:27.588 - Install path: 'file:/C:/Program Files/dbeaver/'
2017-01-17 16:40:27.588 - Instance path: 'file:/C:/Users/dimitri/.dbeaver/'
2017-01-17 16:40:27.590 - Memory available 123Mb/1796Mb
2017-01-17 16:40:27.594 - Starting RMI server at 59302
2017-01-17 16:40:27.646 - Initialize display
2017-01-17 16:40:28.774 - Initializing DBeaver 3.8.3
2017-01-17 16:40:28.778 - Host plugin: org.jkiss.dbeaver.core.application 3.8.3
2017-01-17 16:40:28.781 - Initialize Core...
2017-01-17 16:40:28.946 - Core initialized (165ms)
2017-01-17 16:40:28.949 - Configure workbench window
2017-01-17 16:40:29.023 - Create actions
2017-01-17 16:40:29.368 - Initialize workbench window
2017-01-17 16:40:29.387 - Finish initialization
2017-01-17 16:40:30.555 - Connect with 'PostgreSQL - test' (postgres-jdbc-1598c9d3ea8-43254cdf6a1bbb1)
2017-01-17 16:40:30.727 - Connected (postgres-jdbc-1598c9d3ea8-43254cdf6a1bbb1)
2017-01-17 16:40:36.691 - Connect with 'jdbc:postgresql://dev.server.local:5432/test' (postgres-jdbc-15996e6e5d1-88ac6223155bb8dc)
2017-01-17 16:40:36.810 - Instantiate SSH tunnel
2017-01-17 16:40:36.817 - Connect to tunnel host
2017-01-17 16:40:36.818 - SSH INFO: Connecting to dev.server.local port 22
2017-01-17 16:40:36.822 - SSH INFO: Connection established
2017-01-17 16:40:36.839 - SSH INFO: Remote version string: SSH-2.0-OpenSSH_6.6.1
2017-01-17 16:40:36.840 - SSH INFO: Local version string: SSH-2.0-JSCH-0.1.53
2017-01-17 16:40:36.842 - SSH INFO: CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
2017-01-17 16:40:36.859 - SSH INFO: aes256-ctr is not available.
2017-01-17 16:40:36.860 - SSH INFO: aes192-ctr is not available.
2017-01-17 16:40:36.861 - SSH INFO: aes256-cbc is not available.
2017-01-17 16:40:36.862 - SSH INFO: aes192-cbc is not available.
2017-01-17 16:40:36.863 - SSH INFO: CheckKexes: diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
2017-01-17 16:40:36.902 - SSH INFO: CheckSignatures: ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
2017-01-17 16:40:36.906 - SSH INFO: SSH_MSG_KEXINIT sent
2017-01-17 16:40:36.907 - SSH INFO: SSH_MSG_KEXINIT received
2017-01-17 16:40:36.908 - SSH INFO: kex: server: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
2017-01-17 16:40:36.911 - SSH INFO: kex: server: ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519
2017-01-17 16:40:36.913 - SSH INFO: kex: server: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
2017-01-17 16:40:36.917 - SSH INFO: kex: server: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
2017-01-17 16:40:36.922 - SSH INFO: kex: server: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
2017-01-17 16:40:36.928 - SSH INFO: kex: server: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
2017-01-17 16:40:36.934 - SSH INFO: kex: server: none,zlib@openssh.com
2017-01-17 16:40:36.936 - SSH INFO: kex: server: none,zlib@openssh.com
2017-01-17 16:40:36.937 - SSH INFO: kex: server:
2017-01-17 16:40:36.938 - SSH INFO: kex: server:
2017-01-17 16:40:36.939 - SSH INFO: kex: client: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
2017-01-17 16:40:36.942 - SSH INFO: kex: client: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
2017-01-17 16:40:36.944 - SSH INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
2017-01-17 16:40:36.946 - SSH INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc
2017-01-17 16:40:36.947 - SSH INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
2017-01-17 16:40:36.949 - SSH INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
2017-01-17 16:40:36.950 - SSH INFO: kex: client: none
2017-01-17 16:40:36.951 - SSH INFO: kex: client: none
2017-01-17 16:40:36.952 - SSH INFO: kex: client:
2017-01-17 16:40:36.953 - SSH INFO: kex: client:
2017-01-17 16:40:36.953 - SSH INFO: kex: server->client aes128-ctr hmac-md5 none
2017-01-17 16:40:36.955 - SSH INFO: kex: client->server aes128-ctr hmac-md5 none
2017-01-17 16:40:36.960 - SSH INFO: SSH_MSG_KEX_ECDH_INIT sent
2017-01-17 16:40:36.961 - SSH INFO: expecting SSH_MSG_KEX_ECDH_REPLY
2017-01-17 16:40:36.970 - SSH INFO: ssh_rsa_verify: signature true
2017-01-17 16:40:36.973 - SSH WARN: Permanently added 'dev.server.local' (RSA) to the list of known hosts.
2017-01-17 16:40:36.975 - SSH INFO: SSH_MSG_NEWKEYS sent
2017-01-17 16:40:36.976 - SSH INFO: SSH_MSG_NEWKEYS received
2017-01-17 16:40:36.979 - SSH INFO: SSH_MSG_SERVICE_REQUEST sent
2017-01-17 16:40:36.980 - SSH INFO: SSH_MSG_SERVICE_ACCEPT received
2017-01-17 16:40:36.987 - SSH INFO: Authentications that can continue: publickey
2017-01-17 16:40:36.989 - SSH INFO: Next authentication method: publickey
2017-01-17 16:40:37.280 - SSH INFO: Authentication succeeded (publickey).
2017-01-17 16:40:37.543 - Connection failed (postgres-jdbc-15996e6e5d1-88ac6223155bb8dc)
2017-01-17 16:40:37.546 - SSH INFO: Disconnecting from dev.server.local port 22
2017-01-17 16:40:37.548 - SSH INFO: Caught an exception, leaving main loop due to Socket closed
2017-01-17 16:40:37.560 - org.jkiss.dbeaver.model.exec.DBCConnectException: La tentative de connexion a échoué.
org.jkiss.dbeaver.model.exec.DBCConnectException: La tentative de connexion a échoué.
at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.openConnection(JDBCDataSource.java:173)
at org.jkiss.dbeaver.ext.postgresql.model.PostgreDataSource.openConnection(PostgreDataSource.java:352)
at org.jkiss.dbeaver.model.impl.jdbc.JDBCExecutionContext.connect(JDBCExecutionContext.java:73)
at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.(JDBCDataSource.java:99)
at org.jkiss.dbeaver.ext.postgresql.model.PostgreDataSource.(PostgreDataSource.java:77)
at org.jkiss.dbeaver.ext.postgresql.PostgreDataSourceProvider.openDataSource(PostgreDataSourceProvider.java:97)
at org.jkiss.dbeaver.registry.DataSourceDescriptor.connect(DataSourceDescriptor.java:702)
at org.jkiss.dbeaver.runtime.jobs.ConnectJob.run(ConnectJob.java:74)
at org.jkiss.dbeaver.ui.dialogs.connection.ConnectionWizard$ConnectionTester.run(ConnectionWizard.java:222)
at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:103)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: org.postgresql.util.PSQLException: La tentative de connexion a échoué.
at org.postgresql.Driver$ConnectThread.getResult(Driver.java:355)
at org.postgresql.Driver.connect(Driver.java:279)
at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.openConnection(JDBCDataSource.java:159)
... 10 more
Caused by: java.io.EOFException
at org.postgresql.core.PGStream.receiveChar(PGStream.java:282)
at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:421)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:217)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:51)
at org.postgresql.jdbc.PgConnection.(PgConnection.java:215)
at org.postgresql.Driver.makeConnection(Driver.java:404)
at org.postgresql.Driver.access$100(Driver.java:52)
at org.postgresql.Driver$ConnectThread.run(Driver.java:314)
at java.lang.Thread.run(Unknown Source)
2017-01-17 16:41:39.686 - Shutdown Core...
2017-01-17 16:41:39.911 - Shutdown completed in 225ms

The error is not very clear, thanks for your help.

@serge-rider
Copy link
Member

SSH tunnel connection is good, something happens during PostgreSQL connection.
Are you sure you have correct connection settings (usually you need to set host name to localhost)?
Did you try to connect over putty or other SSH tunnelers?

@dvibert
Copy link
Author

dvibert commented Jan 18, 2017

Thanks for your answer. I put localhost in the hostname and it works !

@dvibert dvibert closed this as completed Jan 18, 2017
@ultra-chel
Copy link

ultra-chel commented Dec 15, 2021

but in my case "put localhost" don't work, what other reasons could there be?
image_2021-12-15_17-51-26

@n5a5
Copy link
Member

n5a5 commented Dec 15, 2021

Hello @ultra-chel Alexander. Can you please paste the stack trace here?

@ultra-chel
Copy link

Hello @ultra-chel Alexander. Can you please paste the stack trace here?
err.log

@n5a5
Copy link
Member

n5a5 commented Dec 15, 2021

Please try using the 42.2.14 version of the PostgreSQL driver. You can do that using the "Настройки драйвера" button.

@ultra-chel
Copy link

image

tried to selecting 42.2.14
42.2.14.jre6
42.2.14.jre7
and restarting, but result is the same
err.log

@n5a5
Copy link
Member

n5a5 commented Dec 15, 2021

That's strange. I don't have a good idea at the moment. Do you use SSL? If not, are you sure your database doesn't require one?

@ultra-chel
Copy link

ultra-chel commented Dec 16, 2021

That's strange. I don't have a good idea at the moment. Do you use SSL? If not, are you sure your database doesn't require one?

yes, we use ssl

@Matvey16
Copy link
Member

@ultra-chel Hello. I was not able to reproduce this issue, the only at least somewhat similar error can be found by using incorrect files in SSL settings. Can you test if those files are valid in any other application?

@ultra-chel
Copy link

@ultra-chel Hello. I was not able to reproduce this issue, the only at least somewhat similar error can be found by using incorrect files in SSL settings. Can you test if those files are valid in any other application?

in postgress settings ssl=on, but in my connection i am not using ssl because in the settings it is written that the ssl parameters are optional. I apologize if the previous message misinformed you

@Matvey16
Copy link
Member

@ultra-chel We need to see the settings that you have for every tab in connection settings (you can blur sensitive data) to be able to recognize the source of the issue. The most interesting are ssl driver properties and ssl tab
dbeaver_56RhTIx26m
dbeaver_SEMY5HiFBe

@ultra-chel
Copy link

@ultra-chel We need to see the settings that you have for every tab in connection settings (you can blur sensitive data) to be able to recognize the source of the issue. The most interesting are ssl driver properties and ssl tab dbeaver_56RhTIx26m dbeaver_SEMY5HiFBe

image

image

image

@Matvey16
Copy link
Member

@ultra-chel According to your answer about database it looks like you need to provide ssl parameters because your database uses it. It says that SSL parameters are optional because the database may not require them, but it looks like in your case it does. Can you ask your db administrator to clarify if you can connect to a database without ssl certificates/key?

@ksteckert
Copy link

ksteckert commented Feb 26, 2022

I ran into a similar issue. I got the java.io.EOFException also.

In my case, the issue ended up being a "/" at the end of the remote host string in the SSH Tunnel configuration. It was hard to detect because the connection test succeeds! The Database test would fail, however.

It seems like "Test tunnel configuration" uses only the FQDN (trims the path) from the hostname string, while "Test Connection ..." uses the full string. I would prefer they both work the same way, it would make troubleshooting easier. If the SSH tunnel would have failed, I would have immediately double-checked all the values & found the error right away. Instead, I spent hours troubleshooting this because of a typo that the SSH Tunnel test ignores.

image
image

@dbeaver dbeaver locked and limited conversation to collaborators Mar 22, 2022
@uslss uslss converted this issue into discussion #15933 Mar 22, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Projects
None yet
Development

No branches or pull requests

7 participants