Query Authentication
Hydrolix Query has two query interfaces that can be used to retrieve data out of the system via SQL. Each of these interfaces can utilize an additional level of authentication should it be required.
- Native Clickhouse interface via TCP
- HTTP API
Once query authentication is enabled, it will be required for both interfaces.
Enabling Query Authentication in Kubernetes
To enable query authentication add the enable_query_auth: true
flag in the hydrolixcluster.yaml
within spec
.
spec:
enable_query_auth: true
This will restart the query infrastructure and enable authentication.
Clickhouse TCP Native Authentication
The Clickhouse TCP native Authentication is configured using a username
and password
methodology. Users must have a username and password set-up within Hydrolix to be able to gain access.
An example for using Authentication for the clickhouse-client is provided below:
clickhouse client --host hostname.company.net --port 9440 -s --user [email protected] --password mypassword
TLS encryption
Hydrolix strongly recommends setting up TLS on a cluster when enabling query authentication. This is to ensure username and password information is not sent in the clear between user and the Hydrolix system. More information on enabling TLS can be found here Enabling Access & TLS
Grafana with the Clickhouse Plugin Configuration.
You can setup authentication in Grafana using the Clickhouse plugin like that:

Superset with the Clickhouse plugin Configuration.
In Superset you can setup authentication to Hydrolix by modifying the connection string and use:
clickhouse+native://[email protected]:[email protected]/sample_project?secure=true

HTTP API Authentication
Hydrolix provides an additional HTTP query interface for queries, the target for this endpoint is https://<yourhostname>/query/
. Once enabled this end-point will also require authentication.
The HTTP API authentication mechanism support 2 types of authentication.
Using the bearer token
In this mechanism the bearer
token is provided to the end-point, rather than the username and password.
To retrieve the bearer token the Login API endpoint is used, which generates a token valid for 1 day. This token is then used to authorize queries.
For example to use the Login API
curl --request POST \
--url https://hostname.company.net/config/v1/login \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '
{
"username": "[email protected]",
"password": "secret"
}
'
The following will be provided as an output
{
"uuid": "1111-2222-3333-4444-5555",
"email": "[email protected]",
"orgs": [
{
"uuid": "aaaa-bbbb-cccc-dddd",
"name": "Hydrolix",
"type": "singletenant"
}
],
"groups": [
"org.asdf.Hydrolix.admin"
],
"auth_token": {
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIi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xBMQJKP7EMbVxfpOZmQNmfaBPuBMO7NbGM12a7VPo8V_SQqxneJHPX4sxOiZ1DPePU1QPTrhh41-FkvyD6lQ9FEnAQGZFLFp0VKYiNbMIYnnM1dyfQAARwwcNq7wWQ_kZmzAz9QZMbdvtKzmGnlhsZkirBkz7aWQcnyuJQPcg6CZPa4p9nsP7qcLqMGY_b88v_VnBO13qM4u20NFvo2h8pef_tgtFupvZiUDMDjIFI_UTij6PLNJZFBYwmrxIMNrmJshtGIbMfRMFHKMVe6l7ruzwxCj-asdfasdfasdf",
"expires_in": 86400,
"token_type": "Bearer"
}
}
The access_token
within the auth_token
object is then used within your HTTP requests. For example:
curl --request POST \
--url https://hostname.company.net/query/ \
--header 'authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJXbzNLa21MbnhDNzVyaHVJQXR0RHhxak9LTlh4bURvWU5pTkVyeExueHhRIn0.eyJleHAiOjE2NjA0MDE4NjQsImlhdCI6MTY2MDMxNTQ2NCwianRpIjoiYmUzOTllMmItZjhkNC00MjY2LWI3OTYtZDdjN2NhZDhkNGU1IiwiaXNzIjoiaHR0cDovL2tleWNsb2FrOjgwODAvYXV0aC9yZWFsbXMvaHlkcm9saXgtdXNlcnMiLCJhdWQiOlsiY29uZmlnLWFwaSIsImFjY291bnQiXSwic3ViIjoiODM0NTc4M2YtYjE3Yi00ZTdhLTk3MDAtOTA5MzAxNmIyNWFmIiwidHlwIjoiQmVhcmVyIiwiYXpwIjoiY29uZmlnLWFwaSIsInNlc3Npb25fc3RhdGUiOiJiZjY0ZTkwMy1iNmZjLTQ0NWEtYWU4Yi0wZDM1NzI1OGZkZGEiLCJhY3IiOiIxIiwiYWxsb3dlZC1vcmlnaW5zIjpbImh0dHA6Ly9sb2NhbGhvc3Q6MzAwMSJdLCJyZWFsbV9hY2Nlc3MiOnsicm9sZXMiOlsiZGVmYXVsdC1yb2xlcy1oeWRyb2xpeC11c2VycyIsIm9mZmxpbmVfYWNjZXNzIiwidW1hX2F1dGhvcml6YXRpb24iXX0sInJlc291cmNlX2FjY2VzcyI6eyJhY2NvdW50Ijp7InJvbGVzIjpbIm1hbmFnZS1hY2NvdW50IiwibWFuYWdlLWFjY291bnQtbGlua3MiLCJ2aWV3LXByb2ZpbGUiXX19LCJzY29wZSI6ImVtYWlsIGNvbmZpZy1hcGktc2VydmljZSBwcm9maWxlIiwic2lkIjoiYmY2NGU5MDMtYjZmYy00NDVhLWFlOGItMGQzNTcyNThmZGRhIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsInByZWZlcnJlZF91c2VybmFtZSI6InNlcnZpY2VzQGh5ZHJvbGl4LmlvIiwiZW1haWwiOiJzZXJ2aWNlc0BoeWRyb2xpeC5pbyJ9.hR9Cv52CYVlG_FoSoGxvKjWXJXSWxxBMQJKP7EMbVxfpOZmQNmfaBPuBMO7NbGM12a7VPo8V_SQqxneJHPX4sxOiZ1DPePU1QPTrhh41-FkvyD6lQ9FEnAQGZFLFp0VKYiNbMIYnnM1dyfQAARwwcNq7wWQ_kZmzAz9QZMbdvtKzmGnlhsZkirBkz7aWQcnyuJQPcg6CZPa4p9nsP7qcLqMGY_b88v_VnBO13qM4u20NFvo2h8pef_tgtFupvZiUDMDjIFI_UTij6PLNJZFBYwmrxIMNrmJshtGIbMfRMFHKMVe6l7ruzwxCj-asdfasdfasdf' \
--data 'SELECT column FROM table'
Remember in your authorization header to specify Bearer
.
Using username and password
We also support authentication using username and password, you can send those via the Authorization header.
We support basic auth where it's leveraging base64encode(username:password)
Example via curl:
curl --user user:password \
--request POST \
--url https://hostname.company.net/query/ \
--data 'SELECT column FROM table'
Updated 2 days ago