Skip to content

S09-08 - Guest Trust

Purpose: How wb-guestd makes the guest’s clients trust the VM’s CAs.

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:

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-guestd writes 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 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.

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.

wb-guestd sets the variables in the environment of:

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.

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).

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.

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)..

No CA in the macOS guest’s system trust store

Section titled “No CA in the macOS guest’s system trust store”

Status: Draft