Configuration¶
catchpen reads its settings from ~/.config/catchpen/config.yaml. The file is optional: a
missing or empty file means the defaults below. Unknown keys are errors. catchpen init
writes a commented config.yaml and secrets.env listing the settings and secret
names, and the commented template category files; it keeps files that
exist. What VMs contain (distro, size, software, network) is set in those category
files, not here.
Directories¶
| Variable | Effect |
|---|---|
CATCHPEN_HOME |
When set, config goes in $CATCHPEN_HOME/config, data in $CATCHPEN_HOME/data and caches in $CATCHPEN_HOME/cache. |
XDG_CONFIG_HOME, XDG_DATA_HOME, XDG_CACHE_HOME |
Used when set to an absolute path; otherwise ~/.config, ~/.local/share and ~/.cache. catchpen adds /catchpen to each. |
~/.config/catchpen/
config.yaml this file
secrets.env NAME=value secrets (must be 0600)
forges.yaml managed by catchpen forge add/rm
clients.yaml API clients, managed by catchpen daemon client add/rm (0600: holds keys)
server.key, server.crt the API's TLS key and certificate, made by catchpen daemon info
ssh_config generated; catchpen setup-ssh includes it from ~/.ssh/config
templates/<category>.yaml your template sections (distros.yaml, runtimes.yaml, ...)
~/.local/share/catchpen/
images/ verified cloud images (+ .img.json: source URL and digest)
bases/ template bases, one file per generation, and build logs
vms/<name>/ disk overlay, seed, keys, allowlist, egress.log, qemu.log, ...
vms/pool-<id>/ warm pool VMs
recordings/<name>/ session recordings (asciicast v2)
transcripts/<name>/ agent session stores copied from the VM
tasks/<id>/ task.json, prompt.md, output.jsonl, result.md, supervisor.log
audit.jsonl host audit log
daemon.lock, rebuild.stamp catchpen daemon state
api.sock the API's socket, while catchpen daemon serves it (server:)
~/.cache/catchpen/pkg/ package caches (apt, go, npm, pypi, docker)
~/.cache/catchpen/sources/ pinned git repos of skills and plugins
catchpen creates these directories with mode 0700.
Reference¶
defaults:
user: agent # the guest user; not root
images: # custom apt-based cloud images; pick one with a distros.yaml section
my-ubuntu:
url: https://images.example.com/my-ubuntu.qcow2
checksum_url: https://images.example.com/SHA256SUMS # or sha256: / sha512: <hex>
secrets: # where secret:NAME values come from
CLAUDE_CODE_OAUTH_TOKEN: { command: [pass, show, claude/token] }
ANTHROPIC_API_KEY: { env: MY_ANTHROPIC_KEY }
record: true # host-side recordings of interactive sessions
notify: # see notifications.md
sinks: [desktop]
events: [task.done, task.failed, egress.prompt, agent.waiting, vm.idle_stop, canary.hit]
tasks: { max_vms: 2, max_memory: 24G } # budget for parallel tasks
idle_stop: off # stop idle VMs: off, daily, weekly or a duration >= 1m
rebuild: off # daemon rebuilds bases in use: off, daily, weekly or a duration >= 1m
pool: # warm pool kept by the daemon; template is a -t spec
- { template: default, size: 2 }
- { template: "go-1.27,large", size: 1 }
cache_max: 20G # package cache size
canary_action: pause # pause, stop or log
server: {} # the daemon serves the API on its unix socket;
# server: { listen: "127.0.0.1:7443" } also serves it
# over TLS 1.3 to enrolled clients
| Key | Default | Notes |
|---|---|---|
defaults.user |
agent |
Matches ^[a-z_][a-z0-9_-]{0,31}$; root is refused. |
images.<name> |
url must be HTTPS, with exactly one of checksum_url (HTTPS), sha256 or sha512. A custom name shadows a built-in distro. Use it with a section in templates/distros.yaml, e.g. my-ubuntu: { distro: my-ubuntu }, and -t my-ubuntu. |
|
secrets.<NAME> |
Exactly one of command (argv, 30 s timeout, trailing newline trimmed) or env. |
|
record |
true |
false turns session recording off. |
notify |
no sinks | See notifications.md. |
tasks.max_vms |
2 |
All running catchpen VMs count against it. |
tasks.max_memory |
no limit | A size such as 24G. When no VM is running or starting for a task, a task starts anyway, even one that needs more. |
idle_stop |
off | A template can override it (idle.yaml). See deployment.md. |
rebuild |
off | Needs the daemon. |
pool |
none | template is a -t spec (default: every category's default), size is 0 to 32. Each template may appear once. A pool VM serves only the same spec, written the same way. |
cache_max |
20G |
Least recently used objects go first. |
canary_action |
pause |
See canaries.md. |
server |
not set | Set it (server: {}) and catchpen daemon serves the API on api.sock in the data directory, mode 0600, to its own user only. server.md covers its setup, enrolment and every route; this row is a summary. A bare server: is the same as not setting it. Read when the daemon starts: restart it after a change (systemctl --user restart catchpen). Every POST needs Content-Type: application/json (a parameter such as charset=utf-8 may follow), with a body or without, and is refused (415 unsupported_media_type) otherwise: a web page can make a browser that holds an enrolled client's certificate send other POSTs, but not that one, without a CORS preflight, which the API never allows. The API so far reads: its version (GET /v1/info), the VMs (GET /v1/vms, GET /v1/vms/<name>: state, template, size, egress mode, the ports QEMU forwards; warm pool VMs marked pool), a VM's snapshots (GET /v1/vms/<name>/snapshots), the template categories and their sections (GET /v1/templates, without the sections' settings), the headless tasks (GET /v1/tasks, GET /v1/tasks/<id>, without their prompts or commands), the audit log a page at a time, newest first (GET /v1/audit?vm=<name>&limit=<1-1000, default 100>&before=<the previous page's next>) and what the package caches hold (GET /v1/cache). It also creates, starts, stops (force to power off at once), destroys and resumes VMs (POST /v1/vms, POST /v1/vms/<name>/start, /stop, /destroy, /resume; create takes catchpen up's options but --ssh-agent, --agent-key and --ephemeral, and no name starting with task- (tasks' VMs) or repo with any of @ ? # %; a destroy needs "confirm": true and the snapshots, pause and canary hit GET /v1/vms/<name>/destroy lists, with what else it loses; stopping a paused VM needs "force": true; starting, stopping, destroying or resuming a task's VM (task-…) needs config:write; a VM whose template sets ssh.agent other than off is neither created nor started, as that loads or forwards your SSH keys: use the CLI). It also resets, rebases and pushes credentials to VMs (POST /v1/vms/<name>/reset, /rebase, /push) and saves, restores and deletes their snapshots (POST /v1/vms/<name>/snapshots, /snapshots/<snap>/restore, /snapshots/<snap>/delete). On a task's VM, every one of these needs config:write; snapshots.md says what each needs. Each is a job (GET /v1/jobs, GET /v1/jobs/<id>?after=<lines read>) that runs on when its client goes. Jobs live in the daemon's memory: 16 run at most, the last 32 that ended are kept with their last 500 progress lines, a restart forgets them and stopping the daemon cancels those running. A job's error and progress can name host paths and quote the guest, as catchpen up prints them; once they are found to carry the VM's decoy credentials, every line and the error read (withheld: …) and the hit is acted on (see canaries.md for what is found). To a client without config:write, whoever started the job, every progress line and the error read withheld: a job's line can quote its guest, which holds the template's secrets: reading it needs the config:write scope and withheld: a job's error can quote its guest, which holds the template's secrets: reading it needs the config:write scope, since the guest can print a template's secret into either; the job's state, kind, VM, client and line count stay; a decoy's (withheld: …) still comes first, for every client. It also reads and changes a VM's egress lists and settings, and lists, opens (a job) and stops its forwards (changing a task's VM's egress, or opening a forward on it, needs config:write): see egress.md and forges.md. It also lists, scans, adds, tests and removes forges (scanning, adding and removing need a client with config:write), and pulls branches from VMs and opens pull requests, as jobs (from a task's VM, these need config:write): see forges.md. It also submits headless tasks (which needs config:write), and cancels and deletes them, as jobs, and builds and rebuilds template bases, as jobs: see tasks.md and templates.md. It also reads and writes config.yaml and your template category files, and shows templates, and lists, sets and unsets the secrets in secrets.env (never returning a value), for clients with config:write: see Over the API, secrets.env over the API and templates.md. The daemon doesn't see your shell's environment: a secret it reads from there for the CLI must be in secrets.env or a command: source for a VM the API creates or starts. A VM the API starts keeps running when the daemon stops. The audit events these calls cause carry client: the enrolled client's name, or @local over the socket. It never returns a VM's environment, forge credentials, agent settings or canaries.json, or a task's prompt or command, and returns a template section's settings only to a config:write client, in the files and templates it reads. A task's --repo with a user or password (any @, git@host:o/r included) is shown without them, and that task's error is withheld (catchpen task show prints it), and so is every task's error to a client without config:write (it can quote the guest, which holds the template's secrets); other text loses a plain scheme://user:password@ URL's user and password (not a token in a query). A task's output and errors, and audit details, can name host paths, as catchpen task ls and catchpen audit show them; a canary.hit event names the host the canary was sent to. |
server.listen |
not set | A host:port, quoted (":7443" for every interface; "[::1]:7443" for IPv6), where the daemon also serves the API over TLS 1.3, with the certificate catchpen daemon info shows, to clients enrolled with catchpen daemon client add: by their certificate, or by requests signed with their HMAC key. It refuses to start with no client enrolled. At most 64 connections at once, 16 from one IPv4 address or IPv6 /64; once a request's headers are in, it has 30 s to send its body and 30 s, from when it is authenticated, for its answer to be read (90 s for a call that reaches a forge), and a refused one closes its connection. Per enrolled client, at most 8 streams are open at once (the terminal, console, prompts, audit and egress follows, task output, events), and a client may make 30 requests in a burst, refilled one every 100 ms (10/s); beyond either, the answer is 429 rate_limited (a refused stream's message names the cap). A client removed with catchpen daemon client rm has its open streams end within 2 s. The unix socket is exempt. A connection is closed 60 s after it opened unless a request on it has been authenticated by then. |
Sizes are a number followed by M, G or T (MiB, GiB, TiB).
Distros¶
The built-in distros, each picked with the distros.yaml section of the same name
(-t debian-13):
| Name | Image |
|---|---|
ubuntu-24.04 |
cloud-images.ubuntu.com/noble/current, checked against its SHA256SUMS |
ubuntu-26.04 |
cloud-images.ubuntu.com/resolute/current, checked against its SHA256SUMS |
debian-13 |
cloud.debian.org/images/cloud/trixie/latest (genericcloud), checked against its SHA512SUMS |
All are amd64 and apt-based with cloud-init; custom images must be too. A cached image is reused only while its URL and pin are unchanged; editing either downloads and verifies the new image and builds new bases.
Secrets¶
secret:NAME values in templates, forges and notification sinks are resolved on the
host, in this order:
- a
secrets.NAMEsource in config.yaml (if it gives an empty value, the lookup stops there); - the environment variable
NAME; ~/.config/catchpen/secrets.env.
secrets.env holds NAME=value lines, optionally prefixed with export and with the
value in matching quotes. Lines starting with # and blank lines are skipped; there is
no inline comment or escape handling. The file must have no group or other permission
bits (chmod 600). Values with a newline, CR or NUL are refused.
The daemon runs as a systemd user service and doesn't see your shell's environment, so
secrets it needs (notification tokens) belong in
secrets.env or a command: source.
secrets.env over the API¶
catchpen daemon's API lists, sets and unsets the secrets in secrets.env for a client
enrolled with --scope config:write (403 otherwise; over the unix socket, every call is
allowed). No call returns a value, or a hash of the file.
| Call | What it does |
|---|---|
GET /v1/secrets |
The names secrets.env sets, sorted, each with shadowed: config.yaml's secrets: has a source of that name, which secret:NAME reads instead. A name whose last line has no value (NAME=) sets nothing and isn't listed; neither is a name the API can't set nor one whose last line's value is only = (both what a token pasted on a line of its own reads as). |
POST /v1/secrets/<NAME> |
value: set NAME to it. A name with a value on any line needs "confirm": true (428 otherwise), as that value is lost. Answered with the names, as GET does. |
POST /v1/secrets/<NAME>/delete |
"confirm": true: remove the lines setting NAME, a NAME= line included (404 if there is none; 428 without confirm). Answered with the names left. |
A name is letters, digits, _, . and -, not starting with a digit, . or -, up to
128; a value is not empty, up to 32 KiB, with no newline, CR or NUL (400 otherwise). A
set replaces the last line setting the name (keeping its export), removes the
others, and otherwise fills in a commented # NAME= line, as catchpen init writes
them, or appends one; the value is quoted when it has whitespace at either end or is in
matching quotes itself. Every other line, and the file's mode, are kept; a new file is
0600. A set or unset is refused when secrets.env is a symbolic link, has other hard
links, belongs to another user, is read-only or isn't a regular file (409: edit it by
hand), as for config.yaml; the list reads through a symbolic link. A secrets.env
catchpen can't read (a group or other permission bit, a line that isn't NAME=value,
not a regular file) fails the list, and a set or unset that gets that far (500), until
you fix it by hand. Changes wait for writes to config.yaml and the template files
(config.lock) and read the file under that lock; a hand edit doesn't lock, and one
saved in the moment between a change's read and its write is lost (and more of the file, if
your editor rewrites the file in place).
Sets are audited as secret.set (name, replaced) and unsets as secret.unset
(name), with client; GET /v1/audit leaves name and replaced out for a client
without config:write, and the names creds.push lists (those a VM's template found
and missed) and the secrets forge.add names too; GET /v1/forges and a forge test
don't name secrets to that client either, and neither does a job's error or progress
line: a client without config:write reads every one of those withheld, whatever wrote
it (the server row above says what it reads). A new value
is read the next time catchpen looks the secret up:
when a VM is created or started, its credentials are pushed (catchpen creds push, or
POST /v1/vms/<name>/push), or a notification is sent. Running VMs keep what they were
given until then, and the egress prompt watcher keeps the file as it read it (values and
names) until the VMs it watches change. An environment variable of the same name in the
daemon's environment wins over secrets.env (shadowed doesn't say so): a set then
changes nothing the daemon reads.
forges.yaml¶
catchpen forge add and catchpen forge rm manage ~/.config/catchpen/forges.yaml (mode
0600). You can read it, but prefer the commands, which pin host keys for you. See
forges.md.
Over the API¶
catchpen daemon's API reads and writes config.yaml for a client enrolled with
--scope config:write (403 otherwise; over the unix socket, every call is allowed). The
file can hold literal secrets (notify URLs, headers and tokens), and a secrets:
command runs on the daemon's host, so reading it needs the scope too.
| Call | What it does |
|---|---|
GET /v1/config |
The file's text, its SHA-256 (hash, "" with no file), whether it exists, and effective: the settings it gives, the defaults filled in, as YAML. |
POST /v1/config |
text, the whole new file, and base_hash, the hash it was read with ("" for no file): written, keeping the file's mode (0600 for a new one, as it can hold secrets), and answered as GET does. |
A write is refused, with nothing written, when:
- the file changed since it was read (409:
base_hashisn't the hash of the file now); - the text doesn't load as catchpen loads
config.yaml(400, with the error the CLI would print); - it would stop a template that passes
catchpen up's checks (as templates.md lists them) from passing (400: an image the default template, a profile or apool:entry uses removed), or it adds apool:entry whose template doesn't pass (400: an unknown section, say); see templates.md; - it changes
server:(409), which decides whether and where the API is served: edit that by hand; config.yamlis a symbolic link or has other hard links (409), which the write would cut from the file, belongs to another user, is read-only, or isn't a regular file (409): edit it by hand.
Writes over the API to config.yaml and the template files wait for each other (one
lock, config.lock in the config directory); a hand edit doesn't, and the hash catches
it. Each write is audited as config.write, with client, file,
old_hash and new_hash; GET /v1/audit leaves the hashes out for a client without
config:write, since a file's hash confirms a guess of what it holds. A change applies from the next call and the daemon's next
round, except that the egress prompt watcher keeps its notify: and secrets:
settings until the VMs it watches change; a hand edit of server: applies only when the daemon restarts. A config.yaml that doesn't load fails
every call that needs it (500) until you fix it by hand. Template category files work
the same way: see templates.md. secrets.env is
changed a name at a time: see secrets.env over the API.
A config:write client can do anything a hand edit can: run host commands
(secrets: command), turn off what guards you (canary_action: log, record: false)
and send any secret the daemon can read into new VMs (a template's env naming
secret:NAME). Enrol only clients you would trust with your shell.