stratum-node-cli
[!WARNING] Pre-release (
0.1.0-alpha). Commands, output, exit codes and the library API may change before 0.1.0. Nothing built on it has been deployed yet. The client has no TLS: it talks to loopback addresses only, and reaches a node's public origin through a local address (--connect) until the remote transport arrives with the public origin.
stratum is the client for a Stratum
node. The administrator uses it on the node's loopback administrative API,
over plain HTTP, with the operator's own Nostr key: setup, configuration,
backups, invitations and members, including suspending and removing a
member, and the catalogue of applications members may install. A tenant uses
it with their own key to join a node, to read, write and export their pod
through the node's gate, to publish a small public profile, and to install,
run and withdraw applications whose jobs work on their pod. Anyone can read a member's profile with no key at all. It
never sees the node key or the node's state volume; stratum setup reads the
bootstrap token file only because the operator points it there.
It depends only on the published stratum-node-core and
stratum-node-config crates, so it installs on any Unix machine.
Install
This installs the stratum binary. Minimum supported Rust version: 1.89.
Global options
| Option | Environment | Default | Meaning |
|---|---|---|---|
--url <URL> |
STRATUM_URL |
http://127.0.0.1:7460 |
The node API. The host must be an IPv4 address in 127.0.0.0/8 in canonical dotted-decimal form (127.0.0.1, 127.0.0.2, …; not 127.1 or zero-padded forms), [::1] or localhost; anything else, https://, user information, queries and fragments are refused. |
--key-file <FILE> |
STRATUM_KEY_FILE |
none | The signing key: one nsec1… line in a regular file with no access for group or others (0600). Symbolic links are refused. The operator's key for administrator commands; the tenant's own key for join, pod and export. |
--json |
off | Machine-readable output: one JSON value on standard output; run-time errors as one JSON object on standard error. Command-line usage errors are plain text with exit status 64. |
Tenant commands (join, pod …, export, profile …, app …) take two more options:
| Option | Environment | Meaning |
|---|---|---|
--origin <ORIGIN> |
STRATUM_ORIGIN |
The node's canonical origin, such as https://stratum.visionclaw.pro: https:// or http://, a lowercase host, no default port, no path. Every request names its authority in Host and is signed over <origin><path>. |
--connect <HOST:PORT> |
STRATUM_CONNECT |
The gate's loopback address, such as 127.0.0.1:7461: an address in 127.0.0.0/8, [::1] or localhost, with a port. Requests go there over plain HTTP. Required for an https:// origin, which is otherwise refused with a message that the remote transport arrives with the public origin. An http:// origin without it is reached at its own host and port, which must then be a loopback address. |
Proxy environment variables are ignored and redirects are never followed:
a signed request goes only to the URL it was signed for. localhost is
never looked up: stratum connects to 127.0.0.1 and still sends
Host: localhost:<port> and signs the localhost URL, so neither
/etc/hosts nor a resolver can send a request off the machine. A node that
listens only on IPv6 must be addressed as [::1].
Commands
| Command | What it does |
|---|---|
stratum key generate --out <file> |
Creates an operator key from the system random source, written as one nsec1… line to a new file with mode 0600 set at creation. Refuses to overwrite anything. Prints only the did:nostr:… and npub. |
stratum key show |
Prints the DID and npub of --key-file. |
stratum status |
GET /readyz and a summary. Exit 0 ready, 3 unconfigured, 4 degraded, 2 unreachable. |
stratum config schema |
The configuration schema: every field's path, type, default, apply class and description. |
stratum config show |
The effective configuration, head and active revisions and public-config hash (signed). |
stratum config preview --set path=value … |
The diff, the change list, each change's apply class and the strictest class, without changing anything. Signed when a key file is given (the node requires it once bound). |
stratum config apply --set path=value … [--base-revision n] [--operation-id id] [--yes] |
Previews, prints the diff and the strictest apply class, then applies on the same base revision after confirmation: --yes, or an answer on the terminal. Without either it applies nothing and exits 6. A random operation ID is generated when none is given and printed so a retry can reuse it. |
stratum setup --token-file <path> [--set path=value …] [--expect-node <did>] [--show-text] [--resume-file <file>] [--yes] |
The bootstrap claim; see below. Without --set, the node is claimed with its seed configuration unchanged. |
stratum sign-challenge --claim-body-file <file> --expect-node <did> [--url <claim url>] |
Offline signing: prints the Authorization header value for the claim body and URL. Refuses a body for another claimant or another node than --expect-node, or an expired one. No network. |
stratum audit checkpoint |
Prints the audit checkpoint <seq>:<hex> and the node DID (signed). |
stratum backup [--operation-id id] [--expect-node <did>] |
Asks the node for a backup and prints the directory, checkpoint and configuration revision (signed). Before printing, the returned manifest event must be validly signed, of NIP-78 kind 30078 and authored by the node DID from /readyz (and that DID must be --expect-node when given); its content must be a stratum-backup manifest naming that node: version 1 listing stratum.db, stratum.toml and node-key.age; version 2 listing those and pods.tar.zst.age, with the pod archive counts; or version 3 listing stratum.db.age, stratum.toml.age and node-key.age, then pods.tar.zst.age exactly when it carries the pod archive counts (a version 3 manifest also names the signer recipients the keystore is sealed to, and their number is printed); and its signed audit_checkpoint must equal the printed checkpoint. |
stratum invite create <did> [--expires-in <duration>] [--connect <host:port>] [--operation-id id] [--expect-node <did>] |
Issues an invitation for one did:nostr (signed). The lifetime is seconds or a number with s, m, h or d, at most 30d; without it, the node's membership.invitation_ttl_secs, read from its effective configuration. Prints the invitation identifier, subject, expiry, canonical origin and node DID, and the exact stratum join … line the invitee runs; --connect sets the gate address in that line (default 127.0.0.1:7461). |
stratum invite list |
Lists invitations with their state: issued, redeemed, expired or revoked (signed). |
stratum invite revoke <invitation> [--operation-id id] |
Revokes an invitation that is still issued (signed). |
stratum member list |
Lists members with their state, pod URL, operation and last provisioning error, and the capacity in use (signed). |
stratum member repair <did> [--operation-id id] [--yes] |
Runs provisioning again for a member: restores a missing root ACL and leaves an existing one alone (signed). Asks first. |
stratum member cancel <did> [--operation-id id] [--yes] |
Cancels a reserved member, releasing its slot; the invitation stays used (signed). Asks first. |
stratum member show <did> |
One member as it is now (signed, GET /api/v1/members/<pk>, never stored): state, generation, suspension number, the time of each step, enforcement, whether the pod is over quota, its size at the last measurement with when and how long it took, purge_not_before and the archive reference. |
stratum member suspend <did> [--wait[=<seconds>]] [--operation-id id] [--yes] |
Moves a provisioned or active member to suspended (signed). Every signed request by them, and every signed request to their pod, is refused; their public profile stays readable. No member key and no pod write is involved. Prints the suspension number and enforcing (the gate may still admit new requests until it takes the new directory, at most 310 s) or enforced. --wait then reads the member at once and every 2 s until enforced, for at most the given seconds (330 by default; write --wait=60), and reports the enforcement it read; exit 8 if it is still enforcing, exit 7 if the member is no longer under that suspension (a resend of an old operation after a resume). Asks first. |
stratum member resume <did> [--operation-id id] [--yes] |
Returns a suspended member to the state they had, provisioned or active (signed). An archive taken during the suspension no longer counts. Asks first. |
stratum member archive <did> [--operation-id id] [--yes] |
The node's encrypted archive of a suspended member's pod data (signed; allows 15 minutes). The suspension must be enforced; refused while a backup or another archive runs. Writes pause for every tenant while the node reads the pod, as for a backup. Prints the directory, entry and byte counts and the archive reference. Asks first. |
stratum member remove <did> [--no-archive] [--operation-id id] [--yes] |
Removes a suspended member (signed): the slot is freed and the pod unreachable at once; the data stays on disk until the operator runs stratumd purge, no earlier than the printed purge_not_before. Needs an archive from the current suspension (archive_required, exit 35) unless --no-archive, which waives it: the prompt and the output say so, and the node records who waived it. Prints that other members' ACLs naming the key are not changed and that the key regains that access if admitted again. Asks first. |
| stratum application add <manifest.json> [--operation-id id] [--yes] | Approves the application a manifest describes (signed). The manifest (JSON, at most 256 KiB) is checked for shape against the widest ceilings any node allows, shown, and sent as written; the node checks it against its own ceilings and refuses it unless its runner reports the image ID on the tenant daemon with no volume declared (image_absent, image_has_volumes: exit 41). Asks first. |
| stratum application list | Lists every application: state, name and version, image ID, approval time and installation count (signed). |
| stratum application withdraw\|approve\|disable <id> [--operation-id id] [--yes] | withdraw stops new installations (existing ones keep running); approve makes a withdrawn application installable again; disable is the final emergency stop: every installation's key is disabled and its jobs stopped (signed). Asks first. |
| stratum installations | Lists every installation on the node: owner, application, state, key-disable reasons, job counts and grant state; never a job's result body (signed). |
Every administrator command that changes a member prints its operation ID
before sending. The node binds an operation ID to its action, the member,
the member's generation and the exact request body, so a retry after a lost
answer must repeat the same flags: the printed note says which (for example
--operation-id rm-… --no-archive). The same ID with another action or
another body is refused with conflict.
Tenant commands
Each is signed with the tenant's key over the canonical URL, with a fresh
event every time (the one exception is the single join resend below). An
event is identified by its content to the second, so every signed request
carries a nonce tag of 16 random bytes: two identical requests signed in
the same second, by one command or by two run back to back, are still
distinct events, and the node does not refuse the second as a replay.
Nothing waits for the clock.
| Command | What it does |
|---|---|
stratum join --invitation <id> --node <did> --origin … [--connect …] [--wait-secs n] [--yes] |
Redeems an invitation and activates the pod; see the walk-through. |
stratum pod ls [<path>] |
Lists a container (the pod root by default). Each child the listing names is resolved against the listing's address and shown only if it lies under the container; anything else is reported as refused. |
stratum pod get <path> [-o <file>] |
Reads a resource. With -o, writes the bytes to a new file (mode 0600; an existing file is never overwritten); otherwise to standard output, unchanged into a pipe and with control characters escaped on a terminal. --json needs -o. |
stratum pod put <path> <file> [--content-type …] [--if-match <etag> | --create-only] |
Writes a file (at most 1 GiB; the node refuses a body over its limits.max_pod_body_bytes, 16 MiB by default) to a resource. The content type is guessed from the file name unless given. --if-match writes only over that entity tag; --create-only only where nothing is (If-None-Match: *). |
stratum pod rm <path> [--yes] |
Deletes a resource or an empty container. Asks first. The root ACL is never deleted: that would lock everyone out, the owner included. |
stratum pod acl get [<path>] [-o <file>] |
Reads the ACL beside a resource or container: x.txt.acl for x.txt, docs.acl for docs/, and the root ACL /pods/<pk>.acl for the pod root. |
stratum pod acl put <path> <file> [--content-type …] [--if-match … | --create-only] |
Writes the ACL beside a resource or container (text/turtle unless given; "" is the pod root). |
stratum export -o <archive.tar.zst> [--force] |
Exports your own pod; see below. |
stratum profile init [--replace] |
Writes your public profile document: the card profile/card and the ACL beside it, changing nothing already right; see below. |
stratum profile show <did> |
Prints any member's public profile, read with an unsigned GET (no key needed, even if one is configured). Exit 13 with "no public profile" when the gate answers 404. |
stratum app catalogue |
Lists the applications the node has approved: name, version, image ID, each granted container with its modes and operations, and the most workspace it may be given. |
stratum app install <application> [--schedule <secs>] [--workspace none|read|write] [--operation-id id] [--yes] |
Installs an application; see Applications. --schedule is 0 (manual runs only, the default) or 300 to 604800 seconds. |
stratum app list |
Your installations: state, application, grant, job counts, key-disable reasons and any ACL cleanup still pending. |
stratum app show <installation> |
One installation: state, application key, schedule, workspace, key-disable reasons, grant, pending cleanup, the enforcement parts (authorisation, keys, work) while a withdrawal or suspension is being enforced, and job counts. |
stratum app jobs <installation> |
Its jobs: period, state, attempts, outcome, and the resource, SHA-256 and length the job reported. |
stratum app run <installation> --period <n> [--yes] |
Creates the job for period n if it has none (a period that has one answers that job). Asks first. |
stratum app withdraw <installation> [--yes] |
Withdraws the installation, then removes its authorisation from each granted container's ACL and reports the cleanup. Asks first. Exit 43 while any container's cleanup is still pending. |
stratum app cleanup <installation> [--yes] |
Finishes an interrupted cleanup: for each container the node lists as pending, edits the installation's authorisation out of its ACL with If-Match, reads it back and reports it at once. Asks first. |
stratum app resume <installation> [--yes] |
After a restore, enables the installation's key again (removes the restore reason only). Asks first. |
A <path> is relative to your own pod root (private/x.txt), or absolute
(/pods/<64 lowercase hex>/… or /pods/<64 lowercase hex>.acl) to address
another member's pod, which works only where they have granted you access.
Every path is checked before anything is sent. Step 2 allows only the
unreserved characters A–Z a–z 0–9 - . _ ~ in names, with / between
segments: no spaces, no percent-encoding, no . or .. segment and no empty
segment. A refused path says which rule refused it and exits 64.
Values for --set
Values are typed by the schema compiled into stratum-node-config:
- booleans are
trueorfalse; - integers are decimal (the node checks the range);
- strings, enums and secret references are taken as written, and may be empty;
- lists of strings are comma-separated (
--set backup.age_recipients=age1pq1…,age1pq1…), or the same path repeated (--set backup.age_recipients=a --set backup.age_recipients=b).path=is the empty list. Elements cannot be empty or contain a comma.
Bootstrap walk-through
A fresh node boots unconfigured and writes a single-use token to
<state_dir>/bootstrap-token (mode 0600). Whoever can read that file is
the owner.
-
Create the operator key on the machine that will administer the node:
-
Check the node is waiting to be set up (exit code 3):
-
Claim it, with any initial configuration (or none: without
--setthe seed configuration is committed unchanged).stratumdlogs its node DID when it starts listening (stratumd listening … node=did:nostr:…); pass it as--expect-node:With
--expect-node,stratumsends nothing butGET /readyzuntil the node reports that DID, so the bootstrap token never goes to another node. Without it, setup trusts whatever answers on the loopback port: a local process that holds the port whilestratumdis down would receive the token./readyzis not signed, so the pin stops a wrong URL or a responder that does not know the DID, not an impostor that has learned it; Step 1 has no TLS.stratumderives the initial configuration itself: the seed text ofstratum-node-config(the text of revision 0) with the--setchanges applied. It asks the node for a preview of the same changes and stops unless the node's text and diff equal its own byte for byte, then shows its own diff and change list.--show-textalso prints the whole text. It then asks the node for a challenge and checks the claim body before signing anything: it must name this key as claimant and the node DID reported by/readyz, must not have expired, must answer the challenge, must be based on revision 0, and itsconfig_sha256must be the SHA-256 of exactly that locally derived text, the text shown. The claim URL must be this client's own/api/v1/bootstrap/claimwith methodPOST. It then shows the claim fields and asks for confirmation (or takes--yes). Because the text comes from the client's own copy ofstratum-node-config, the client andstratumdmust be built on the same version of it; if they differ, setup stops with exit 7 and signs nothing.The signed request, the claim body and the token are saved to the resume file (default
<key file>.setup-resume, mode0600, created exclusively) before anything is sent. On success,stratumprints the administrator DID, the revision and the public-config hash, and deletes the resume file. -
If the response is lost (a timeout, a dropped connection, a 5xx), rerun the same command. Because the resume file exists,
stratumresends the identical signed request byte for byte, and a node that already committed the claim returns its stored result. The token is taken from the resume file, since the node deletes its token file once the claim commits. A 4xx answer deletes the resume file: the identical request can never succeed. With--expect-node, the saved claim must name that node and/readyzmust report it before the saved request is resent. -
Keep
stratum audit checkpointoutput somewhere the node cannot write.
Key on another machine
If the operator key never touches the node's host, request the challenge yourself and sign offline:
# On the node host: ask for a challenge for the operator's DID.
|
# On the key's machine: sign the exact bytes for the claim URL.
sign-challenge refuses a body that names another claimant, a node other
than --expect-node (taken from stratumd's start-up log, never from the
file), or has expired, and it signs only for /api/v1/bootstrap/claim. It
cannot check the configuration hash or base revision offline: those are
signed as the node issued them, so review the challenge response before
signing, or use stratum setup, which checks them.
Then send claim.json verbatim to the claim URL with the printed
Authorization header, Content-Type: application/json and the token in
Stratum-Bootstrap-Token. The header is valid for 60 seconds around its
creation time. The claim body must not gain a trailing newline (jq -j
writes none); sign-challenge warns if the file ends in whitespace.
Tenant walk-through
The administrator issues the invitation and passes on the printed line:
The tenant creates a key once, then joins with the identifier, node DID and origin from that line:
join fetches the node's admission notice and stops, signing nothing,
unless the node it reached reports the DID the invitation names, the origin
given, and a notice whose SHA-256 (computed over the text received) equals
both the hash the node reports and the hash of the notice this client was
built with. It shows the notice and asks for confirmation (a terminal is
required unless --yes), redeems the invitation with an admission claim
signed by the tenant's key, waits up to --wait-secs (default 120) for the
pod to be provisioned, showing the node's last error if it reports one, then
writes a probe resource in the pod, reads it back, deletes it, writes the
public profile document (below), and confirms. It prints the pod URL,
<origin>/pods/<tenant hex>/, and the profile's URL.
If the connection fails after the redemption was sent, join resends the
identical signed request once, and the node returns the response it stored.
Rerunning join after any partial run is safe: it asks the node for the
tenant's operation first, and a tenant who is already a member continues
from where the last run stopped without redeeming again. Exit 8 means the pod
was not provisioned in time; rerun the same command. A key whose membership
was removed or cancelled is not a member: with a new invitation, join
redeems it and the key joins again under a new generation with an empty pod,
once the operator has purged its old pod data (until then the node refuses
with pod_data_present, exit 36).
The public profile
Every member's pod can hold one document anyone may read without a
signature: /pods/<pk>/profile/card, Turtle, saying which key owns the pod:
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
<#me> a foaf:Person ;
owl:sameAs <did:nostr:<pk>> .
Beside it, profile/card.acl gives you read, write and control and
everyone read, on the card only. join writes both while the member is
still provisioned, before confirming; stratum profile init does the same
for a member admitted earlier. Each reads before it writes, and creates only
with If-None-Match: *, so an interrupted run resumed writes nothing twice
and a repeat sends no write at all. A card you customised is left alone as
long as it still names you (<#me> owl:sameAs <did:nostr:<pk>>) and is
stored as text/turtle within 64 KiB; an existing ACL is never changed. A
card that does not qualify is reported and left alone, with no ACL written:
join carries on, profile init exits 7, and profile init --replace
replaces it with the standard card, only if it has not changed since it was
read.
The node serves the card unsigned while you are provisioned, active or
suspended, if the ACL makes it public. Suspension does not create or
repair one: a member who never wrote a card, deleted it or made it private
has none, and stratum profile show reports "no public profile".
When the gate refuses
A suspended member's signed requests, and every signed request to their pod,
are refused with suspended (exit 34) on pod, profile init and
export; an export stops and leaves no archive. join by a suspended key
stops before showing the notice and redeems nothing (exit 7, naming the
suspension). A pod over its quota refuses
PUT with insufficient_storage (exit 30); reading and deleting still work.
A gate that has not heard from the node's controller in time refuses pod
requests with gate_unavailable (exit 26, as it does while writes are paused
for a backup), and one that cannot reach the pod server with
pod_unavailable (exit 38); neither forwards the request, so it can be
retried. Each prints a hint: line saying what to do.
Then write, read and export:
Export
stratum export walks your own pod from /pods/<pk>/ and fetches the root
ACL /pods/<pk>.acl. Each child a listing names is resolved against the
listing's own address and followed only if it is on the canonical origin,
passes the path rules above, is in your own pod and lies under the container
listed; anything else (another pod, another origin, a . or .. segment)
is skipped and reported. Redirects are never followed. For every container
and resource it asks for the ACL beside it (a 404 means there is none) and
records which exist. Nothing is fetched twice.
It writes a tar archive compressed with zstd that unpacks to
pods/<pk>/… (containers as directories) and pods/<pk>.acl, byte for byte
as stored, and beside it <archive>.manifest.json: every entry's path,
kind, size, SHA-256 and content type, the ACLs that exist, the archive's own
size and SHA-256, and what changed, vanished or was skipped. The export is not
a snapshot: after the walk it asks again for each resource's entity tag and
each container's listing and reports what changed or vanished meanwhile
(exit 9; both files are still written). The walk stops with an error at
100,000 entries or 64 GiB.
Both files are written under temporary names beside the target (mode
0600) and moved into place when complete: the archive first, then the
manifest. The manifest is the commit point, so a manifest beside an archive
always describes that archive. An archive with no manifest beside it is an
export that did not finish; run it again. Without --force nothing is ever
replaced, not even a file that appears at either name while the export runs
(another export to the same name, say): the export fails, and an archive it
had already placed is withdrawn. With --force, the old manifest is set
aside before the archive is replaced and put back if the archive cannot be
moved. Two files cannot be replaced in one atomic step, so a failure or a
crash between the two moves leaves an archive with no manifest (and perhaps
a hidden .<archive>.manifest-old-… file), never an archive beside a
manifest that describes something else. Forced exports run at the same time
to the same name are not coordinated. stratum does not read the manifest
back; to check an archive against it, compare sha256sum <archive> with the
manifest's archive.sha256.
Applications
An application is a container image the administrator approved with a
manifest: the containers of your pod it asks for, Read or Read and
Write on each, never Control. Installing it gives it a key of its own,
held by the node, which signs only its jobs' requests, only inside the
containers you grant.
app install creates the installation, then checks the grant the node
offers: it renders the authorisations again from the manifest and the
application's key, and refuses unless every byte and hash matches. For each
granted container it reads the ACL that governs the container now (its own,
or the nearest ancestor's; only a 404 moves the search up a level) and builds
the container's new ACL:
- your own authorisation on the container, with
Read,WriteandControl; - every authorisation of the container's own ACL, unchanged;
- from an inherited ACL, each authorisation whose
acl:defaultreaches the container, copied onto it with the same agents and modes, so everyone keeps exactly the access they had; one that reached the container only byacl:accessTonever applied to it and is not copied; - the offered authorisation: the application's key,
acl:defaulton the container, the manifest's modes.
If the governing ACL holds a statement the client does not evaluate (an
acl:agentGroup, an acl:origin, an acl:condition, an agent class other
than foaf:Agent, any other predicate or type, or a document that is not
Turtle), it refuses and names it (exit 44), and writes nothing. It also
refuses any ACL that would give the application Control, including through
a foaf:Agent rule.
It prints, for each container, the diff of its ACL; then you, the
application, its version and image ID, the application's key, and this
statement: the node's operator has root on the host and can read workspaces,
the tenant daemon's data and backups. Then it asks (--yes answers for you).
For each container it then checks that the installation is still
pending_consent, reads the governing ACL again and starts again if its
entity tag changed, writes the new ACL with If-Match (or
If-None-Match: * where the container had no ACL of its own), starts again
on 412, and reads the ACL back, comparing the parsed statements with what it
wrote. Only when every container matches does it send consent with the
offered grant's hash. If a read-back differs, the installation stops being
pending_consent, or the node refuses consent, it removes every ACL whose
read-back matched: an ACL it created is deleted and one it replaced gets its
earlier bytes back, each only if it is still what was read back (exit 42; an
ACL that failed read-back is left in place and named so a concurrent editor's
ACL is never overwritten, and anything else it could not remove is listed). A
change to an inherited ACL between the reread and the
write is not detected: If-None-Match protects only the new ACL.
Declining leaves the installation pending_consent with nothing written;
the printed operation ID, given back with --operation-id and the same
flags, continues it.
app withdraw withdraws the installation (the node disables its key and
stops its jobs; its gate and proxy refuse the key within 310 s), then edits
the installation's authorisation out of each granted container's ACL with
If-Match, reads it back, and reports each container cleaned as soon as it
is. Every other statement in the ACL stays. Until every container is
reported, every stratum app command prints the pending cleanup and how to
finish it with stratum app cleanup; the pending list is the node's, so it
survives a restart of the node or of this machine. While your membership is
suspended the tenant routes refuse (exit 34) and nothing is shown; it is
shown again after you are resumed.
Exit codes
| Code | Meaning |
|---|---|
| 0 | Success; for status, the node is ready |
| 1 | Local failure: a key, token or resume file, the clock, or writing output |
| 2 | The node could not be reached |
| 3 | status: the node is unconfigured |
| 4 | status: the node is degraded |
| 5 | The node's response does not follow the API contract (including an oversized body) |
| 6 | Previewed but not applied: no confirmation |
| 7 | A local check refused the node's answer (claim body, backup manifest, admission notice, join probe, an answer naming another member or state, an offered grant that is not the one the manifest renders), a profile card that does not name you, or an ACL that would give an application Control |
| 8 | A bounded wait ran out: join (the pod was not provisioned within --wait-secs; rerun to continue) or member suspend --wait (still enforcing) |
| 9 | export: the archive was written, but entries changed, vanished or were skipped |
| 10 | bad_request |
| 11 | unauthorized |
| 12 | forbidden |
| 13 | not_found |
| 14 | conflict (stale revision, already bound, operation conflict) |
| 15 | payload_too_large |
| 16 | unsupported_media_type |
| 17 | invalid (HTTP 422 on configuration, 400 with a field for an application's manifest), or a preview with validation errors |
| 18 | too_many_challenges |
| 19 | backup_refused |
| 20 | internal |
| 21 | A server error code this client does not know |
| 22 | request_timeout |
| 23 | capacity_exhausted |
| 24 | invitation_refused |
| 25 | invitations_disabled |
| 26 | gate_unavailable (writes are paused, or the gate has not heard from the node's controller in time; nothing was forwarded) |
| 27 | too_many_requests |
| 28 | misdirected_request (the --origin is not the node's) |
| 29 | method_not_allowed |
| 30 | insufficient_storage |
| 31 | precondition_failed (--if-match or --create-only did not hold) |
| 32 | bad_gateway (the gate got no valid answer upstream) |
| 33 | gateway_timeout (the gate's upstream did not answer in time; read before writing again) |
| 34 | suspended (the membership the request depends on, yours or the pod owner's, is suspended) |
| 35 | archive_required (member remove needs an archive from the current suspension) |
| 36 | pod_data_present (the key's earlier pod data has not been purged) |
| 38 | pod_unavailable (the pod server cannot be reached, or the node has no pods or no canonical origin yet) |
| 39 | workspace_unavailable (no workspace slot for the installation; every mode but none in this release) |
| 40 | application_unavailable (the application is withdrawn or disabled) |
| 41 | image_absent or image_has_volumes (approval found the image missing from the tenant daemon, or declaring a volume) |
| 42 | app install: an ACL did not read back as written, or consent was refused (by the node, or because the installation stopped being pending_consent); what was written was removed |
| 43 | app withdraw or app cleanup: the ACL cleanup is still pending for at least one container |
| 44 | An ACL the client would have to rewrite holds a statement it does not evaluate; nothing was written to it |
| 45 | runner_unavailable (approval could not read the image: the node's runner is down or refused; nothing was stored) |
| 46 | signer_unavailable (an installation's create or consent was recorded, but the signer has not yet made or enabled its key. After an install, app install again with the same --operation-id, or app list, finishes it; after a consent the node keeps trying and app show reports when it is active) |
| 64 | Invalid command line |
Codes 0 to 22 and 64 are as published in Step 1; 8, 9 and 23 to 33 were added
in Step 2, 34 to 36 and 38 in Step 3a (pod_unavailable exited 21 before
38 was given to it), and 39 to 46 in Step 3b. Code 37 is unassigned: an
earlier pre-release gave it to lease_expired when that was only the gate's
log name for a decision. lease_expired is now the pod proxy's answer to a
job; it and the other codes only a job or the controller meets
(lease_revoked, outside_grant, lease_starting, busy,
pod_auth_refused, key_disabled, no_window, outside_pod,
payload_rule, container_identity_conflict, create_expired) have no exit
code and fall to 21. Server errors are printed as
code: message, with any validation errors listed below and, for
suspended, archive_required, pod_data_present, gate_unavailable,
pod_unavailable, insufficient_storage, app_forbidden,
rate_limited, workspace_unavailable, application_unavailable,
image_absent, image_has_volumes, runner_unavailable and
signer_unavailable, a hint: line (the hint
member under --json); exits 42, 43 and 44 carry a hint too. Text from the node has control characters escaped. On a
pod route the pod server's own error bodies are not in the error envelope;
they are named after their HTTP status (not_found: HTTP 404 from the pod server) and never echoed.
Secrets
The operator secret is read into memory that is zeroised afterwards and is
never printed, logged or put in an error, in any encoding; it is never sent
to the node either. The bootstrap token is never printed: once read, every
line stratum writes, including error text and JSON that came from the
node, has the token (in either letter case, and its base64 forms) replaced
by <redacted>, so a node that echoes it back cannot make the CLI show it.
The claim result is printed from its checked fields only. Every
Authorization value stratum signs is redacted in the same way (the token
after the Nostr scheme word becomes <redacted>, in any letter case and
wherever it starts), so a server that echoes one back cannot make the CLI
print it. Every signature stays registered until the process exits, so a
header quoted much later, such as a provisioning error shown after many
polls, is still caught. Both are checked
by the test suite, which runs every command, including failures and nodes
that reflect the token, and searches the captured output for the secret in
hex, nsec, bech32 payload and base64 forms, and for the token.
Key, resume, token and claim body files are opened once with O_NOFOLLOW
and O_NONBLOCK, and their type, mode and (for the key and resume files)
owner are checked on the open descriptor, so a symbolic link or a FIFO
swapped in at the path is refused without blocking. The key and resume
files must belong to the user running stratum, except under root, so
sudo -E stratum setup works with the operator's own key file. A resume
file written under sudo belongs to root: rerun the resend with sudo too.
Key and resume files are written to a hidden temporary file in the same
directory (.<name>.tmp-…, mode 0600), synced, and only then moved to
their final name with a move that never replaces an existing file
(renameat2(RENAME_NOREPLACE), or a hard link where that is unsupported).
An existing file is never overwritten, and a process killed mid-write leaves
at most the hidden temporary file, never a partial key or resume file.
Library
The binary is a thin clap front end over the stratum_node_cli library,
which exposes the commands (Session), key files, --set parsing and the
exit codes so they can be tested and reused:
use ;
Licence
AGPL-3.0-only. See LICENSE.