Authenticate
Although the original protocol does not support it, we have added authentication over TCP for InfluxDB line protocol. This works by using an elliptic curve P-256 JSON Web Token (JWT) to sign a server challenge. This page shows how to authenticate clients with QuestDB when using InfluxDB line protocol for the TCP endpoint.
#
PrerequisitesQuestDB should be running and accessible and can be started via Docker, the binaries or Homebrew for macOS users.
The jose package is a C-language
implementation of the Javascript Object Signing and Encryption standard and may
be used for convenience to generate cryptographic keys. It's also recommended to
install jq for parsing the JSON
output from the keys generated by jose
- macOS
- Debian
- Ubuntu
#
Server configurationIn order to use this feature, you need to create an authentication file using the following template:
Only elliptic curve (P-256) are supported (key type ec-p-256-sha256
). An
authentication file can be generated using the jose
utility with the following
command.
Once you created the file, you will need to reference it in the server configuration:
#
Client keysFor the server configuration above, the corresponding JSON Web Key must be stored on the client side. When sending a fully-composed JWK, it will have the following keys:
For this kind of key, the d
property is used to generate the the secret key.
The x
and y
parameters are used to generate the public key (values that we
retrieve in the server authentication file).
#
AuthenticationThe server will now expect the client to send its key id (terminated with \n
)
straight after connect()
. The server will respond with a challenge (printable
characters terminated with \n
). The client needs to sign the challenge and
respond to the server with the base64
encoded signature (terminated with
\n
). If all is good the client can then continue, if not the server will
disconnect and log the failure.
- NodeJS
- Go
- Python