Skip to content

S09-07 - CA Certificates

Purpose: The profile and scope of each TLS inspection CA, the leaf certificates it signs, and its rotation.

  • basicConstraints critical, with CA:TRUE and pathLen:0;
  • keyUsage keyCertSign only;
  • 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.

What limits the names a CA vouches for is wb-proxyd. It signs a leaf only:

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-hostd hasn’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..

  • Exactly one dNSName subject 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.

wb-proxyd’s pool of roots for upstream connections never includes a Wraith Box CA, whatever the host’s trust store holds.

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

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:

  • CaIssue names the VM and a new CA id, 32 lowercase hexadecimal characters. CaIssued gives 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.
  • CaSet gives the VM’s CAs from wb-hostd’s record, at most three certificates of at most 1024 bytes, with the generation and the signing CA, or none with ca-not-installed. wb-proxyd restores each CA it doesn’t hold. It replies CaLoaded, or CaRestoreFailed with the CA and the rule.
  • CaAccept follows the recorded install (step 7 of “Boot, restore and host wake”). Before the first accept of a CA set’s generation, wb-proxyd refuses the VM’s inspected streams.
  • CaRemove lists 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-proxyd refuses the whole batch with ca-removal-refused and each such entry’s index and check, and deletes none. Otherwise it deletes each item. CaRemoved lists 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.

Days count from the current CA’s issue.

  1. Day 30. wb-proxyd issues the successor with a new key. wb-guestd installs it next to the current CA. wb-hostd records the install when wb-guestd reports it.
  2. Day 58. wb-proxyd signs with the successor, but only once its install is recorded. Until then it refuses the VM’s inspected streams, with the rule ca-not-installed. A guest that doesn’t report the install only cuts off its own traffic.
  3. Day 60. The old CA expires.

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.

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.

On every boot, every restore from saved state and every host wake, these run in this order:

  1. wb-guestd sets the guest clock from wb-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”).
  2. A CA that has expired is removed, and its key item goes on the removal list.
  3. A step of the schedule that came due while the VM was off or the host slept runs.
  4. If the record has no CA, or every CA in it has expired, wb-proxyd issues a new one.
  5. wb-guestd installs the VM’s current CAs from wb-hostd’s own record, never from what the guest reports it has.
  6. wb-hostd records the install.
  7. Only then does wb-proxyd accept 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-guestd refuses or doesn’t report.

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-proxyd removes 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.

  • 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 requests rereads its CA file while it runs. Go, Node, Python’s urllib, 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