Core reference
Auth snapshot
The JSON auth file a manager mounts — API keys as hashes, revocations, request classes, worker-certificate policy — and exactly how the leader applies it.
In short
The auth snapshot is a JSON file of SHA-256 key hashes that a manager writes and a leader reads every 10 seconds. It gives a leader its endpoint keys with no plaintext key on the leader, and it turns key enforcement on or off. A key that leaves the file is revoked.
printf '%s' 'sk-orc-<the key>' | sha256sum # the "hash" a key entry carries{"revision": "1", "issuedAt": "2026-10-30T10:00:00Z", "requireKeys": true,
"keys": [{"id": "team-search-1", "name": "team-search", "hash": "<64 hex characters>", "scope": "user"}]}The auth snapshot gives a leader its endpoint keys without any plaintext key reaching it. A manager writes it, typically from a Kubernetes Secret mounted into the leader's pod; the leader reads it. Nothing else is on the request path, so the leader keeps serving from the last snapshot it read when the manager is down.
| Setting | Value |
|---|---|
| Path | OPOD_AUTH_FILE, default /etc/opod-auth/auth.json |
| Off | OPOD_AUTH_FILE=off: no watcher at all |
| Re-read | every 10 seconds, when the file's modification time is newer than the last good read |
| Typed shape | AuthSnapshot and SnapshotKey in core's pkg/adminapi |
- The file may appear after the leader starts; the watcher waits for it.
- A file that is not valid JSON is logged (
auth file unreadable — keeping last good snapshot) and ignored. The last good snapshot stays in force, and the file is read again every 10 seconds until it parses. - A snapshot that changes something records an
auth.updatedevent withrequireKeys,keys,created,updated,revokedandrevokedKeys(and, in 0.3.0,refused), and logsauth snapshot applied. A re-issue that only movesissuedAtrecords nothing.
{
"revision": "42",
"issuedAt": "2026-10-30T10:00:00Z",
"requireKeys": true,
"keys": [
{
"id": "team-search-1",
"name": "team-search",
"hash": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
"scope": "user",
"expiresAt": "2027-01-01T00:00:00Z",
"class": "standard",
"team": "search"
}
],
"revokedKeys": ["old-456"],
"nodeMtls": "allow",
"nodeCertCa": "-----BEGIN CERTIFICATE-----\n…\n-----END CERTIFICATE-----\n",
"revokedCerts": ["4a3f9c01"]
}Fields
| Field | Type | Meaning |
|---|---|---|
revision | string | A name for this version. A change of it counts as a change for the event and the log. |
issuedAt | RFC 3339 | When the manager wrote the snapshot. Its age is measured from here, not from the file time (the file time changes only when the content does, so a quiet fleet would look stale forever). Empty or not RFC 3339 = age unknown, and no age bound is enforced; a bad value logs a warning. |
requireKeys | bool | true = /v1 demands a key. It is OR-ed with auth.require_keys in config.yaml: a snapshot can turn keys on at runtime, but false does not turn off a require_keys: true config (the default). |
keys[] | array | The endpoint's keys (below). |
revokedKeys[] | strings | Key ids the leader refuses even when a row for them is still in keys. |
nodeMtls | string | Worker certificate policy on register and heartbeat: off (or empty, or anything else), allow, require. |
nodeCertCa | PEM | One or more CA certificates a worker certificate must chain to. Public material; rotate it here with no restart. |
revokedCerts[] | strings | Certificate serial numbers to refuse even though the CA signed them. Lowercase hex, no separators. |
Key fields
| Field | Required | Meaning |
|---|---|---|
id | yes | The key id. The leader names the key k_cp_<id> in its store, usage rows and events; an id that already starts with k_cp_ is used as is. A manager strips the prefix to find its own key again. |
hash | yes | Lowercase hex SHA-256 of the plaintext key (sk-orc-… or any string the callers present). |
name | no | Display name. |
scope | no | user (default), admin or node. |
expiresAt | no | RFC 3339 expiry. The caller then gets 401 key_expired. Up to and including 0.2.1, a value that does not parse is ignored and the key does not expire. In 0.3.0 the entry is refused: a new key is not created, a known key keeps its stored row, and the log says auth snapshot: key refused — expiresAt is not RFC 3339. |
class | no | How this key's requests rank when the endpoint is full: critical, standard (default) or sheddable. A request may lower its own class with the X-Opod-Class header, never raise it. |
team | no | Requests of every key with the same team share one fair-share flow inside their class. Empty = the key is its own flow. Also the unit of prefix-cache isolation by default. |
A key with no id or no hash is skipped. A key carries no rate limit, quota or model allowlist: those belong to the gateway in front of the endpoint. Fields from older snapshots (rpmLimit, tpmLimit, quotaDailyTokens, allowedModels) are ignored.
Compute a hash:
printf '%s' 'sk-orc-<printed once>' | sha256sum | cut -d' ' -f1How the leader applies it
Each read runs these steps, under one lock:
- Tombstones first. Every id in
revokedKeysis mapped tok_cp_<id>. A key inkeyswhose id is also a tombstone is skipped. - New keys. A key id the store has not seen is written as a new row
k_cp_<id>with its hash, name, scope and expiry. Itsclassandteamare held in memory only. - Known keys. Up to and including 0.2.1, a key id the store already has keeps the hash, name, scope and expiry it was first written with: to rotate a key or move its expiry, publish it under a new id and drop the old one. In 0.3.0 a known id follows the file: a changed hash, name, scope or expiry is written to its row and counted as
updated, and the old hash stops working at that read. - Keys that left the file are revoked: every non-revoked
k_cp_row whose id is no longer inkeys. - Tombstones revoke their key. A tombstone for an id the store has never seen still creates a revoked row, so that id can never be created later.
- Revocation is final. The leader never un-revokes an id it has seen revoked, whether by a tombstone or by leaving the file. A key that comes back under the same id stays refused; mint a new id.
- Keys minted locally with
opod token create(ids withoutk_cp_) are never touched. requireKeys, the classes and teams, and the certificate policy take effect for the next request, register or heartbeat, with no restart.
A tombstone list is an append: any process with write access to the mounted Secret can deliver a revocation correctly while the manager is down, where rebuilding the whole key list could not.
Worker certificates
nodeMtls decides how the leader treats a worker's client certificate on POST /admin/v1/nodes/register and …/heartbeat:
| Mode | Behaviour |
|---|---|
off | Certificates are ignored. The join token is the credential. |
allow | A worker that presents a certificate signed by nodeCertCa is authenticated by it, as scope node, and the token is not needed. A worker without one falls back to its token. |
require | A register or heartbeat with no such certificate is refused: 401 this endpoint requires a worker client certificate (nodeMtls=require) and the call presented none. |
alloworrequirewith nonodeCertCa, or anodeCertCawith no parsable certificate, falls back tooffwith a warning in the log.- A certificate whose serial is in
revokedCertsis refused with403 certificate revoked (serial …)and anode.cert-refusedevent, even while the worker's pod is still up. - Any other certificate error is
403 client certificate: …. - The worker's identity is the node id in its SPIFFE SAN,
spiffe://<domain>/opod/node/<id>. A worker that registered with a certificate is bound to it: only that certificate (or an admin key) can act as that node id.
Certificates are only seen when the leader serves TLS. See Security.
Staleness
By default a leader serves from whatever snapshot it holds, for as long as it holds it: availability wins over revocation. To make revocation win, set auth.maxSnapshotAgeSec in the policy snapshot and re-issue the auth snapshot, with a fresh issuedAt, more often than that bound.
Past the bound, while keys are required, every /v1 request gets 503 with Retry-After: 30 and this message, until a fresher snapshot arrives:
this endpoint's auth snapshot was issued 6m12s ago (at 2026-10-30T10:00:00Z), past its limit of 300s (policy auth.maxSnapshotAgeSec): API keys are refused until a fresher snapshot arrives; retry laterIt is a 503, not a 401, on purpose: the key may be fine, and the caller should retry, not rotate it. The snapshot in force, its age and whether it is stale are on /loadz as auth_snapshot.
Write it safely
- Write the file atomically (a temporary file, then a rename), or let the Secret mount do it. A half-written file fails to parse and is skipped; the next read picks up the complete one.
- Keep
revisionmeaningful: it is what the log and the event name. - Re-issue on a period shorter than
auth.maxSnapshotAgeSecwhen you set one.
Last updated · Source: content/docs/core-reference/auth-snapshot.mdx · View as Markdown