Connector

The connector runs in your network, holds the admin login for one database or API, and makes and removes keys there.

What stays in your network

The connector holds the admin login. It asks Loxmith whether a request is allowed, then makes the key itself and hands it straight to the program that asked. Loxmith sees who asked for which rule, never the password.

Your network
Your app or agent
Asks the connector for a key.
Connector
Holds the admin login. Makes and removes keys.
Database
Your app connects to it directly.
may it? ->
<- yes or no
No passwords cross this line.
Loxmith
Rules
Decides who may have which key.
Audit log
Records every request.

Setup tokens

ward connector enrol gives you a setup token. The connector trades it for a sign-in of its own the first time it starts, and keeps that sign-in in WARD_CREDENTIAL_PATH so a restart needs no new token. A token works once, within the hour. Give each replica its own with --replicas N, so the audit log can tell them apart.

Deploy

docker run
docker run -d --name ward-connector \
  -e WARD_CONTROL_PLANE=https://api.loxmith.dev \
  -e WARD_PROVIDER_KIND=postgres \
  -e WARD_PROVIDER_URL='postgres://ward_parent:...@db.internal:5432/shop?sslmode=verify-full' \
  -e WARD_ENROLMENT_TOKEN_FILE=/run/secrets/enrolment-token \
  -e WARD_CREDENTIAL_PATH=/var/lib/ward/credential \
  -e WARD_LISTEN=0.0.0.0:8181 -p 127.0.0.1:8181:8181 \
  -v ward-connector:/var/lib/ward \
  -v "$PWD/enrolment-token:/run/secrets/enrolment-token:ro" \
  ghcr.io/getward/ward-connector@sha256:...
values.yaml
# ward connector enrol shop-db --replicas 2 prints the kubectl line
# that creates this Secret, with token-0 and token-1 filled in.
replicaCount: 2

image:
  digest: sha256:...

secret:
  existingSecret: ward-connector

config:
  controlPlane: https://api.loxmith.dev
  providerKind: postgres
/etc/ward/connector.env
WARD_CONTROL_PLANE=https://api.loxmith.dev
WARD_PROVIDER_URL=postgres://ward_parent:...@db.internal:5432/shop?sslmode=verify-full
WARD_CREDENTIAL_PATH=/var/lib/ward-connector/credential

The unit we ship reads this file, keeps its sign-in in /var/lib/ward-connector, and takes the setup token as an encrypted systemd credential rather than a variable. It needs systemd 251 or later.

API keys via connector

Some APIs can't issue a key per run. Run the connector with WARD_PROVIDER_KIND=http in front of one such API and it holds the real key. Your program gets a token that starts wpx_. It works only through your connector, only for the requests its rule allows, and only until it ends or you revoke it. The connector swaps the token for the real key on each request and removes the key from anything the API sends back.

When something fails

What fails What the connector does What your apps see
Loxmith is unreachable when a key is asked for Refuses with 503, unless you turned on its policy cache. Nothing is made. New keys wait until Loxmith is back.
Loxmith is unreachable when the connector checks in Removes nothing. Keys already issued keep working until it's back.
The connector restarts Signs in again from WARD_CREDENTIAL_PATH and removes keys that should be gone. Keys revoked while it was down are removed when it's back.
Postgres is busy during a revoke Retries each step, then logs a failure and tries again at the next check-in. The key stays until a retry succeeds.