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

SSL certificates for connection #41

Closed
dzarlax opened this issue Dec 4, 2019 · 18 comments
Closed

SSL certificates for connection #41

dzarlax opened this issue Dec 4, 2019 · 18 comments

Comments

@dzarlax
Copy link

dzarlax commented Dec 4, 2019

Hi,
I'm trying to connect to Yandex.Cloud MDB Clickhouse from Metabase, but gets an error:

ru.yandex.clickhouse.except.ClickHouseUnknownException: ClickHouse exception, code: 1002, host: {host}, port: 8443; sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

In additional parameters I add:

ssl=true&sslrootсert=/usr/local/share/ca-certificates/Yandex/YandexInternalRootCA.crt

@dzarlax
Copy link
Author

dzarlax commented Dec 4, 2019

Here is an error on clickhouse side:

{ "component": "ServerErrorHandler", "hostname": "{host}", "message": "Poco::Exception. Code: 1000, e.code() = 0, e.displayText() = SSL Exception: error:14037416:SSL routines:ACCEPT_SR_KEY_EXCH:sslv3 alert certificate unknown (version 19.14.7.15 (official build)", "severity": "Error", "thread": "50", "query_id": "" }

@dzarlax
Copy link
Author

dzarlax commented Dec 5, 2019

I've found where this error was fixed - ClickHouse/clickhouse-java#365
Maybe JDBC should be updated. @enqueue

@enqueue
Copy link
Contributor

enqueue commented Feb 8, 2020

Hi @dzarlax, good job identifying the cause of the issue! 👏 In trying to make the driver work with Metabase 0.34, we will also be updating JDBC driver. Hopefully this will solve your SSL issue. If you want, you can try version 0.7-BETA. It is BETA because

  1. the code uses proprietary JDBC driver code
  2. the driver does not pass all MetaBase integration tests, yet.

@enqueue
Copy link
Contributor

enqueue commented Mar 9, 2020

@dzarlax did you try to connect using driver version 0.7.0? I personally do not have any experience setting up SSL connection between Metabase and ClickHouse.

@dzarlax
Copy link
Author

dzarlax commented Mar 10, 2020

Finally YES, thanks a lot!!

@dzarlax dzarlax closed this as completed Mar 10, 2020
@vmoshikov
Copy link

vmoshikov commented Sep 13, 2021

@dzarlax I invite you to share your experience with the community. Getting connection errors in Docker and local Metabase

@dzarlax
Copy link
Author

dzarlax commented Sep 13, 2021

@dzarlax I invite you to share your experience with the community. Getting connection errors in Docker and local Metabase

How can I help?

@vmoshikov
Copy link

vmoshikov commented Sep 14, 2021

@dzarlax What are the use of the SSL parameters to connect ClickHouse cluster in Yandex.Cloud?
You use .pem or .crt file?

@JeroniMan
Copy link

Hi, I'm trying to connect to Yandex.Cloud MDB Clickhouse from Metabase, but gets an error:

ru.yandex.clickhouse.except.ClickHouseUnknownException: ClickHouse exception, code: 1002, host: {host}, port: 8443; sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

In additional parameters I add:

ssl=true&sslrootсert=/usr/local/share/ca-certificates/Yandex/YandexInternalRootCA.crt

Hi.
I have the same problem, thhx for prompt, but be careful in your parameter line - the seventeenth character ('c') is Cyrillic.

@JeroniMan
Copy link

@dzarlax What are the use of the SSL parameters to connect ClickHouse cluster in Yandex.Cloud? You use .pem or .crt file?

