No description
Find a file
Frank Villaro-Dixon 589fe948cf
Some checks failed
ci / docker-build (push) Has been cancelled
test2
Signed-off-by: Frank Villaro-Dixon <frank@villaro-dixon.eu>
2024-05-24 22:54:50 +02:00
.forgejo/workflows test2 2024-05-24 22:54:50 +02:00
src first commit 2024-05-24 21:34:23 +02:00
.dockerignore build dockerfile 2024-05-24 22:19:35 +02:00
.gitignore first commit 2024-05-24 21:34:23 +02:00
Cargo.lock first commit 2024-05-24 21:34:23 +02:00
Cargo.toml first commit 2024-05-24 21:34:23 +02:00
Dockerfile build dockerfile 2024-05-24 22:19:35 +02:00
example-cfg.yml first commit 2024-05-24 21:34:23 +02:00
README.md improve readme 2024-05-24 21:40:43 +02:00

OpenTSDB Auth Proxy

This is a simple proxy for the OpenTSDB time series database. It handles authentication and authorization.

This proxy can be publicly exposed. When sending data to opentsdb, set the endpoint to this proxy instead. Each client will send the data alongside an authentication token.

If the token matches the host and the metric matches the list of allowed metrics, then the request is forwarded to the opentsdb server.

Configuration

Take a look at the provided sample configuration

Authentication tokens

Right now, two authentication tokens are supported:

  • sha256
  • plain (not recommended)

Sha256

To generate a sha256 token for a specific producer, do the following:

# Generate a token
TOKEN=$(openssl rand -hex 20)
SHA=$(echo -n $TOKEN | sha256sum - | awk '{print $1}')

echo "Token for the device is $TOKEN . Sha256 is $SHA"
# Token for the device is 7a5becc5b5bb581522fd0bb8891bb99a70275620 . Sha256 is ac790471b321143716e7773d589af923236ebdd435ba17c671df3558becc5154

The producer will need to send its token on query string:

curl -X POST https://my-proxy/api/put?token=7a5....

You then need to specify the hash in the config file. This file is then "safe" if the token is reasonably random.

Plain

To be implemented; but don't do it.

Environment variables

The following env variables are supported:

  • CONFIG_FILE : the location of the config file
  • OPENTSDB_URL (in this case, don't set it in the config file)

Notes about exposing OpenTSDB

Currently, OpenTSDB does not support authentication. If you run opentsdb in a k8s cluster, protect its ingress too. Either via a different ingress class, or with specific per-ingress-ctrl anotations.