S09-08 - Guest Trust
Purpose: How wb-guestd makes the guest’s clients trust the VM’s CAs.
Design
Section titled “Design”Guest trust
Section titled “Guest trust”The sealed image doesn’t contain a Wraith Box CA (S06-01-image-layersS06-01-image-layers: Image Layers and the Toolchain PrefixThe layers of a guest image, and the toolchain prefix that project layers install into., “Layers”). At runtime wb-guestd:
- writes the VM’s current CAs to the trust files (S09-01-policy-filesS09-01-policy-files: Policy FilesWhere policy is written, the network policy schema Wraith Box accepts, how the prover sees it, and narrowing by program and project., “Files”);
- sets the toolchain trust variables that point clients at them (“Variables”).
Common clients then accept the CAs (X04-tls-inspectionX04-tls-inspection: Inspection compatibilityGo-based, Swift-based, and Xcode clients accept a CA that only the guest trusts.).
Installing a CA means writing these files. On Linux and Windows guests
it also means adding the CA to the system trust store. On a macOS guest
wb-guestd doesn’t touch the system trust store (“System trust store”
below).
Each install writes the files whole, from wb-hostd’s record. On a
Linux or Windows guest it also removes from the system trust store
every Wraith Box CA that the record doesn’t hold. A dropped CA leaves
the guest at its next install.
wb-guestd writes three files in a fixed directory that root owns.
- The directory is
/etc/wraithbox/trust/on macOS and Linux guests, with mode 0755. - Each file has mode 0644.
wb-guestdwrites each one to a temporary file in the same directory, and renames it into place. So a client never reads half a file.- The path holds no whitespace, and no character a shell treats specially.
Project users read the directory under S13-02-filesystem-profileS13-02-filesystem-profile: Layer 2: Seatbelt Filesystem Profile (v1)The Seatbelt profile each session's process tree runs under, where it comes from, its exceptions for Xcode builds, and its known gaps., “Profile”.
The files:
- The CA file,
ca.pem: every current CA of the VM, as PEM, in the order of the request. - The bundle,
bundle.pem: the guest’s public roots (/etc/ssl/cert.pemon macOS) and every current CA.wb-guestdrebuilds it from the current public roots on every write. A variable that replaces a client’s roots points here, because pass hosts and raw TCP relays present public certificates (S07-07-hosts-and-modesS07-07-hosts-and-modes: Hosts and ModesHow wb-proxyd binds a stream to its name, which upstream addresses it refuses, and the inspect, pass and audit modes., “Modes, per host”). - The Java trust store,
java-truststore.p12: a PKCS12 file without a password, with the same certificates as the bundle.wb-guestdbuilds it itself, in Go, withsoftware.sslmate.com/src/go-pkcs12(S10-01-librariesS10-01-libraries: LibrariesThe libraries and programs Wraith Box uses, and their licenses.). Neither the standard library norgolang.org/x/crypto/pkcs12can write PKCS12.
The bundle holds the public roots as wb-guestd parsed them, encoded
again as PEM, and then the CAs. A block that isn’t a certificate, or a
certificate that doesn’t parse, is left out, and the install log counts
it. A roots file that isn’t a regular file, is over 4 MiB or doesn’t hold a
root that parses fails the install.
Install
Section titled “Install”wb-guestd checks the request before it writes anything. It takes 1 to
3 certificates, each a DER X.509 certificate that parses, with
CA:TRUE, a P-256 public key, and no two the same. It refuses anything
else with trust-install-refused.
A missing directory or parent (/etc/wraithbox/) is created with mode
0755. wb-guestd refuses with trust-dir-unsafe, and doesn’t write a
file, when:
- the parent is a symlink or not a directory, is owned by another user than root, or its group or others can write it;
- the directory is a symlink or not a directory, is owned by another user than root, or has another mode than 0755, special bits included.
It reads the public roots only when they are a regular file, so a FIFO
there can’t block the install. A call whose caller gave up, before the
install started or before the first rename, fails with
trust-install-failed and doesn’t write a file.
It writes the CA file, the bundle and the Java trust store in that
order. A failure after the checks answers with trust-install-failed
and leaves the files renamed before it in place. The next install
writes them all again. Success is an empty answer after the last
rename.
Each install logs one line with the SHA-256 fingerprint of each CA, the rule and the decision.
Variables
Section titled “Variables”wb-guestd sets the variables in the environment of:
- every project user’s processes;
- the toolchain user, for a toolchain reconcile (S06-01-image-layersS06-01-image-layers: Image Layers and the Toolchain PrefixThe layers of a guest image, and the toolchain prefix that project layers install into.,
“The environment”) and for a recipe step (S06-17-named-imagesS06-17-named-images: Named Images and RecipesThe build of a named image from a recipe on a clone of the sealed base.). On a macOS guest, Homebrew’s downloads from
inspected hosts such as
ghcr.iohave no other way to trust the CA.
Each value is built from constants. The value of JAVA_TOOL_OPTIONS is
exactly -Djavax.net.ssl.trustStore=, followed by the Java trust
store’s fixed path.
wb-guestd never appends to a value it inherits, or merges with one. A
value that a project or the user sets replaces Wraith Box’s. That client
then fails closed on inspected hosts, because it doesn’t trust the CA.
| Variable | File | Clients X04-tls-inspectionX04-tls-inspection: Inspection compatibilityGo-based, Swift-based, and Xcode clients accept a CA that only the guest trusts. saw use it |
|---|---|---|
SSL_CERT_FILE |
bundle | Go, gh, curl, Python’s ssl and urllib, uv, Ruby and gem |
REQUESTS_CA_BUNDLE |
bundle | Python requests and pip |
GIT_SSL_CAINFO |
bundle | git, and SwiftPM and xcodebuild resolving packages over git |
CARGO_HTTP_CAINFO |
bundle | cargo |
NODE_EXTRA_CA_CERTS |
CA file | Node, npm and Claude Code, which add it to their own roots |
JAVA_TOOL_OPTIONS |
Java trust store | Java, through -Djavax.net.ssl.trustStore |
Every JVM writes a line about JAVA_TOOL_OPTIONS to standard error
when it starts.
System trust store
Section titled “System trust store”On Linux and Windows guests, wb-guestd also adds the CAs to the
system trust store (S12-platformsS12-platforms: PlatformsWhich host and guest operating systems Wraith Box targets, how platform-specific code is isolated, what each platform uses, and how wb works inside WSL.).
On a macOS guest it doesn’t. macOS 27 refuses to add a trusted root without a user to confirm it (X04-tls-inspectionX04-tls-inspection: Inspection compatibilityGo-based, Swift-based, and Xcode clients accept a CA that only the guest trusts., answer 1).
Clients left out
Section titled “Clients left out”A client that reads only the system trust store doesn’t trust the CA. These are:
- URLSession, and what is built on it: Swift programs, SwiftPM’s binary target downloads, and Xcode’s own requests;
pip, when no CA variable points it at the bundle and it uses the system store by default.
X04-tls-inspectionX04-tls-inspection: Inspection compatibilityGo-based, Swift-based, and Xcode clients accept a CA that only the guest trusts. saw each of them reject the inspected leaf.
Fails closed
Section titled “Fails closed”Over TLS, these clients reach only pass hosts and raw TCP entries, never a guarded host (S07-07-hosts-and-modesS07-07-hosts-and-modes: Hosts and ModesHow wb-proxyd binds a stream to its name, which upstream addresses it refuses, and the inspect, pass and audit modes., “Modes, per host”, and S07-15-non-http-streamsS07-15-non-http-streams: Non-HTTP StreamsHow wb-proxyd checks the protocol of each stream, and what it does with SSH, other protocols and raw TCP.). Plain HTTP doesn’t need the CA.
On an inspected host such a client aborts the handshake with an alert,
or closes. wb-proxyd resets the stream with the rule
tls-client-rejected-leaf, and its record names this known gap
(S07-15-non-http-streamsS07-15-non-http-streams: Non-HTTP StreamsHow wb-proxyd checks the protocol of each stream, and what it does with SSH, other protocols and raw TCP., “Inside TLS on an inspected host”).
FR08-no-proxy-configFR08-no-proxy-config: No per-tool proxy settingsAllowlisted network destinations work for every tool without per-tool proxy configuration. names this gap. An attended step, in which the maintainer confirms trust in the guest’s UI, is I213I213 (open): Attended guest setup: let the maintainer confirm CA trust in the guest UIFollow-up to the decision on #185 (option A, accept that URLSession and pip's truststore reject inspected hosts)..
Decisions
Section titled “Decisions”No CA in the macOS guest’s system trust store
Section titled “No CA in the macOS guest’s system trust store”- Why: Wraith Box doesn’t work around the platform control that asks a user to confirm a trusted root. Virtualization framework VMs can’t enroll in MDM.
- Decided: I185I185 (closed): Decide how wb-guestd makes a macOS guest trust the per-VM CAX04-tls-inspection (#18) found that a root daemon in a macOS 27 guest can't make the system trust a CA without a user to confirm:.
Status: Draft