Skip to content

S07-07 - Hosts and Modes

Purpose: How wb-proxyd binds a stream to its name, which upstream addresses it refuses, and the inspect, pass and audit modes.

The hostname of a stream is the name wb-proxyd’s copy holds for the synthetic address (S07-06-name-mappingS07-06-name-mapping: Name MappingHow wb-proxyd keeps its own checked copy of the names wb-netd gave synthetic addresses: name reports, releases, replay, lifetime, the second count of the wildcard budget, and the copy wb-hostd keeps.).

wb-proxyd resolves the real upstream address itself.

This rule serves SEC05-default-denySEC05-default-deny: Default-deny egress, enforced on the hostOnly allowlisted hostnames are reachable.. It applies to each connection wb-proxyd opens:

  • upstream streams in every mode: inspect, pass and raw TCP;
  • its own fetches, such as following a Go module proxy redirect, the ghcr.io token fallback and OSV lookups.

wb-proxyd refuses the connection when any address the name resolves to is in one of these ranges:

  • IPv4:

    • unspecified and “this network” (0.0.0.0/8);
    • loopback (127.0.0.0/8);
    • RFC 1918 (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16);
    • CGNAT (100.64.0.0/10);
    • link-local (169.254.0.0/16);
    • IETF protocol assignments (192.0.0.0/24);
    • multicast (224.0.0.0/4);
    • reserved (240.0.0.0/4, broadcast included);
    • the synthetic range (198.18.0.0/15).
  • IPv6: unspecified (::), loopback (::1), link-local (fe80::/10), the deprecated site-local range (fec0::/10, RFC 3879), unique local (fc00::/7) and multicast (ff00::/8).

  • An IPv4 address embedded in IPv6:

    • IPv4-mapped (::ffff:0:0/96) and IPv4-compatible (::/96) addresses;
    • the well-known NAT64 prefix (64:ff9b::/96);
    • the local-use NAT64 prefix (64:ff9b:1::/48), refused whole. Where it carries the IPv4 address depends on how the network splits it, which wb-proxyd can’t know;
    • 6to4 (2002::/16) and Teredo (2001::/32). The whole 6to4 and Teredo prefixes are refused, whatever address they embed.
  • The host’s own networks, at connect time:

    • any address assigned to a network interface of the host;
    • any address in the on-link prefix of one of the host’s interfaces.

    This covers the host’s own public addresses, and a LAN that uses global IPv6 addresses.

wb-proxyd connects only to an address it checked. It never resolves the name again between the check and the connect.

A refused connection is logged with the host, the address, and the rule upstream-address-refused (SEC10-auditSEC10-audit: AuditEvery egress decision, approval, and returned change is recorded on the host in a persisted log the guest cannot alter.). A lookup that fails, or returns an empty answer, is refused with upstream-resolve-failed. When none of the checked addresses connects, the rule is upstream-connect-failed. Both are logged with the host, and the second with the last address tried.

So a name whose zone someone else controls can’t point a relay at the host itself, at a private or link-local network, or at a network on the host’s own links.

A network on public addresses that the host reaches through another route, such as a VPN, isn’t in these ranges. It is still reachable by name (T01-allowed-channelsT01-allowed-channels: Data through allowed channelsData sent through allowed operations to allowed destinations, for example a push to an allowed repository that is public, or prompt content sent to the model provider.). Wraith Box has no LAN opt-in in V1V1-initial: Initial versionThe first version: what it delivers, what it leaves out, and the milestones that get there..

A TLS host has one of three modes.

inspect is the default.

  1. wb-proxyd terminates TLS with a leaf certificate from the Wraith Box CA (S09-policy-credentials-auditS09-policy-credentials-audit: Policy, Credentials, Certificates and AuditWhere policy comes from, how secrets are held, how TLS inspection is trusted, and what is recorded.). It doesn’t issue session tickets, so no stream resumes a session whose leaf came from a CA that a rotation has since replaced.
  2. It applies HTTP policy and credential replacement.
  3. It opens a new TLS connection upstream, validated against the host’s system trust store, at the stream’s first request that passes its checks. It doesn’t present a client certificate.

