Skip to content

Runners behind a corporate proxy, with the company's own certificate authority #625

Open

Description

@fctl-sh

A company whose network sends every connection through a proxy that inspects TLS can't run fctl's runners today. The host service ignores HTTPS_PROXY and trusts only Mozilla's certificate authorities, so it doesn't register or come online. In sandboxes, git, gh, npm, pip, cargo, curl and Claude Code (a Node program, which reads NODE_EXTRA_CA_CERTS) all need the company's certificate authority and proxy. Today the only way to give them both is an image of the company's own plus variables in every project, and fctl-agent's own clone and push still go without them. A runner's owner should say once, in host.toml, which proxy and certificates the machine uses, and the host should use them for its own connections and give them to every sandbox it starts.

How it works now

  • The host ignores proxies. Everything the host and the CLI fetch goes through fctl_client. HttpClient::new (crates/fctl-client/src/http.rs) wraps hyper-util's HttpConnector, and ws::connect (crates/fctl-client/src/ws.rs) calls tokio_tungstenite::connect_async_tls_with_config. Both connect directly, and Cargo.toml doesn't enable hyper-util's client-proxy feature. That covers the runner connection (crates/fctl-host/src/uplink.rs), releases from download_base (agentbin.rs, update.rs) and GitHub for image builds (build.rs). It also covers the Firecracker driver's registry pulls and downloads (driver/firecracker/registry.rs, retry.rs), and the Anthropic API where the host keeps a session's Claude token (claude_relay::Upstream::anthropic, ADR 0079). fctl login on people's own machines goes the same way.
  • What the host trusts. fctl_client::tls_config (crates/fctl-client/src/lib.rs) trusts Mozilla's roots (webpki-roots) plus any certificates in SSL_CERT_FILE. The services that fctl host install writes don't pass that variable: the launchd job sets PATH and FCTL_LOG_FORMAT, and the systemd unit FCTL_LOG_FORMAT (crates/fctl-host/src/service.rs). docs/security.md#hosts promises "rustls with the Mozilla root store", and SSL_CERT_FILE is documented only for debug builds (docs/development.md).
  • Sandboxes get nothing of the host's network. Docker and Apple container sandboxes start with run -d … --entrypoint tail IMAGE -f /dev/null, with no environment (ContainerDriver::start_new, crates/fctl-host/src/driver/container.rs). fctl-agent then has the image's environment, which Firecracker VMs pass from the image's Env (crates/fctl-agent/src/vm/serve.rs). With the process driver it has the host's (driver/process.rs). AgentConfig.env exists for "extra environment for Claude (host configuration, not secrets)" (crates/fctl-proto/src/agent.rs), but agent_config always leaves it empty (crates/fctl-host/src/session.rs).
  • Claude gets almost none of the image's environment. Claude::spawn clears it and keeps only PATH, LANG, LC_ALL, TZ, TMPDIR, USER, LOGNAME, SHELL and TERM. Then it adds the project's variables, its secrets and AgentConfig.env (crates/fctl-agent/src/claude.rs, supervisor.rs). So an image's ENV HTTPS_PROXY=… never reaches Claude or its commands (docs/sandbox-images.md#an-image-from-another-base).
  • Today's workaround takes every project. An image of the company's own adds the certificate authority to the system store, which git, curl and Python's ssl read. Maintainers then put https_proxy, no_proxy and NODE_EXTRA_CA_CERTS (a path in that image) in each project's Settings → Sandbox → Environment (ProjectSettings.env, crates/fctl-proto/src/session.rs). Those reach Claude, its commands and the setup script.
  • fctl-agent's own git doesn't get those variables. Its clone, fetch, push and gh pr view run with its own environment (workspace::run through crate::user::command, in crates/fctl-agent/src/workspace.rs and user/mod.rs). Docker's proxies in the runner's ~/.docker/config.json do reach new containers, so fctl-agent's git, but still not Claude (Docker's docs).
  • The relay chains the session's proxy, but only inside the sandbox. Where the host keeps Claude's token, fctl-agent's proxy for Claude sends every other connection through the session's https_proxy, skipping what no_proxy lists. It takes only an http:// proxy (relay::Upstream::parse). It gives Claude the session's NODE_EXTRA_CA_CERTS followed by the host's authority (start_relay in crates/fctl-agent/src/supervisor.rs; docs/architecture.md#keeping-the-token-out-of-sandboxes). The host's own connection to api.anthropic.com goes out directly.
  • Image pulls. Docker and Apple container pull images themselves, with their own settings: Docker's daemon has a proxy setting of its own. The Firecracker driver pulls through fctl_client.
  • fctl host doctor doesn't check the network (crates/fctl/src/cmd/host.rs). It covers the configuration, the tokens, reaching the server, the driver, images, disk and the service, and has no --json. A TLS failure shows as the raw error.

What should happen

  • fctl_client reaches everything through a proxy, the WebSocket included. It reads HTTPS_PROXY, HTTP_PROXY and NO_PROXY in either case, the way curl does (hyper-util's client-proxy feature has a Matcher for that). It trusts a configured certificate file besides Mozilla's roots and SSL_CERT_FILE. This step alone fixes people's CLI behind the same proxy.
  • host.toml takes a [network] table, which the host uses for all its own connections: the control plane, downloads, GitHub, registries and the relay's connection to the Anthropic API.
  • fctl host install takes --proxy, --no-proxy and --ca-file, with FCTL_PROXY, FCTL_NO_PROXY and FCTL_CA_FILE for boot scripts. It uses them for its own requests and writes them into host.toml. If the shell has proxy variables and no flags were given, it says the service won't see them and offers to keep them.
  • The host gives the settings to every sandbox it starts (AgentConfig.network). Before it clones, fctl-agent adds the certificates to the sandbox's store and sets the variables for Claude, its commands, the setup script and its own git and gh.
  • fctl host doctor checks the settings and gets --json. fctl host status shows the settings, and fctl host network shows and changes them.
  • Runners report the proxy's address and the names of the certificates they trust, never the proxy's credentials. The Runners tab and Admin → Runners show them, with an amber line for problems.
  • A clone that fails on a certificate or the proxy says so on the session page, and says who fixes it.
  • Docs and docs/llms.txt describe all of it.

The settings.

[network]
https_proxy = "http://proxy.acme.internal:3128"   # for http:// too, unless http_proxy names another
no_proxy = "localhost,127.0.0.1,.acme.internal"
ca_file = "/etc/fctl/acme-root-ca.pem"            # PEM: one or more certificates, trusted besides the usual ones

A proxy's user and password may go in its URL, which the relay already reads. Anything given to a sandbox, its agent can read: the docs and fctl host doctor say so, and suggest proxies that let machines in by their address.

In sandboxes. fctl-agent runs as root in container and VM sandboxes by default. It writes the certificates where the image's store takes them, then runs the image's own update-ca-certificates (Debian, Ubuntu, Alpine) or update-ca-trust (Fedora, RHEL). The store covers git, curl, cargo, Python's ssl, Go and other OpenSSL users. Where it can't (agent_as_root = false, or neither command in the image), fctl-agent writes a bundle of the image's certificates plus the runner's in its own directory, for the variables to point at. For everything in the sandbox it sets:

  • https_proxy, http_proxy and no_proxy, in both cases;
  • NODE_EXTRA_CA_CERTS, for Claude Code, npm and other Node programs;
  • REQUESTS_CA_BUNDLE, for Python's requests and pip, which bring their own bundle;
  • SSL_CERT_FILE, pointing at the store's bundle.

Java keeps its own keystore, which an image or setup script fills: the docs say so. The process driver uses the machine's own store and the same variables. The session's log says it once: "Runner build-7 goes through proxy.acme.internal:3128 and trusts Acme Root CA: fctl-agent added it to the sandbox's certificates."

Protocol. Two optional fields. AgentConfig.network carries the certificates (PEM) and the three proxy settings. HostHello.network carries the proxy's host:port and, for each certificate, its subject, expiry and SHA-256 fingerprint. FleetDO already keeps each runner's hello as JSON (runners.hello, crates/fctl-control/src/do_fleet.rs). The API's Runner gains the field.

Design and UX

A runner behind a company's proxy should come online with one command, and its owner should learn which connection fails, why and what to change, before any session does.

Runners are set up in a terminal, so the CLI comes first:

$ fctl host install --workspace acme --proxy http://proxy.acme.internal:3128 --no-proxy .acme.internal --ca-file /etc/fctl/acme-root-ca.pem
Network: through proxy.acme.internal:3128 (not for .acme.internal), trusting Acme Root CA (until Mar 1, 2031) besides the usual certificate authorities
✓ reaches https://fctl.acme.dev through the proxy
Registered build-7 for Acme. The host service and every sandbox it starts use this network.

$ fctl host doctor
✓ network: through proxy.acme.internal:3128, trusting Acme Root CA from /etc/fctl/acme-root-ca.pem, until Mar 1, 2031
✓ reaches https://fctl.acme.dev (Acme factory 0.38.0) through the proxy
✓ reaches https://fctl.sh/releases through the proxy, which inspects TLS: Acme Root CA signed its answer
✕ reaches https://api.anthropic.com: the proxy answered 403 Forbidden
  sessions that keep their Claude token on this runner can't reach Claude: ask your network's admins to let api.anthropic.com through
✕ sandboxes trust Acme Root CA: ghcr.io/acme/agent:3 has no update-ca-certificates or update-ca-trust
  fctl-agent gives its sandboxes a bundle of their own: tools that read only the system's store won't trust the proxy
· Docker's daemon has no proxy (docker info): it pulls only from registries it reaches directly (https://docs.docker.com/engine/daemon/proxy/)

fctl host network prints the settings as a sentence: "Through proxy.acme.internal:3128 for https and http, except localhost, 127.0.0.1 and .acme.internal. Trusts Acme Root CA besides Mozilla's certificate authorities." --json prints them as fields. fctl host network set --ca-file … (or --proxy "" to remove one) saves host.toml and restarts the service: "Saved. Restarting the host service: sessions that start from now on use it; running ones keep what they started with."

In the web app:

  • A runner's row gets one facts line, only when the runner has settings: "Through proxy.acme.internal:3128 · trusts Acme Root CA". It shows on the workspace's Runners tab and in Admin → Runners, beside RunnerImages (web/src/routes/admin.tsx). Its title gives the fingerprint and expiry.
  • A problem the host reports shows as an amber line, as driver problems do. "Its proxy refuses api.anthropic.com: sessions that keep their Claude token on runners can't reach Claude from it." "Acme Root CA, which it trusts, expires in 12 days: its owner replaces it with fctl host network set --ca-file."
  • Bring a machine online gets a third question under step 3's commands: "Behind a proxy?" It opens two fields, Proxy (http://proxy.acme.internal:3128) and "Certificate file on the machine" (/etc/fctl/acme-root-ca.pem). The install command's CodeBox gains the flags as they're typed, so it stays complete. Its hint: "fctl keeps neither: they go into the machine's host.toml." An enrollment token's boot script gains FCTL_PROXY=… and FCTL_CA_FILE=… lines the same way.
  • A clone that fails on TLS says why on the session page, not only in git's words: "git couldn't check github.com's certificate: runner build-7's network inspects TLS, and the sandbox doesn't trust its certificate authority. The runner's owner adds it (fctl host network set --ca-file)."

States:

  • No settings: nothing shows on the runner, since a direct connection isn't news. Doctor prints a dim line: "network: direct, trusting Mozilla's certificate authorities".

  • A wrong file: it's missing or unreadable ("can't read /etc/fctl/acme-root-ca.pem (No such file)"), not PEM, expired or expiring within 30 days, or a server's own certificate ("is the proxy's own certificate, not the authority that signs it").

  • A proxy that refuses: a 407 gets "add its user and password to https_proxy: sandboxes see them too"; a 403 is named per host; an unreachable proxy gets its address and the error.

  • Waiting: while the service restarts, the CLI says so and returns once it's back, as fctl host restart does.

  • Long lists: a bundle of 40 certificates reads "trusts 40 certificates of its own (Acme Root CA, Acme Issuing CA 2 and 38 more)". A long no_proxy shows three entries and "and 9 more".

  • Follow hyperstructure/design's docs: docs/principles.md; docs/web-app/explaining.md for pages that set something up (a headline that names the outcome, a lead built from this place's facts, a preview of the result, one primary action, and who can act); docs/web-app/kit.md for controls.

  • Design every state before building it: the first visit, loading, errors and refusals, waiting, partial setups and long lists.

  • Say what happens, plainly, and never leave someone at a disabled control without saying who can act.

  • Prototype the main screens with realistic data (cargo xtask demo's world) and review them before building the rest.

  • Check both themes, a phone's width, the keyboard, screen readers and reduced motion, and show screenshots in each pull request.

  • Give the CLI the same care: readable output, --json, and errors that say what to do next.

  • Add or update the pages of hyperstructure/design's docs for each new component, with the reasons behind its choices.

Compatibility

  • Versions. Hosts and agents may run one version behind the control plane. HostConfig (#[serde(default)]) doesn't refuse unknown keys, so an older host ignores [network] and runs without it. The host copies its own fctl-agent into each sandbox when it starts the agent, so only a supervisor that kept running across a host update ignores AgentConfig.network, and only until it next starts.
  • Protocol. AgentConfig.network and HostHello.network are new optional fields in crates/fctl-proto, then cargo xtask gen for the API's Runner. No D1 migration.
  • Release. The host, fctl-agent and CLI changes need a release, which hosts update themselves to (ADR 0053). The control plane changes only in what it shows.
  • Docs. docs/cli.md (host.toml, fctl host install, doctor and network) and docs/self-hosting.md#bring-runners-online. docs/organizations.md#runners-for-a-fleet (the boot script) and docs/sandbox-images.md#what-fctl-writes-into-a-sandbox. docs/security.md#hosts (what hosts trust, and that proxy credentials reach sandboxes). docs/architecture.md and docs/llms.txt.
  • Privacy policy. fctl-site's legal/privacy.md lists what app.fctl.sh keeps of each machine under "Hosts". It needs the proxy's address and the names of the certificates the machine trusts.
  • hyperstructure/sandbox. The default image is Debian, which has update-ca-certificates. Its examples/check.sh could say when an image has no store to add to.

Decisions for a person

  • When a project's variables name another proxy, which wins: the project (it may need another route) or the runner (its owner may require the proxy)? Or do the no_proxy lists merge?
  • Should fctl's binaries also trust the operating system's store (rustls-platform-verifier or rustls-native-certs), for authorities that MDM installs on laptops? Trust would then vary by machine, where docs/security.md promises Mozilla's.
  • May proxy credentials reach sandboxes at all, or only proxies that let machines in by their address?
  • Is a self-hosted control plane behind the same proxy in scope? deploy/standalone/lib/config.mjs trusts NODE_EXTRA_CA_CERTS for the Worker's requests and webhooks (webhookNetwork), but workerd connects directly.
  • Are proxy auto-configuration (PAC) files, and proxies that sign in with NTLM or Kerberos, out of scope?

Related: #615, #614

Session: https://app.fctl.sh/s/ses_01M8450BECFP8DN88R0ZP0N0MS

Activity

  1. added
    enhancement
    host
    cli
    agents
    on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agentsclienhancementhost

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions