Static token
Each service gets a random token; the hub’s ACL file holds only its SHA-256, never the token. The
token is sent in Register.credentials.token on every stream and nowhere else.
This is the simplest credential for a small deployment without an identity provider.
-
Generate a token per service and its digest:
Terminal window openssl rand -hex 32 # give this to the servicesnodra-server acl hash - # paste the token; prints its SHA-256 -
Write the ACL (
snodra.acl.toml):[[token]]token_sha256 = "<the 64 hex characters>"service = "billing-service"handle = ["billing.*"] # types it may registersend = ["orders.*", "files.GetFileMetadata"] # types it may requestcontrol = false # may call the processor controls -
Enable it:
Terminal window SNODRA_SERVER_AUTH_MODE=permissive \SNODRA_SERVER_ACL_FILE=/etc/snodra/snodra.acl.toml \snodra/snodra-server:latest
permissive evaluates and logs every rule but refuses nothing except an instance-id takeover.
Switch to enforce when the violation counter stays flat (see the rollout).
Kotlin client
Section titled “Kotlin client”snodra: messaging: service-name: billing-service hub: token: ${BILLING_HUB_TOKEN} # or: token-file: /run/secrets/snodra-server-tokentoken-file wins when both are set and is read again on every reconnect and on every heartbeat of a
registered stream (a changed token goes to the hub as a credentials refresh), so a rotation needs no
restart. The token is masked in logs and in /actuator/env and /actuator/configprops.
Rust client
Section titled “Rust client”SNODRA_SERVICE_NAME=billing-serviceSNODRA_SERVER_TOKEN_FILE=/run/secrets/snodra-server-token # or SNODRA_SERVER_TOKENThe file is read at startup and again before every reconnect and on every heartbeat of a registered
stream (a changed token goes to the hub as a credentials refresh); an empty file after a good read keeps
the last token and logs one warning. Prefer the file to the variable: a variable is visible in
docker inspect and /proc.
Go client
Section titled “Go client”The same variables, read by snodra.FromEnv() (or the options Token and TokenFile). The file is read at startup
(an unreadable or empty file fails New), before every connection and on every heartbeat of a registered stream: a
changed token goes to the hub as a credentials refresh (Go configuration).
What a refusal looks like
Section titled “What a refusal looks like”| Situation | Stream | Requests |
|---|---|---|
| No token, empty token, unknown token | closed UNAUTHENTICATED |
— |
Token for another service, or a registered type outside handle |
closed PERMISSION_DENIED (naming the type) |
— |
| Instance id held by a live session of another service | closed PERMISSION_DENIED |
— |
Request type outside send |
— | PERMISSION_DENIED, never retried |
A closed stream is a registration rejection, not an outage: the client keeps retrying at the
backoff cap, exposes the message in lastRejection / awaitRegistered, and succeeds on its own
once the ACL or the token is fixed. No restart is needed on either side.
Rotate
Section titled “Rotate”- Add the new digest to the ACL, in a second
[[token]]entry for the same service (both work). - Replace the token file atomically, or set the new
SNODRA_SERVER_TOKEN. - The next reconnect uses it; remove the old entry from the ACL.
- The ACL reloads on the
SNODRA_SERVER_RELOAD_INTERVALpoll (5 s) or onSIGHUP.
Verify
Section titled “Verify”curl -s -H "Authorization: Bearer $DASHBOARD_TOKEN" localhost:7001/api/v1/topology | jq '.services[].instances[] | {serviceName, authKind, authenticatedService}'authKind reads token; in off mode the field is absent. A missing token costs one ERROR line
per distinct message and then a DEBUG one, not a flood.