S04-05 - Helper Programs
Purpose: The programs that run once for an image build or a store operation:
wb-guestadmin, wb-release-check, wb-download and wb-build-ssh.
Design
Section titled “Design”The guest admin password has a process of its own
Section titled “The guest admin password has a process of its own”- the admin side of an image build;
- rotating
wbadmin’s password at each VM’s first contact; - removing the items of images and system disks that are gone, including the old item when a VM’s system disk is replaced.
It may touch the wbadmin/* items in the secret store and nothing
else. wb-hostd starts it through wb-launcher for one run, and it
exits when that run ends.
wb-guestadmin’s channels
Section titled “wb-guestadmin’s channels”Its channels are:
- pipes to the build’s
wb-vmdandwb-build-ssh, whose read endswb-launcherhands over at spawn; - one host-guest connection to
wb-guestd, whichwb-hostdhaswb-vmdopen for it.
It only writes to that connection, so it parses nothing from the guest.
Before it writes, it checks with LOCAL_PEERPID that the connection’s
peer is Virtualization’s service process. It refuses any other
descriptor.
It doesn’t talk to wb-proxyd. Its requests carry only item names, in
the fixed format of S15-03-access-rulesS15-03-access-rules: Access RulesHow each host process gets only the credentials it needs, for only as long as it needs them, and which process may access which item.. wb-launcher and
wb-guestadmin both check that format.
A compromised wb-hostd can still keep a read end of a build pipe, and
so read that build’s password, because a pipe has no peer to check.
That password is burned at the build VM’s first contact, and the
residual stays limited to builds.
wb-guestadmin’s profile
Section titled “wb-guestadmin’s profile”wb-guestadmin confines itself at start the same way, from a
compiled-in profile (X23-sandboxed-daemonsX23-sandboxed-daemons: Self-sandboxed Go daemons on macOSCan wb-netd, wb-proxyd and wb-hostd confine themselves at start with a sandbox profile, as S04-architecture says, while the Go runtime, inherited descriptors, and Keychain and Secure Enclave access in wb-proxyd keep w…, X25-vmd-sandboxX25-vmd-sandbox: Self-sandboxed `wb-vmd`Can wb-vmd confine itself at start with a Seatbelt profile that allows the Virtualization framework, its VM bundles under <data>/vms and nothing else, and still create, start, save and restore a macOS VM?).
- The profile allows the secret store service for its
wbadmin/*items, and its inherited descriptors. - It denies files, the network, and starting programs.
wb-launcher has one fixed entry per run kind. A request then never
chooses what it does. The entries are:
wb-guestadmin-build;wb-guestadmin-rotate;wb-guestadmin-cleanup, which removes the items of builds, images and system disks that are gone. S15-03-access-rulesS15-03-access-rules: Access RulesHow each host process gets only the credentials it needs, for only as long as it needs them, and which process may access which item., rule 8, says whenwb-hostdstarts it. The end of each build is one of those times.
wb-release-check
Section titled “wb-release-check”wb-release-check checks a Claude Code release for an image build
(S14-01-installS14-01-install: InstallHow the image build downloads Claude Code on the host, checks it, and installs it in the guest image, and which version a guest runs.). wb-launcher has one fixed entry,
wb-release-check, with no profile parameter.
Its start interface:
- no arguments, and an empty environment, which it doesn’t read;
- descriptor 2, its log pipe;
- descriptor 3, the result channel: a connected Unix-domain stream
socket, because
wb-hostdwrites the request on it andwb-release-checkwrites the record back; - descriptors 4, 5 and 6: the manifest, the signature and the binary,
each a regular file open for reading only. It reads them from offset
0 with
pread.
It confines itself first thing, from a compiled-in profile:
- The profile allows nothing, since its inherited descriptors don’t need a rule.
- It denies files, the network, the secret store and starting programs.
Then it:
- checks its descriptors. A descriptor missing, of another type or
open another way, or one open past 6, is refused with
release-check-descriptor-invalid, and it exits without a record; - exchanges version records with
wb-hostdon the channel (S04-08-records-and-boundsS04-08-records-and-bounds: Records, Versions and BoundsThe records daemons send wb-hostd, the build version rules between processes, the bounds on host work a guest can cause, and logs., “Between host processes”); - reads the requested version, one line in the form of S17-04-restore-and-releaseS17-04-restore-and-release: Restore Image and ReleaseThe steps by which wb-download and wb-hostd fetch and check a macOS restore image and a Claude Code release., “The version”;
- runs the checks;
- writes one record to the channel and exits:
passand the manifest’s signed SHA-256 checksum for the guest’s platform as 64 lowercase hex digits, orfailand the rule of the check that failed. Each is one line.
internal/releasecheck/record holds the request, the record’s writer
and the reader’s form check, apart from the check’s parsers, so
wb-hostd imports the reader without them.
wb-hostd reads the channel with plain reads and takes no descriptor
from it. A descriptor that wb-release-check sends on the socket is
then never received.
wb-download
Section titled “wb-download”wb-download fetches what an image build needs
(S17-03-downloadsS17-03-downloads: DownloadsHow wb-download fetches what an image build needs from the internet.). wb-launcher has three fixed entries,
wb-download-restore, wb-download-claude and wb-download-clt.
Each has its hosts compiled into the program. A request then never names a host or
a URL.
Its compiled-in profile is the network part of the wb-proxyd profile
that X23-sandboxed-daemonsX23-sandboxed-daemons: Self-sandboxed Go daemons on macOSCan wb-netd, wb-proxyd and wb-hostd confine themselves at start with a sandbox profile, as S04-architecture says, while the Go runtime, inherited descriptors, and Keychain and Secure Enclave access in wb-proxyd keep w… measured for I61I61 (closed): X23-sandboxed-daemons: wb-proxyd profile with Keychain and Secure EnclaveSplit from #34 (X23-sandboxed-daemons) during triage on 2026-10-04., limited to TCP port 443.
It allows:
- name lookups;
com.apple.trustd.agentand the metadata of the app bundle’s directory, for certificate checks;- the routing table
sysctlread thatgetifaddrsmakes, for the upstream address rule; - its inherited descriptors.
It denies files, the secret store and starting programs.
wb-download sets its entry’s file size limit (RLIMIT_FSIZE), soft
and hard, on itself first thing, before it reads anything
(S17-03-downloadsS17-03-downloads: DownloadsHow wb-download fetches what an image build needs from the internet., “Entries”). It can’t raise the hard limit again.
That limit bounds what a run writes.
wb-build-ssh
Section titled “wb-build-ssh”wb-build-ssh runs the image build’s one SSH session
(S15-04-guest-adminS15-04-guest-admin: The Guest Admin UserHow the host keeps the password of the guest admin user wbadmin, from the image build to each VM's first contact., “The build’s SSH session”). It is a fixed start of
wb-launcher like the others: no arguments, a fixed environment, and
only the descriptors wb-hostd hands it. It inherits:
- the read end of
wb-guestadmin’s pipe, as its standard input; - the connected socket to the build guest’s port 22;
- its log pipe to
wb-hostd.
The socket comes from wb-netd, which opens that one connection for
the build VM only (S07-18-build-networkS07-18-build-network: Build NetworkThe build VM's network: what its wb-netd serves, the one connection to the guest's port 22, and its refusal for session VMs.). The
host has no route to the guest, so no other process can open it.
wb-netd passes it to wb-hostd on its control channel, and
wb-hostd hands it to wb-launcher with the start request.
wb-hostd reads that message with the checks of
S07-05-stream-hand-offS07-05-stream-hand-off: Stream Hand-offHow wb-netd hands each stream to wb-proxyd, and the checks that keep a compromised wb-netd from widening what a stream may reach., “Message form”, in the same receiver
(fdchan). It refuses the socket when it comes from another VM’s
wb-netd, when no build waits for it, when the message doesn’t hold
exactly one descriptor, or when the descriptor isn’t a Unix domain
SOCK_STREAM socket. It then closes the message’s descriptors and
logs build-socket-refused. It logs an accepted socket with
build-socket-accepted, the build and the VM generation.
wb-build-ssh speaks SSH in its own process, with Go’s SSH library
(golang.org/x/crypto/ssh). It doesn’t start a program. It doesn’t
read the host user’s SSH configuration, known-hosts file or keys.
It confines itself first thing, from a compiled-in profile:
- The profile allows its inherited descriptors.
- It denies files, the network, the secret store and starting programs.
Then it:
- checks that the socket is a connected Unix domain
SOCK_STREAMsocket, and refuses to run withbuild-ssh-socket-refusedotherwise; - reads one line, the build password, from its standard input;
- logs in as
wbadminwith that password, offering password authentication only, and not a key, an agent or keyboard-interactive; - starts one session, with no terminal, that runs the commands
compiled into it: they install
wb-guestdand write cron’s and at’s allow files (S06-02-image-buildS06-02-image-build: Image BuildHow wb image build makes a guest image: the build VM, its two provisioning stages, terminfo, sealing, and storage., “Provisioning stages”). Each file is written withinstall, which removes a file or link at the target first, and then compared withrootand a newline. The first command that fails stops the commands and fails the session; - writes the password and a newline into that session’s standard
input, for the guest’s
sudo -S, and closes it, so the install commands run under onesudo -S; - exits with the session’s result.
Deadlines
Section titled “Deadlines”Go’s SSH library doesn’t set a deadline on a socket it didn’t dial. So
wb-build-ssh sets its own, and each ends the run with its rule:
| Limit | Time | Rule |
|---|---|---|
| Handshake and login, from the start | 30 s | build-ssh-login-timeout |
| No byte from the guest during the session | 2 minutes | build-ssh-idle-timeout |
| The whole session | 15 minutes | build-ssh-deadline |
It reads at most 1 MiB of session output in total. More ends the run
with build-ssh-output-limit. The build fails on each of these
(S15-04-guest-adminS15-04-guest-admin: The Guest Admin UserHow the host keeps the password of the guest admin user wbadmin, from the image build to each VM's first contact., “The build’s SSH session”).
What reaches the log
Section titled “What reaches the log”Every byte it reads from the socket comes from the guest.
- Session output.
wb-build-sshreplaces each copy of the password in the whole output stream, and carries a partial match at the end of one read into the next. Only then does it cut each line to a fixed length and write it to its log. - Other guest strings. The server version, the disconnect text and the error text of the SSH library are escaped and cut as S07-02-packet-pathS07-02-packet-path: Packet PathHow wb-netd carries the guest's frames: the packet transport, the stack, the link filter, its caps, addressing, the MTU and connections., “Events and rate limits”, says, and the password is replaced in them too.
- The banner. It is discarded and never logged.
wb-build-ssh never writes the password to its log, its arguments or
its environment.
Decisions
Section titled “Decisions”wb-guestadmin runs apart from wb-hostd
Section titled “wb-guestadmin runs apart from wb-hostd”- Why: least privilege.
wb-hostdruns the host-guest socket handlers, and so never reads a credential.
Go’s SSH library, not the system ssh
Section titled “Go’s SSH library, not the system ssh”wb-build-ssh speaks SSH with golang.org/x/crypto/ssh in its own
process.
- Why: the connection exists only as the socket
wb-netdhands over. OpenSSH closes inherited descriptors above standard error at start, and its proxy options would need another helper program. The library uses the socket as it is, reads none of the host user’s SSH configuration, and doesn’t need an askpass program. - Rejected: the system
sshwith awb-askpasshelper. It needed a second program in the bundle, an exception to the fixed starts ofwb-launcher, and a two-line framing of the password on standard input.
Status: Draft