No description
  • Erlang 82.2%
  • Python 12.8%
  • Dockerfile 5%
Find a file
2026-11-24 01:11:14 +01:00
.github Draw distributor's model, and say where the box comes from 2026-10-22 23:14:46 +02:00
apps/mcl_distributor 0.6.0: macula 18 and mcl_om 1.6 (mcl-om#42) 2026-10-30 15:28:09 +01:00
architecture health: ok while the realm still owes the org key 2026-10-27 09:15:47 +01:00
assets Draw distributor's model, and say where the box comes from 2026-10-22 23:14:46 +02:00
config 0.2.0: removed set, no key in logs or dumps, no distribution listener, named pool (#1) 2026-10-13 08:46:39 +02:00
test_live measurement: read the D28 budget per station (_dht.budget, tolerant) 2026-10-11 12:23:59 +02:00
.gitignore gitignore rebar.lock and build artifacts, as the sibling services do 2026-10-11 07:11:35 +02:00
.tool-versions The group-key distributor as a service 2026-10-11 07:11:27 +02:00
CHANGELOG.md 0.6.0: macula 18 and mcl_om 1.6 (mcl-om#42) 2026-10-30 15:28:09 +01:00
Containerfile 0.2.0: removed set, no key in logs or dumps, no distribution listener, named pool (#1) 2026-10-13 08:46:39 +02:00
LICENSE Initial commit 2026-10-11 07:00:12 +02:00
README.md README: drop the GitHub Sponsors badge 2026-11-23 22:20:05 +00:00
rebar.config 0.6.0: macula 18 and mcl_om 1.6 (mcl-om#42) 2026-10-30 15:28:09 +01:00
SECURITY.md SECURITY.md: response times, attachment and identity rules, drills (macula-io/macula#174) 2026-10-31 02:59:11 +01:00

mcl-distributor

CI License ghcr.io BEAM Buy Me a Coffee

Macula

The group-key distributor for Macula's sealed pubsub


Distributes a sealed pubsub group's rotating epoch keys to its admitted members over sealed calls, and never touches the traffic itself.

The group-key distributor for Macula's sealed pubsub. <org>/group_keys_v1 is the service's own procedure, and the only one; mcl_om adds <org>/info and <org>/get_limits to every service, both open, and capabilities/0 is the list. It answers the sealed pulls every group member makes at join and at each epoch rotation. The design it implements is DESIGN_E2E_SEALED_PUBSUB.md; the distributor itself is the SDK's macula_group_keys, started here with this service's deploy config.

What it is not: it is not in the data path. Events flow publisher → stations → subscribers whether or not the distributor is up. Popped, members holding the current epoch go on publishing and opening; new joins and rotations fail closed until it returns.

What it holds: each group's epoch keys, in memory only, rotated every MCL_GROUP_ROTATE_MS (default 15 minutes). Keys never travel readable by a station: the pull is a sealed call (confidential => required), refused in the clear by the link before the handler runs.

What it decides: the call's authority, then membership, per pull. The procedure is advertised auth => handler_authorizes (macula 17, macula#129), so the link runs no gate and hands the handler the token the caller signed and its proofs: the handler admits the pull only when that chain ends at the org key, before it looks at anything else. Then the org's removed set, then the realm slot (MCL_REALM + MCL_GROUP_REALM_KEY_ID). A member the realm has withdrawn is refused there though its chain still verifies, and a pull without the org's grant is refused not_authorized: group_keys on mri:proc:<org>/group_keys_v1. A group listed in MCL_GROUP_RESTRICTED is checked on a pubsub/subscribe grant covering the whole group instead, and refused not_authorized: pubsub/subscribe on mri:topic:<prefix> without one. The removed set is a file on the service's own volume, removed_members, one node id (64 hex characters) per line, read at every pull: a member whose id is there is refused every epoch from its next pull, and the set survives a restart. A set that cannot be read, or holds a malformed line, refuses every caller.

What it shows: no epoch key in its process state, its status or a crash report (macula 14.10), and the VM writes no crash dump. It runs without an Erlang distribution listener: no cookie, no epmd, -dist_listen false, so nothing accepts a node connection and no remote shell or dist-eval reaches the keys. The release's remote_console and eval do not work against it, by design.

The architecture (C4 context, containers, components) is in architecture/README.md.

Deploy config

Env Meaning
MCL_GROUP_ORG The org whose groups this service distributes; also the procedure's namespace (<org>/group_keys_v1)
MCL_GROUP_ORG_KEY_ID The org's PUBLIC key id (hex), which the handler admits a pull's chain against. The distributor cannot start without it: on a fresh realm the realm mints the org key only when it issues the provider grant, so a first boot runs without one. /health stays ok through that wait — a normal setup state must never fail a canary — and its body carries "org_key_id": "unset" ("set" once filled) so the wait is read from /health itself, while the boot logs one notice naming this variable and group_keys_v1 is absent from everything advertised; fill it from the published org_directory and the first start that serves the group follows
MCL_GROUP_REALM_KEY_ID The realm key id (hex) the membership check pins the realm slot to
MCL_GROUP_RESTRICTED Restricted groups, comma-separated <prefix>=<mode> (io.macula/acme/orders=refusing), the mode refusing or counting and never left out. A listed group admits a pull only on a pubsub/subscribe grant covering the whole group (mri:topic:<prefix> and mri:topic:<prefix>/*), issued to the caller by the key below; counting also admits an org-grant holder and counts it as a would-be refusal, so it shows as counting, never as protected. Needs MCL_GROUP_POLICY=required, or the distributor does not start. Unset lists none: every group keeps the org's grant
MCL_GROUP_RESTRICTED_ISSUER_KEY_ID The key id (hex) whose pubsub/subscribe grants admit a restricted group's pull. Unset means the realm key (MCL_GROUP_REALM_KEY_ID), the production shape; a lab box may name its own issuer to measure the refusal before the realm mints topic roles (macula-io/macula-realm#98). Membership stays pinned to the realm key either way
MCL_GROUP_POLICY required (default), preferred, or off
MCL_GROUP_ROTATE_MS Epoch rotation interval, default 900000
MCL_GROUP_REMOVED_FILE The removed set, default /var/lib/mcl-distributor/removed_members on the service's named volume
MCL_REALM, MCL_REALM_KEY, MCL_REALM_NAME The realm this service lives in (as every mcl-* service)

The ids above are exactly 64 hex characters, or the service refuses to boot. Everything above is public material; the only secret is the node identity key in the mounted secrets volume.

Trust and blast radius

A distributor gets its power only through the org's delegation, and the damage a rogue one can do is capped at that org's groups for the current epoch: it cannot claim another org's procedure (the D25 chain verifies against the realm key), cannot hand out keys in the clear, cannot forge publications, and cannot capture members already pinned to the honest distributor. Run it for your own org, keep delegations revocable, and the mesh isolates everyone else from it.