If still relevant, the certificate can be taken from the documentation (https://storage.yandexcloud.net/cloud-certs/CA.pem), and the parameters were specified above:
ssl=true&sslrootcert=/usr/local/share/ca-certificates/Yandex/CA.pem

@vmoshikov
Copy link

All perfectly. I threw the certificate into docker and registered the parameters
ssl=true&sslrootcert=/usr/local/share/ca-certificates/Yandex/YandexInternalRootCA.crt

@egorperesada
Copy link

egorperesada commented Jun 21, 2022

All perfectly. I threw the certificate into docker and registered the parameters ssl=true&sslrootcert=/usr/local/share/ca-certificates/Yandex/YandexInternalRootCA.crt

Where can I put this parameters? I don't see any "additional parameters" or etc to add them in metabase 0.43.3 and driver 0.8.1
Screenshot 2022-06-21 at 11 06 44
Ω

@kartaris
Copy link

kartaris commented Feb 6, 2023

All perfectly. I threw the certificate into docker and registered the parameters ssl=true&sslrootcert=/usr/local/share/ca-certificates/Yandex/YandexInternalRootCA.crt

Where can I put this parameters? I don't see any "additional parameters" or etc to add them in metabase 0.43.3 and driver 0.8.1 Screenshot 2022-06-21 at 11 06 44 Ω

Still have no idea how to configure ClickHouse database with setting an SSL certificate through UI =(
There is no such option.

@mshustov mshustov reopened this Feb 6, 2023
@slvrtrn
Copy link
Collaborator

slvrtrn commented Feb 6, 2023

@kartaris
can you please try this:

image

My tests show no issues connecting to a secured ClickHouse instance with Basic TLS. I also verified that it works from the UI using the latest release (1.0.1).

I run Metabase as a Docker container, and a sample docker-compose might look like this:

  metabase:
    image: metabase/metabase:v0.45.1
    container_name: metabase-with-clickhouse-driver
    ports:
      - '3000:3000'
    volumes:
      - '/absolute/path/to/clickhouse.metabase-driver.jar:/plugins/clickhouse.jar'
      - '/absolute/path/to/ca.crt:/certs/ca.crt'

So, the server cert is mounted as /certs/ca.crt, so I'll just put

sslrootcert=/certs/ca.crt

In the additional options input. Make sure that you have "Use secure connection (SSL)" ticked as well.

@kartaris
Copy link

kartaris commented Feb 6, 2023

@kartaris can you please try this:

image

My tests show no issues connecting to a secured ClickHouse instance with Basic TLS. I also verified that it works from the UI using the latest release (1.0.1).

I run Metabase as a Docker container, and a sample config might look like this:

  metabase:
    image: metabase/metabase:v0.45.1
    container_name: metabase-with-clickhouse-driver
    ports:
      - '3000:3000'
    volumes:
      - '../../../resources/modules/clickhouse.metabase-driver.jar:/plugins/clickhouse.jar'
      - './.docker/clickhouse/single_node_tls/certificates/ca.crt:/certs/ca.crt'

So, the server cert is mounted as /certs/ca.crt, so I'll just put

sslrootcert=/certs/ca.crt

In the additional options input. Make sure that you have "Use secure connection (SSL)" ticked as well.

Yep. I found the way to do it using API(by adding the ssl=true&sslrootcert=/usr/local/share/ca-certificates/Yandex/YandexInternalRootCA.crt to the additional-options in POST request). But there is no such option to set the path to the certificate through UI even if "Use secure connection (SSL)" ticked.

image

And as an example how it's done in PostgreSQL. User may set the path to the certificate and even upload it through API.

image

@slvrtrn
Copy link
Collaborator

slvrtrn commented Feb 6, 2023

@kartaris what plugin version do you use?
Additional JDBC options (and advanced connection settings) were restored in 0.8.3 IIRC.

@kartaris
Copy link

kartaris commented Feb 6, 2023

@kartaris what plugin version do you use?
Additional JDBC options (and advanced connection settings) were restored in 0.8.3 IIRC.

Sorry, my bad. I were using 0.8.1 version. Updated to 1.0.1 and now I see it can be done through UI. But it's not as clear as in PostgreSQL plugin

@slvrtrn
Copy link
Collaborator

slvrtrn commented Feb 6, 2023

@kartaris, for sure, I see that we should go Postgres way here.

I've added an issue to the backlog: #136

If you have time, please feel free to contribute.

@slvrtrn slvrtrn closed this as completed Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants