Skip to main content
TLS inspection lets microsandbox inspect HTTPS traffic. This enables URL policy checks, request logging, and secure secret injection for matching hosts.

How it works

When interception is enabled, microsandbox:
  1. Loads an interception certificate authority, or CA.
  2. Adds that CA to the guest’s trust store.
  3. Creates a certificate for each intercepted host.
  4. Opens a separate verified TLS connection to the upstream server.
Creating a local sandbox with interception enabled generates a dedicated CA unless you supply one. The private key stays in host storage. The guest receives the public certificate at /.msb/tls/ca.pem. Existing sandboxes that use the shared CA at ~/.microsandbox/tls/ca.{crt,key} continue to use it. If you supplied a CA, keep its certificate and key available at the configured paths. For new local sandboxes, relative paths to upstream CA certificates and interception CA certificate/key files are resolved when the sandbox is created and saved as absolute paths. Starting the same sandbox from another working directory does not select different TLS files. Existing saved sandboxes with relative TLS paths retain their previous resolution behavior. They remain usable without recreation, and restart does not rewrite their saved paths.

Moving a full snapshot to another machine

An installed full checkpoint can retain a dedicated sandbox CA. Its signing key is sealed with a wrapping key in the source microsandbox home and bound to the captured checkpoint. Back up the checkpoint with an age recipient before removing that home or its wrapping key. A plaintext export omits signing keys. To transfer a dedicated CA, export to the destination’s age X25519 public key. On the destination, import with the matching private identity file and restore the imported group.
The destination seals the imported credential under its own wrapping key. If the group already contains a plaintext copy of that checkpoint, importing its encrypted backup attaches the verified signer in the same transaction as the rest of the batch. Repeating the import preserves the installed signer. A signer-only import keeps the current head selection unless you explicitly pass --set-head. A holder of a matching age identity can recover the sandbox signing key from the backup. Keep recipient identities private. A source that uses a custom or historical machine-wide CA requires a matching signer supplied separately. Full restore also requires compatible guest architecture and runtime support. Configure destination network policy and upstream certificate trust for the new host.

Connections after a full restore or fork

A full snapshot includes guest memory. The host proxy and upstream server each hold connection state outside the guest. On a supported guest, full restore and fork close inherited external TCP connections before the restored workloads resume. Applications can then open fresh connections. An older guest produces a warning and an existing read may wait for its application timeout. A server might already have processed a request when the snapshot was taken. Microsandbox does not replay it. For a request such as a payment or a job submission, check its outcome or use the service’s idempotency mechanism before retrying. An ordinary pause and resume of the same VM does not trigger this reset.

Enabling interception

Enable interception with the default settings as shown below. Configuring TLS options also enables it, so no separate shortcut is needed when setting bypass hosts or custom certificates.

Trusting certificates in applications

Applications with their own certificate stores may need extra setup. We provide msb-trust.sh, a helper script that configures common applications to trust the Microsandbox TLS CA. Save it as ./msb-trust.sh, copy it into the sandbox, and run it after boot.
The examples use all to configure supported applications whose tools are installed and report missing prerequisites. To choose specific applications, run sh /msb-trust.sh --help for the supported names, then pass one or more names instead of all. The helper tries every selected application and returns an error if any cannot be configured.
Missing your application? PRs are welcome. We consider broad usefulness and maintenance effort when deciding which applications to support.

Bypass patterns

Some clients trust a specific certificate or public key instead of the guest’s trust store. Interception will fail for these clients. Add their hosts to the bypass list. Exact domains such as api.example.com and wildcards such as *.apple.com are supported. Bypassed traffic stays encrypted between the guest and upstream server, so content-based policy checks and secret injection do not apply.

Upstream CA trust

The proxy verifies upstream certificates against host trust by default. On Windows, native chain validation follows Windows trust policy and can retrieve approved roots and issuers when that policy allows it. Other platforms load the host’s native root certificates. Certificate and hostname checks remain enabled unless you explicitly override verification. Additional CA certificates apply only to the configured upstream connections; they are not installed in the host’s trusted root store. You can add:
  • a CA trusted for every intercepted host
  • a CA trusted only for matching hosts
  • a host pattern that skips upstream verification
For HTTPS to an IP address, clients usually omit SNI. Interception uses the original destination IP for the certificate and policy checks. Self-signed upstreams still need a trusted CA and a certificate valid for the requested IP, or a scoped verification override; curl -k inside the guest only disables verification of the guest-facing certificate. Skipping verification is similar to using curl -k. Use it only for hosts you control and only when a trusted CA is not available.

Limits

  • Clients that pin certificates or public keys must be bypassed.
  • Bypassed traffic cannot use content-based policy checks or secret injection.
  • microsandbox does not proxy guest client certificates. Bypass hosts that require guest mTLS.
  • microsandbox does not intercept QUIC and HTTP/3 traffic.

Trusting host CAs

Corporate proxies often replace server certificates with certificates signed by a company CA. The host trusts that CA, but a sandbox normally does not. Commands such as apk update, pip install, and curl can then fail with a certificate error. Enable host CA trust to copy trusted host roots into the guest when it starts:
Host CA trust gives the guest every root certificate trusted by the host. Enable it only when you trust the host’s CA store.
Host CA trust can be used alongside TLS inspection. Enable both when connections that bypass inspection, such as Postgres or Redis over TLS, also need to trust your host’s certificates.

Reference

For exact TLS and network APIs, see TypeScript, Rust, Python, or Go. For CLI fields and flags, see Sandbox configuration and Sandbox commands.
  • DNS explains DNS policy and DNS over TLS.
  • Proxies explains routing outbound TCP and non-DNS UDP through an external SOCKS proxy.
  • Network defenses explains SSRF protection.
  • Secret handling explains credential injection.