dbeaver icon indicating copy to clipboard operation
dbeaver copied to clipboard

Problem connecting to CockroachDB....

Open natiki opened this issue 8 years ago • 4 comments

Hi,

  • DBeaver 5.1.5.201808130751 Community Edition

On my Windows 10 system I followed the instructions to spin up a 3 node cluster in secure mode (using their SSL generation option not OpenSSL) https://www.cockroachlabs.com/docs/stable/secure-a-cluster.html which ultimately means I am looking to use the following connection string:

postgresql://root@localhost:26257?sslcert=certs%5Cclient.root.crt&sslkey=certs%5Cclient.root.key&sslmode=verify-full&sslrootcert=certs%5Cca.crt

However after configuring a PostgreSQL connection as I think they should be I get:

image

Any suggestions on how to get this working?

natiki avatar Aug 23 '18 10:08 natiki

Will check this in #4140

serge-rider avatar Sep 01 '18 18:09 serge-rider

Try to install SSHJ extension, it will setup advanced security libraries.

However I can't initiate SSL connection to Cockroach.

  1. I've configured certificates: image

  2. Set default connection settings: image

  3. When I connect I see error The server requested password-based authentication, but no password was provided. Just our of curiosity I've tried to set any password and now I see error ERROR: user root must use certificate authentication instead of password authentication. So I stuck here. Once I enable SSL it complains that no password specified. Once I specify password itr says that I can't use password in secure mode.

serge-rider avatar Sep 11 '18 22:09 serge-rider

The original error reported (Could not read SSL key file ...) is due to the fact that JDBC wants PKCS#8 keys. You can convert PEM-encoded keys using:

openssl pkcs8 -topk8 -inform PEM -outform DER -in client.root.key -out client.root.pk8 -nocrypt

mberhault avatar Sep 12 '18 12:09 mberhault

Having had this same issue I can confirm that creating the .pk8 key file and connecting as above but with that instead of the .key file does indeed work.

JackHerring avatar Sep 12 '18 14:09 JackHerring