It speaks HTTP/1.1, and HTTP/2 once I499I499 (open): wb-proxyd: HTTP/2 on inspected TLS streams, with the same request form, caps and steps as HTTP/1.1Package M3.6 of docs/implementation-plan.md, part 3 of 4 (M3.6c). adds it to both sides.

An upstream certificate that fails validation refuses the request with the rule upstream-tls-verify. Any other upstream handshake failure, such as no common TLS version, refuses it with upstream-tls-failed. A server that asks for a client certificate and then fails the handshake, or sends a certificate alert before its first byte, gives tls-client-cert-unsupported (S07-16-tls-and-tunnelsS07-16-tls-and-tunnels: TLS and TunnelsWhat wb-proxyd does with client certificates, encrypted ClientHello and tunnels, and which refusals no mode or approval relaxes.). After such a request, a timeout, or an end with no alert before the first byte, is upstream-tls-failed. Each one answers the guest’s request with a 502 that names the rule.

pass relays TLS bytes unchanged to the named host. It is only for hosts where inspection breaks the client.

The proxy can’t see what is sent. So every pass host is a residual channel (T01-allowed-channelsT01-allowed-channels: Data through allowed channelsData sent through allowed operations to allowed destinations, for example a push to an allowed repository that is public, or prompt content sent to the model provider.).

The rules for pass:

None of the clients X04-tls-inspectionX04-tls-inspection: Inspection compatibilityGo-based, Swift-based, and Xcode clients accept a CA that only the guest trusts. could test pins a certificate.

The guest’s trustd pinning rules pin Apple hosts a development guest may use. So these are expected to refuse an inspected leaf (inferred from the rules, not seen):

  • software update and the command line tools: swscan.apple.com, swcdn.apple.com, swdist.apple.com, swdownload.apple.com;
  • xcode-cdn.apple.com, mesu.apple.com, updates.cdn-apple.com;
  • gdmf.apple.com, gs.apple.com, gsa.apple.com and idmsa.apple.com.

Wraith Box never puts these hosts in pass mode itself, and the rules above apply to them. A user who does makes each one a T01-allowed-channelsT01-allowed-channels: Data through allowed channelsData sent through allowed operations to allowed destinations, for example a push to an allowed repository that is public, or prompt content sent to the model provider. channel. The Apple Account hosts (idmsa.apple.com, gsa.apple.com) then carry whatever Apple credentials the guest holds. Wraith Box neither gave nor removes them (T10-unnamed-credentialsT10-unnamed-credentials: Guest credentials in unnamed placeswb-proxyd removes Authorization, Proxy-Authorization and Cookie on every inspected host.).

On a macOS guest, clients that read only the system trust store, such as URLSession, also reject inspection. That is a known gap of FR08-no-proxy-configFR08-no-proxy-config: No per-tool proxy settingsAllowlisted network destinations work for every tool without per-tool proxy configuration., which S09-08-guest-trustS09-08-guest-trust: Guest TrustHow wb-guestd makes the guest's clients trust the VM's CAs. lists.

audit inspects, with the HTTP policy of the host and port logging a violation and letting the request through (S07-11-http-policyS07-11-http-policy: HTTP PolicyThe HTTP rules of inspected hosts, the built-in profiles, and the parts a user can turn off.).

The rules for audit:

A host is guarded when it has a credential binding, or a built-in profile covers it. A profile covers a host when:

Neither pass nor audit is allowed on a guarded host:

The rule is checked at three points. Each error names what it says below (NFR06-explained-refusalsNFR06-explained-refusals: OperabilityEvery refusal names the rule that caused it and how to change it.).

  • At load. A pass entry or an audit endpoint on a guarded host, in the global policy or a project’s policy, is refused at load. The error names the host and the reason.
  • At every recompute. wb-hostd checks the same rule over the union, whatever source set the mode, global entries included. So a global entry that loaded while no project named its host refuses the session start of a project whose remote names it. The error names that project, the host, and the file of the pass entry or audit endpoint.
  • A binding added later. A change that adds a credential binding on a pass host, or on a host with an audit endpoint, is refused. That holds in a policy file and with wb cred set. The pass entry or audit endpoint stays. The error names it and its file, and says to remove it first.

Pass names one exact host, only the user sets it, each entry has a reason, it is never on a guarded host, and each new pass host is audited.

Only the user sets audit, and never on a guarded host.

Status: Draft