S09-07 - CA Certificates
Purpose: The profile and scope of each TLS inspection CA, the leaf certificates it signs, and its rotation.
Design
Section titled “Design”CA profile
Section titled “CA profile”basicConstraintscritical, withCA:TRUEandpathLen:0;keyUsagekeyCertSignonly;- no extended key usage.
Each VM has its own CA, and two from day 30 of each CA on (“Lifetimes”). So a leaf signed for one VM isn’t trusted in another.
A CA is trusted only inside guests, never on the host.
The CA certificate has no name constraints.
Leaf issuance
Section titled “Leaf issuance”What limits the names a CA vouches for is wb-proxyd. It signs a leaf
only:
- for the hostname of the stream, after the SNI check;
- when the VM’s effective policy inspects that host (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., and 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., “Name binding” and “Modes, per host”).
It signs with the CA of the stream’s VM. It keys its leaf cache on VM, CA and hostname.
A pass-mode stream is relayed unchanged, and wb-proxyd doesn’t sign a
leaf for it. Any other stream that fails this rule is reset, and logged
with the rule.
wb-proxyd refuses a leaf with ca-leaf-refused, and the reason, when:
- the hostname isn’t a DNS name in canonical form, or is a wildcard or an IP address;
- the stream’s policy doesn’t inspect its host and port: a pass host, plain HTTP, a raw TCP entry, or a port outside every endpoint. The leaf issuer checks this against the policy itself, apart from the stream checks before it;
- the VM has no CA set, or the stream’s generation isn’t the CA set’s;
wb-hostdhasn’t accepted the CA set’s generation (“Messages”);- the signing CA has expired;
- the signature fails.
A VM with no signing CA is refused with ca-not-installed
(“Rotation”), and one whose CA didn’t restore with the rule of the
restore (S09-06-ca-keysS09-06-ca-keys: CA KeysHow the key of each TLS inspection certificate authority is made, stored and restored, and when a CA is valid., “Restore”).
Parallel requests for one hostname that isn’t cached wait for the first one’s signature, so each new leaf is signed once. Signing is bounded by the stream admission caps (SEC13-bounded-resourcesSEC13-bounded-resources: Bounded resourcesCPU, memory and disk of each VM are capped.): one request per stream, after its first-byte and SNI checks, so at most the hand-off socket’s stream cap at once per VM. The names that need a signature are bounded by the policy’s names and the wildcard budget of S07-03-dnsS07-03-dns: DNSHow wb-netd answers the guest's DNS queries: synthetic addresses, the name form, negative answers and the wildcard budget..
Leaf profile
Section titled “Leaf profile”- Exactly one
dNSNamesubject alternative name, equal to the stream’s hostname. It has neither a wildcard nor an IP address name. CA:FALSE.- Extended key usage
serverAuth. - A validity within the signing CA’s.
Not on the host
Section titled “Not on the host”wb-proxyd’s pool of roots for upstream connections never includes a
Wraith Box CA, whatever the host’s trust store holds.
Lifetimes
Section titled “Lifetimes”- Leaf certificates: 24 hours, cut to the signing CA’s end, cached in memory.
- CA: 60 days, rotated with an overlap.
wb-hostd schedules each step. wb-proxyd issues, switches and
deletes key items.
Messages
Section titled “Messages”wb-hostd sends each step to wb-proxyd over the control channel
(S04-architectureS04-architecture: ArchitectureName the processes, the boundaries between them, and which requirement each boundary serves., “Control channels”). Each request has its reply:
CaIssuenames the VM and a new CA id, 32 lowercase hexadecimal characters.CaIssuedgives the CA certificate after the round trip of S09-06-ca-keysS09-06-ca-keys: CA KeysHow the key of each TLS inspection certificate authority is made, stored and restored, and when a CA is valid., “Issue”, or the rule it failed with.CaSetgives the VM’s CAs fromwb-hostd’s record, at most three certificates of at most 1024 bytes, with the generation and the signing CA, or none withca-not-installed.wb-proxydrestores each CA it doesn’t hold. It repliesCaLoaded, orCaRestoreFailedwith the CA and the rule.CaAcceptfollows the recorded install (step 7 of “Boot, restore and host wake”). Before the first accept of a CA set’s generation,wb-proxydrefuses the VM’s inspected streams.CaRemovelists at most 64 key items of the removal list. If any entry isn’t a CA item of a VM slot, or names a CA in a VM’s CA set,wb-proxydrefuses the whole batch withca-removal-refusedand each such entry’s index and check, and deletes none. Otherwise it deletes each item.CaRemovedlists those it deleted, an item already gone among them.
A CaSet of an older generation, or a CaAccept of a generation that
isn’t the VM’s CA set’s, ends the control channel.
Rotation
Section titled “Rotation”Days count from the current CA’s issue.
- Day 30.
wb-proxydissues the successor with a new key.wb-guestdinstalls it next to the current CA.wb-hostdrecords the install whenwb-guestdreports it. - Day 58.
wb-proxydsigns with the successor, but only once its install is recorded. Until then it refuses the VM’s inspected streams, with the ruleca-not-installed. A guest that doesn’t report the install only cuts off its own traffic. - Day 60. The old CA expires.
wb-guestdremoves it from the trust files, and from the system trust store where the guest has one (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.).- Its key goes on the removal list (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., “Declared access”): the item, or on Windows the named key.
wb-proxyddeletes it.
wb-proxyd never signs with an expired CA. That is what revokes the
CA: a guest that keeps trusting it gets no leaf signed by it.
Overlap
Section titled “Overlap”A process that started before the successor was installed works until the switch, 28 days later. Only a process that runs longer than that, and never rereads its trust, fails, with a certificate error. Time the VM spends saved counts toward that bound.
Boot, restore and host wake
Section titled “Boot, restore and host wake”On every boot, every restore from saved state and every host wake, these run in this order:
wb-guestdsets the guest clock fromwb-hostd(S06-06-devices-and-warm-startS06-06-devices-and-warm-start: Devices, Warm Start and TimeA VM's devices and resources, saving and restoring its state, and how the guest clock follows the host., “Time and sleep”).- A CA that has expired is removed, and its key item goes on the removal list.
- A step of the schedule that came due while the VM was off or the host slept runs.
- If the record has no CA, or every CA in it has expired,
wb-proxydissues a new one. wb-guestdinstalls the VM’s current CAs fromwb-hostd’s own record, never from what the guest reports it has.wb-hostdrecords the install.- Only then does
wb-proxydaccept the VM’s streams.
A recorded CA whose key doesn’t restore is refused with
ca-key-restore (S09-06-ca-keysS09-06-ca-keys: CA KeysHow the key of each TLS inspection certificate authority is made, stored and restored, and when a CA is valid., “Valid CA”). It doesn’t lead to a new
one.
After a restore or a host wake, wb-proxyd keeps signing with the CA
it signed with before the save or the sleep. It does so also past day
58, while that CA is valid, because resumed processes loaded their
trust before it.
Each of these is a Device Config State Change (5019) event, with the VM and the CA certificate’s SHA-256 fingerprint (SEC10-auditSEC10-audit: AuditEvery egress decision, approval, and returned change is recorded on the host in a persisted log the guest cannot alter.):
- issuing a CA;
- its install;
- the signing switch;
- its removal;
- an install
wb-guestdrefuses or doesn’t report.
Decisions
Section titled “Decisions”No name constraints on the CA
Section titled “No name constraints on the CA”- Why: the set of inspected hosts changes with every approval (S07-17-approvals-and-learningS07-17-approvals-and-learning: Approvals and LearningHow an unknown destination reaches the user as an approval request, what an approval grants, and how learn mode collects names.). A constraint that followed it would need a new CA each time. Clients that read trust once per process would then reject every leaf from the new CA until they restart.
- Rejected: a broad constraint that never changes. It limits nothing that leaf issuance doesn’t already limit. RFC 5280 requires the extension to be marked critical, so a client that doesn’t support it rejects the CA.
- Decided: I39I39 (closed): S09-policy-credentials-audit: CA name constraints and rotation versus live policy changes- S07-egress-gateway "Approvals": "Policy changes take effect without restarting anything." - S09-policy-credentials-audit "Scope": the CA has name constraints for the inspected hostnames, and "when the inspected set… (B39-ca-rotationB39-ca-rotation: Can an approval add an inspected host without breaking running tools?Only if the inspection CA stops changing with the set of inspected hosts.).
Rotate the CA every 60 days, with an overlap
Section titled “Rotate the CA every 60 days, with an overlap”-
Why: the hardware key can’t be read out. But on every host, another process of the user can sign with it, or with a copy:
- the wrapped key on macOS, which still signs on the same Mac after
wb-proxydremoves the item; - the CNG key on Windows, which opens by its name;
- the TPM blob or the software fallback key on Linux.
Rotation bounds how long that is useful, to at most 60 days. Only that VM’s guest trusts the CA. The thief also needs a position in that guest’s traffic, which runs only through the host.
- the wrapped key on macOS, which still signs on the same Mac after
-
Overlap: it keeps rotation from breaking running tools. Of the clients X04-tls-inspectionX04-tls-inspection: Inspection compatibilityGo-based, Swift-based, and Xcode clients accept a CA that only the guest trusts. tried, only Python’s
requestsrereads its CA file while it runs. Go, Node, Python’surllib, Ruby and Java keep the trust they read at start. The clients it didn’t test are assumed to do the same. So the overlap bounds their life, as “Overlap” says.
Status: Draft