Runner reference
The runner's policy file, commands, files, failure codes and logs.
Everything about zenitya-runner: its policy file, its commands, the files it
keeps and the codes it reports. To set one up, start with
Running tools on your network.
config.yaml
/etc/zenitya-runner/config.yaml is the runner's local policy. It must be
owned by root and writable by no one else, nor may any directory above it be.
Unknown keys and keys given twice are errors, so a typo fails loudly. Check
it with zenitya-runner config check; the service reads it when it starts.
| Field | Type | Default | Meaning |
|---|---|---|---|
projects | list | none | Project IDs whose calls the runner accepts. Every other project's calls are refused. At most 1,000 |
egress | list | none | What calls may reach. Each rule sets exactly one of cidr or host, and ports. At most 256 rules |
egress[].cidr | string | An IPv4 network such as 10.20.0.0/16, written with its network address. It may not overlap the ranges calls never reach | |
egress[].host | string | A host name such as db.internal.example.com, resolved by the machine's DNS. Exact names only, no wildcards | |
egress[].ports | list | TCP ports, 1 to 65535, at most 64 per rule | |
secrets | map | none | Local secrets by name, at most 256. Names follow the project secret rules |
secrets.<NAME>.env | string | Read the value from this variable in /etc/zenitya-runner/environment when the service starts | |
secrets.<NAME>.file | string | Read the value from this file for each call, without a trailing newline. Absolute, and outside /home, /root, /tmp, /var/tmp and /run/user | |
secrets.<NAME>.projects | list | every listed project | The projects whose calls get this secret, at most 32, each one in projects |
limits.concurrency | integer | 4 | Calls running at once, 1 to 64. Beyond it calls fail with runner_busy |
limits.memoryMb | integer | 512 | Memory per call in MB, 128 to 65536, without swap |
limits.cpus | number | 1 | CPUs per call, 0.1 to 64 |
gcpCredentials | list | none | Project IDs whose calls get this Google Cloud VM's service account through Application Default Credentials. Each must be in projects. See Google Cloud credentials |
updates.pin | string | follow the latest release | Stay on this release, such as 0.4.0 |
api | string | https://api.zenitya.com | The Zenitya API origin. HTTPS, or HTTP on loopback only |
Each secret sets exactly one of env and file.
What calls never reach
Whatever the rules say, calls never reach 0.0.0.0/8, 127.0.0.0/8,
169.254.0.0/16 (link-local and cloud metadata), 100.100.100.200 and
168.63.129.16 (Alibaba and Azure host endpoints), 224.0.0.0/4,
240.0.0.0/4, 10.200.0.0/16 (the calls' own network), any address of the
runner machine itself, or IPv6. The calls of a project in gcpCredentials are
the one exception: at 169.254.169.254:80 and metadata.google.internal they
reach the runner's own metadata server, which passes on only the service
account's credentials and the project ID. A cidr rule overlapping the fixed ranges is
an error; a host name that resolves to any of them gets no answer for those
addresses.
Calls reach allowed destinations over TCP only. DNS answers only the host
names in egress, with IPv4 addresses, each valid for a minute after the
lookup; any other name does not exist.
Commands
Run them as root, except version, config check and logs for a member of
the systemd-journal group.
| Command | What it does |
|---|---|
zenitya-runner enroll --token zrt_… | Generates the machine key, enrolls it with a single-use token, installs and starts the service. install.sh runs it |
zenitya-runner status [--json] | The runner and organization IDs, the key's fingerprint, the connection, running calls, the release, and whether the policy changed since the service started |
zenitya-runner config check [--json] | Validates the policy and summarizes it. --json prints it parsed, with secret sources, never values |
zenitya-runner restart | Applies the policy. First makes the service's start checks, local secrets and permissions included; if they pass, restarts it once its running calls end |
zenitya-runner logs | The service's events, readable. -f follows, --errors keeps failures, --since "1 hour ago", --json for tools |
zenitya-runner logs --attempt <id> | Every field of one call's event, by its attempt ID or how it starts |
zenitya-runner update [--version X.Y.Z] | Installs the pinned, latest or given release; the service switches once its running calls end. --check only reports |
zenitya-runner uninstall --yes | Stops and removes the service, the machine key, its state, network setup and the user it created. Keeps the policy |
zenitya-runner version [--json] | The release, and with --json the IDs of the job keys it trusts |
zenitya-runner run is what the service runs. Every command takes --config
and --state for other paths. Errors print as error[CODE]: detail, and
--json output goes to stdout.
Files
| Path | What it is |
|---|---|
/etc/zenitya-runner/config.yaml | The policy. Root's, writable by no one else |
/etc/zenitya-runner/environment | NAME=value lines for env: secrets. Root's, readable by no one else |
/var/lib/zenitya-runner | The machine key, identity and artifact cache. Root only |
/usr/lib/zenitya-runner/<version> | A release: the runner, runsc and the calls' read-only root file system. current names the one in use |
/usr/local/bin/zenitya-runner | Links to the release in use |
zenitya-runner.service | The systemd unit |
The service runs as root, since it creates network namespaces, nftables rules
and gVisor sandboxes, with only the capabilities those need. What calls talk
to on the network (their egress proxy, DNS server and metadata server) runs
apart from it, as the unprivileged zenitya-runner user, with no capabilities.
The service creates that user and its group when it starts, and refuses to
start while a user or group of that name exists that it did not create;
uninstall removes them. The gateway can read what any local user can, such
as config.yaml, so keep file: secrets readable by root only.
The service refuses to start (insecure_permissions) while the policy, the
release's runsc or root file system can be changed by anyone but root, or
the environment file or state directory can be read by anyone but root.
Call failures
What an agent or zya exec gets when a call on a runner fails:
| Code | Meaning |
|---|---|
runner_unavailable | The runner is not connected, or was revoked. Nothing ran |
runner_busy | The runner is running limits.concurrency calls. Nothing ran |
runner_restarting | The runner is restarting, into an update or to apply its policy. Nothing ran; retry in a few seconds |
runner_refused | The policy does not list the project, or a local secret has the name of a project secret. Nothing ran |
runner_outdated | The runner's release is too old for this call (calls need 0.7.0 or later). Nothing ran. Update it |
runner_outcome_unknown | The runner disconnected during the call; it may or may not have run. It is never run again on its own |
timeout | The call ran past its deadline and was stopped |
Service errors
Why the service would not start, or stopped. zenitya-runner logs --errors
shows them with details.
| Code | Meaning |
|---|---|
not_enrolled | No machine key or identity. Enroll with a token |
invalid_config | The policy is invalid, or a local secret cannot be read |
insecure_permissions | A file the runner relies on is open to others; the detail names it and the fix |
sandbox_unavailable | runsc, the root file system, nftables or cgroup v2 is missing, or the zenitya-runner user could not be created, or a user or group of that name exists that the runner did not create |
gateway_failed | The process answering calls on the network stopped. systemd starts the service again |
revoked | The runner was revoked, which is permanent. It stays stopped |
key_replaced | Another machine enrolled for this runner. It stays stopped |
unknown_runner | Zenitya does not know this runner as enrolled. It stays stopped |
runner_outdated | Zenitya needs a newer release and the update failed, or updates.pin holds an older one. It stays stopped |
A runner that stays stopped exits with status 3, which systemd does not restart. What brings it back:
revoked: nothing. Create a new runner, run its install command on the machine, which enrolls and starts the service, and move the projects to it.key_replaced: choose Enroll again on the runner's page and run the install command it shows.unknown_runner: if the runner's page shows it revoked, as forrevoked; otherwise as forkey_replaced.runner_outdated:sudo zenitya-runner update, or raiseupdates.pin, thensudo systemctl start zenitya-runner.
Logs
The service writes one JSON event per unit of work to the journal, never a call's input, output or secret values:
| Event | When |
|---|---|
startup | The service starts: its release, policy summary and sandbox, or why it could not start |
handshake | Each connection attempt |
connection | A connection ends: how long it lasted, how many calls, why it closed |
job | A call ends: tool, project, exit code, memory and CPU used, and what it reached for or was refused |
prefetch | An artifact downloaded before its first call |
update | A release applied or failed |
shutdown | The service stops, and why |
zenitya