ProxyAuth / Configuration

What Redis actually does in ProxyAuth: a sync bus, never the source of truth

ProxyAuthRedisUpdated on 2026-09-18

redis appears in config.json as one optional URL. It is tempting to read it as “ProxyAuth stores its data in Redis”. It does not. Every node keeps its own revocation store on disk. Redis is the transport that lets one node’s revocation reach the others.

The three layers

LayerRoleRead per request
DashMap (memory)concurrent map keyed by token ID, holding the recorded expiry — the only layer token verification touchesyes
LMDB, revoke database under /opt/proxyauth/db/read in full at startup to rebuild the map, written on every change; what makes a revocation survive a restartno
Redis (optional)the bus between instancesno

Without redis, everything still works; revocation is simply local to the node.

Writing a revocation

POST /adm/revoke and GET /logout both take the same path. The in-memory map is updated first, so the token stops working on this instance before anything else is attempted. Persistence then depends on configuration:

  • redis set — three keys are written:

    • token:<id> holding the expiry,
    • <id>_action set to 1,
    • <id>_count, incremented on each revocation of that ID.

    The local LMDB write happens on the next sync tick, not inline.

  • No redis — straight to LMDB in one write transaction.

An expiry of 0 means permanent: never purged, refused for as long as the store exists. /adm/revoke records one when exp is omitted, and answers Token permanently revoked. instead of Token revoked with expiration., so the two are distinguishable from the response alone.

curl -X POST https://gw.example.com/adm/revoke \
  -H "X-Auth-Token: $TOKEN_ADMIN" \
  -H "Content-Type: application/json" \
  -d '{"token_id": "3f2c..."}'

The sync loop

One background task, every 15 seconds, four steps:

  1. Drain Redis (skipped without it). SCAN for *_action keys. 1 adds the token, 2 removes it, anything else is skipped rather than guessed at. An add writes to LMDB only if the stored value differs, so a key seen on many ticks costs one read and no write.
  2. LMDB → memory. A cursor over the whole revoke database, reinserting every entry into the map. This runs on every tick, Redis or not — it is what lets a revocation written by another process on the same host be picked up without a restart.
  3. Purge. Entries whose expiry has passed are removed from memory and LMDB in the same pass, so the two never drift. Permanent entries are kept.
  4. Shutdown. The loop watches SIGTERM and SIGINT and flushes LMDB to disk before exiting.

Propagation delay

The node handling the revocation enforces it immediately. Every other node picks it up on its next tick: up to 15 seconds across a fleet.

That is the right order of magnitude for a logout or an admin action, and the wrong one for containing an active incident. If a token is being used by an attacker right now, take the affected node out of rotation or restart the fleet instead of waiting for the bus.

The token: key gets a 300-second TTL, applied only if it has none, which bounds how long a revocation record lingers in Redis after every node has consumed it. The nodes themselves remember it in LMDB until its own expiry.

Redis is not a dependency

Initialisation retries three times, five seconds apart, and the server starts either way. A connection that fails on a tick logs the error and the tick is skipped; the next one tries again. Local enforcement never stops, because it reads the in-memory map, rebuilt from LMDB regardless.

What you lose while Redis is down is propagation, not protection.

Give ProxyAuth its own Redis database

The scan pattern is broad (*_action), and every instance pointed at the database consumes what it finds. Two consequences:

  • do not share the database with other applications’ keys;
  • if you run separate trust groups (see sync groups), give each group its own database number, so a revocation in one group is not applied in another.
{ "redis": "redis://10.0.0.5:6379/3" }

When to turn it on

One node: leave redis unset. LMDB already does the whole job.

Several nodes behind a load balancer: turn it on as soon as tokens are shared between them. Without it, a user who logs out on node A still has a working token on node B until it expires — and the logout page gives them no way to know.

Note that num_instances alone does not need Redis: those servers live in the same process and share the same in-memory map.

Memory answers every request, LMDB remembers across restarts, and Redis only carries the news — every 15 seconds, with no ability to stop a node from enforcing what it already knows.