Skip to content

By default a sandbox can reach the public internet, but not your private networks. This page describes how to restrict it further, how to take it fully offline, and how to reach servers in the sandbox from your host.

To restrict the sandbox to the hosts you trust, turn on enforce in .firebrick.yml and list them:

name: my-project
network:
enforce: true
allow:
- api.anthropic.com # exactly this host name
- "*.github.com" # github.com and every subdomain
- 140.82.112.4 # one IPv4 or IPv6 address
- 192.168.10.0/24 # a CIDR range
deny:
- gist.github.com

With enforce: true, the sandbox can only connect to destinations an allow rule matches: TCP and UDP on any port, and ICMP. A deny rule wins over an allow rule, so in the example gist.github.com is blocked although *.github.com allows it. Every name resolves, except names a domain deny rule matches. fbk validate and fbk start reject entries that aren’t a host name, *. plus a domain, an IP address or a CIDR range, such as *, https://github.com or github.com:443. With enforce: false, the rules are only validated.

An HTTP or HTTPS request to a host that isn’t allowed gets 403 Forbidden with a message that names the host:

Terminal window
$ curl -s https://example.org
firebrick blocked the connection to example.org: the network policy of this sandbox doesn't allow it. To allow it, run `fbk network allow example.org` on the host, outside the sandbox.

Keep in mind that:

  • Only HTTP/1.x requests get the message, and only while there are no domain deny rules. With a domain deny rule, and for IP or CIDR deny rules and other protocols, the connection is reset or closed instead, and a host denied by a domain rule doesn’t resolve.
  • A host allowed by a host name or *.domain rule is only reachable over HTTP and HTTPS on ports 80 and 443. For SSH to github.com:22 or HTTPS on another port, allow its IP address or CIDR range.
  • Firebrick intercepts HTTPS to check the host name, with a certificate authority that the sandbox trusts. Tools that pin certificates or bring their own CA store fail. HTTP/3 is blocked, so clients fall back to HTTP/2 or 1.1.
  • Java trusts that certificate authority through JAVA_TOOL_OPTIONS, which points every JVM at a trust store Firebrick builds when the sandbox starts, so JDKs you install later with mise use java@... work too. Every JVM prints Picked up JAVA_TOOL_OPTIONS: ... to stderr. Options you set in env come first, and a -Djavax.net.ssl.trustStore= of your own replaces Firebrick’s store. A JAVA_TOOL_OPTIONS from the image is hidden, so set it in env instead. A custom image needs OpenSSL 3.2 or newer to build the store; without it, fbk start prints a warning.
  • Docker containers in the sandbox trust that certificate authority too, so upstream images and Testcontainers work without changes. In the firebrick-base image, Docker mounts a certificate bundle into every container at /etc/firebrick/ca-certificates.crt, made of the image’s own system bundle and the certificate authority, and points SSL_CERT_FILE, REQUESTS_CA_BUNDLE, CURL_CA_BUNDLE and NODE_EXTRA_CA_CERTS at it. When the image or docker run -e sets one of these variables to a bundle in the image or in a mounted volume, that bundle gets the certificate authority added; when the file doesn’t exist, the variable points at Firebrick’s bundle instead. When the sandbox has the Java trust store, Docker mounts it at /etc/firebrick/firebrick.p12 and adds it to JAVA_TOOL_OPTIONS, unless the container sets a -Djavax.net.ssl.trustStore= of its own. docker exec docker build RUN steps trust it too, and the built image keeps none of this. docker exec sessions don’t get the variables, and programs that read only the image’s system bundle don’t trust the certificate authority. A sandbox on an older firebrick-base image gets this with fbk upgrade, which removes its Docker images and containers.
  • A secret’s allowed hosts must be allowed by the network rules too. See Secrets.
  • mise install downloads its tools when the sandbox starts, so allow the hosts it needs, or set mise.enabled: false.

Set network.proxy to send outbound connections through a proxy reached by the host. Programs in the sandbox need no HTTP_PROXY or HTTPS_PROXY variables:

name: my-project
network:
proxy: "http://proxy.example.com:3128"
enforce: false

http:// uses HTTP CONNECT tunnels, including for plain TCP connections. The proxy must allow CONNECT to the destination IP and port; a proxy that only allows CONNECT on port 443 won’t carry HTTP on port 80. socks4://proxy.example.com:1080 and socks5://proxy.example.com:1080 are supported too. Use an ASCII DNS name or a literal IP address and an explicit, nonzero port; bracket IPv6 addresses, as in http://[::1]:3128. SOCKS4 requires an IPv4 address or a hostname with an IPv4 answer. Authentication, HTTPS connections to the proxy, paths, queries and per-destination bypasses aren’t supported yet.

fbkd resolves proxy hostnames with the host’s resolver when the sandbox is created or recreated, including for a network change or image upgrade. The guest’s DNS settings aren’t used for that lookup. IPv4 is preferred when both address families are returned. One address is selected for that sandbox; there is no per-connection DNS refresh or automatic retry of other proxy addresses. A lookup failure or a five-second timeout fails the operation instead of falling back to a direct connection. The original hostname stays in the spec, settings review and stored network label.

The address is relative to the host: 127.0.0.1 means the machine running fbkd, not the sandbox. The proxy itself doesn’t need an allow rule; the rules still apply to the original destinations. The proxy applies even when enforce is false. Leave it false when the external proxy should do the destination filtering. network.enabled: false still takes the sandbox offline. Adding, changing or removing a proxy is included in the normal settings review.

For an existing sandbox, edit the file and run fbk network policy enable (or disable when enforcement should stay off) to apply the network section. This restarts the sandbox while preserving its disks. Starting an existing sandbox with fbk start alone doesn’t apply changed network settings. Image upgrades preserve the stored proxy.

HTTP CONNECT and SOCKS4 carry TCP; non-DNS UDP is dropped. SOCKS5 also carries non-DNS UDP when the proxy supports UDP ASSOCIATE. DNS continues to use microsandbox’s resolver separately from the outbound proxy. A failed proxied TCP connection doesn’t fall back to a direct connection. This setting is not a guarantee that all host traffic passes through the proxy: image pulls, DNS and other host-side operations are separate. Connections microsandbox rewrites to host-local services bypass the outbound proxy too.

When the external proxy intercepts TLS, its CA must be trusted by the component verifying its certificates. This first integration doesn’t configure that CA. Test your proxy’s certificate setup before using it with a coding agent.

Change the rules with fbk network in the project directory. It writes the change to .firebrick.yml, so the file and the sandbox always have the same rules, and applies it to the sandbox:

Terminal window
$ fbk network allow example.org "*.npmjs.org"
updated the network rules of my-project
$ fbk network deny gist.github.com
updated the network rules of my-project
$ fbk network policy enable
updated the network rules of my-project
  • fbk network allow <rule>... adds the rules to allow and removes them from deny; fbk network deny <rule>... does the opposite. A rule that’s already there isn’t added twice. When neither the file nor the sandbox changes, the command prints network rules are already up to date.

  • fbk network policy enable and fbk network policy disable set enforce.

  • When applying the rules to the sandbox fails, run the command again: it applies the rules from .firebrick.yml to a sandbox that doesn’t have them yet, also after you edit the file by hand.

  • When there’s no .firebrick.yml yet, the command creates one with the defaults and the name fbk start uses, plus the change.

  • allow and deny warn when enforce is off, because the rules don’t protect anything until you run fbk network policy enable.

  • When the sandbox doesn’t exist yet, only the file changes and the rules apply when it starts.

  • The sandbox keeps its files, installed packages and Docker data, but it restarts: running processes stop, as after fbk stop and fbk start. A stopped sandbox stays stopped. A sandbox that already has the rules, or whose rules aren’t enforced, doesn’t restart. A paused sandbox can’t be restarted, and fbk has no resume command, so stop it with fbk stop first.

  • fbk network rewrites .firebrick.yml, which drops its comments and formatting.

  • fbk network sends the whole network section of .firebrick.yml, so it asks before it sends changes you didn’t make with the command, such as enforce: false that the agent added by hand:

    Terminal window
    $ fbk network allow example.org
    .firebrick.yml changes settings you haven't approved for this workspace:
    ~ network.enforce: true -> false
    + network.allow: example.org
    Apply these changes? [y/N]

    Answer y to apply them, or anything else to leave the sandbox alone; the change to .firebrick.yml stays. --yes approves them without asking. The change you asked for never needs approval. See Approving settings changes.

Allowing coding agents and toolchains with presets

Section titled “Allowing coding agents and toolchains with presets”

Firebrick ships presets: groups of allow rules for coding agents, GitHub, the extension marketplaces and server downloads of IDEs, and the package registries and installers of common toolchains. Add the ones your project needs instead of working out every domain yourself:

Terminal window
$ fbk network policy enable
updated the network rules of my-project
$ fbk network presets apply claude github rust node
updated the network rules of my-project

fbk network presets apply <preset>... works exactly like fbk network allow with the rules of the named presets, so it asks for approval and takes --yes the same way. fbk network presets apply all adds every preset. Run fbk network presets show to list the presets and their rules:

Preset Rules
claude *.anthropic.com, *.claude.ai, *.claude.com
copilot *.githubcopilot.com, copilot-proxy.githubusercontent.com, origin-tracker.githubusercontent.com
github *.github.com, *.githubusercontent.com, *.githubassets.com, ghcr.io
codex *.openai.com, *.chatgpt.com
vscode *.visualstudio.com, *.visualstudio.microsoft.com, *.vsassets.io, *.vscode-cdn.net, vscode.download.prss.microsoft.com
jetbrains *.jetbrains.com
node *.nodejs.org, *.npmjs.org, *.npmjs.com, *.yarnpkg.com, *.pnpm.io, *.bun.sh
dotnet *.nuget.org, *.dot.net, builds.dotnet.microsoft.com, dotnetcli.azureedge.net, dotnetcli.blob.core.windows.net
java *.maven.org, repo.maven.apache.org, *.gradle.org, *.adoptium.net, central.sonatype.com, oss.sonatype.org, s01.oss.sonatype.org
rust *.crates.io, *.rust-lang.org, *.rustup.rs, docs.rs
go *.golang.org, *.go.dev, dl.google.com
python *.pypi.org, *.pythonhosted.org, *.python.org, *.astral.sh, *.anaconda.org, repo.anaconda.com
mise *.jdx.dev, mise.run
ruby *.rubygems.org, *.ruby-lang.org
  • The presets are built into fbk, so nobody can change them by editing a file.
  • .firebrick.yml gets the rules, not the preset names. Afterwards they’re ordinary allow rules: remove them from the file, or narrow them with fbk network deny, like any other rule. Applying a preset again changes nothing.
  • apply doesn’t turn on enforcement; run fbk network policy enable for that.
  • Many tools download releases from GitHub, so add github along with the toolchain preset. Like every domain rule, the presets only allow HTTP and HTTPS, so cloning over SSH (git@github.com:...) stays blocked.
  • vscode lets VS Code connected to the sandbox over SSH download its server into the sandbox and install extensions from its marketplace; jetbrains lets JetBrains IDEs install plugins from theirs.

A sandbox can’t reach a server on your LAN, such as a NAS at 192.168.68.122, even when your host can. This is by design: by default a sandbox only reaches the public internet, and private address ranges are blocked, whether or not enforce is on. They include the RFC 1918 ranges 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16, IPv6 unique local addresses (fc00::/7) and carrier-grade NAT (100.64.0.0/10). DNS queries are the exception: the sandbox asks your host’s DNS servers, which are often on your LAN, and can send DNS queries to any server (see DNS servers).

To reach a LAN host, turn on the policy and allow the host’s IP address, or a CIDR range for the whole LAN:

Terminal window
$ fbk network policy enable
updated the network rules of my-project
$ fbk network allow 192.168.68.122 # or 192.168.68.0/24 for the whole LAN
updated the network rules of my-project

Or the same in .firebrick.yml:

name: my-project
network:
enforce: true
allow:
- 192.168.68.122

Enabling the policy means the sandbox only reaches what the allow rules list, so also allow the public hosts the sandbox still needs, such as your agent’s API and package registries. See Restricting outgoing traffic.

A host name that resolves to a LAN address, such as nas.example.lan in your internal DNS, needs an IP or CIDR rule for that address. A host-name rule alone isn’t enough: to protect against DNS rebinding, the sandbox’s resolver answers NXDOMAIN to any lookup whose answer contains a private address that no IP or CIDR rule allows. With the rule for the address, the name resolves and the sandbox connects to it over any protocol, HTTPS included, so it needs no host-name rule of its own.

When a LAN host isn’t allowed, you see one of these:

  • Without enforce, or for other protocols than HTTP/1.x, the connection is refused or reset: curl: (7) Failed to connect to 192.168.68.122 port 80.
  • With enforce on, an HTTP/1.x request gets 403 Forbidden with the message firebrick blocked the connection to 192.168.68.122.
  • A host name that resolves to a LAN address without an IP or CIDR rule doesn’t resolve: curl: (6) Could not resolve host: nas.example.lan.

fbkd points the sandbox’s /etc/resolv.conf at your host’s current DNS servers, followed by the sandbox’s own resolver, and updates the file within a few seconds when your host’s servers change, for example after it wakes from sleep or connects to a VPN. So name resolution in a running sandbox keeps working without a restart. Keep in mind that:

  • fbkd manages /etc/resolv.conf: edits you make in the sandbox are overwritten when your host’s DNS servers change.
  • The sandbox can send DNS queries to any DNS server, including servers on your LAN, even with enforce on and with a deny rule for the server’s address. Domain deny rules still apply to those queries, so a denied name doesn’t resolve whichever server the sandbox asks.
  • The sandbox only gets IPv4 servers your host doesn’t run itself: a host that only uses a local resolver, such as systemd-resolved’s 127.0.0.53, leaves the sandbox on its own resolver.
  • Sandboxes created before firebrick did this keep their DNS settings until they’re recreated, for example by fbk network allow or fbk upgrade.

Firebrick records the domains and IP addresses each sandbox contacts, so you can see which fbk network allow rules a task needs, or spot an agent that contacts hosts it shouldn’t. A logger in the firebrick-base image watches the sandbox’s network interface and reports each DNS lookup with the addresses it resolved to, and each outgoing TCP connection attempt and UDP destination, to fbkd. Attempts that the enforced rules deny are recorded too.

fbkd keeps one entry per domain and per address, with how often and when it first and last saw it, in ~/.local/state/firebrick/network/<sandbox>.json. fbk rm deletes the record with the sandbox.

Run fbk network log in the project directory to see the record of its sandbox, newest first:

Terminal window
$ fbk network log
┌──────────────────┬──────┬───────┬───────┬─────────────────────┬─────────┐
│ DESTINATION │ KIND │ PORTS │ COUNT │ LAST SEEN │ POLICY │
├──────────────────┼──────┼───────┼───────┼─────────────────────┼─────────┤
│ evil.example.com │ dns │ │ 1 │ 2026-10-11 14:03:40 │ denied │
│ api.github.com │ dns │ │ 12 │ 2026-10-11 14:02:11 │ allowed │
│ 140.82.112.6 │ tcp │ 443 │ 12 │ 2026-10-11 14:02:11 │ allowed │
└──────────────────┴──────┴───────┴───────┴─────────────────────┴─────────┘

POLICY tells whether the sandbox’s current rules allow the destination: domain rules for dns entries, IP and CIDR rules for tcp and udp entries. A connection to the address of an allowed domain shows as denied unless an IP rule allows the address too, and every entry shows allowed when the rules aren’t enforced. It’s Firebrick’s own reading of the rules, not a report of what was blocked, and rules you changed since apply to older entries too. The command only reads: it doesn’t change .firebrick.yml and never asks for approval.

The logger runs inside the sandbox, and agent can use sudo, so an agent can stop it or report made-up traffic, and fbk network log shows what it reported. Treat the record as a diagnostic aid, not as proof of what the sandbox did. DNS over HTTPS and IPv6 aren’t recorded. Sandboxes created by an older version of Firebrick have no record until you remove and start them again, or a fbk network command that changes their settings restarts them; fbk network log tells you so. Custom images only have a record when they run the logger (see Custom images).

To keep an agent fully offline, for example for code that must not leave your machine, remove the sandbox’s network device:

name: my-project
network:
enabled: false # default: true

Or run fbk network disable in the project directory, and fbk network enable to turn the network back on:

Terminal window
$ fbk network disable
disabled the network of my-project
$ fbk run -- curl -sI https://github.com
curl: (6) Could not resolve host: github.com
$ fbk network enable
enabled the network of my-project

Without a network device, nothing in the sandbox resolves or connects, and enforce, allow and deny are validated but ignored. fbk run, ssh <leaf>.fbk, port forwards and the editor integrations keep working, because they don’t use the sandbox’s network. mise install can’t download tools, so install them while the network is on, or set mise.enabled: false.

This is different from fbk network policy disable: that keeps the network device and only stops enforcing the rules, so the sandbox can reach the internet again. fbk network disable takes the network away entirely, whatever the rules say.

The commands work like the other fbk network commands: they create .firebrick.yml when it’s missing, print the network is already disabled or the network is already enabled when nothing changes, restart an existing sandbox while keeping its disks, and only change the file when the sandbox doesn’t exist yet (updated .firebrick.yml; the change applies when my-project starts).

The sandbox publishes no ports on the host. To open a server in the sandbox, such as a dev server, from the browser on your host, list its port under ports, written like Docker Compose:

name: my-project
ports:
- 3000 # host localhost:3000 -> sandbox port 3000
- "8080:5173" # host localhost:8080 -> sandbox port 5173

fbk start prints each forward:

Forwarding localhost:3000 -> sandbox port 3000
Forwarding localhost:8080 -> sandbox port 5173

The forwards reach 127.0.0.1 in the sandbox, so a server that only listens on localhost there works. They listen on localhost on the host only, never on your network. To change them, edit the list and run fbk start again; the sandbox keeps running and unchanged forwards keep their connections. fbk stop and fbk rm close them, and an SSH connection that starts the sandbox opens them again.

To add or remove a forward while you work, without editing the file:

Terminal window
fbk port forward 3000 # host localhost:3000 -> sandbox port 3000
fbk port forward 8080:5173 # host localhost:8080 -> sandbox port 5173
fbk port rm 8080 # stop forwarding host port 8080

They apply right away to a running sandbox and update the ports list in .firebrick.yml, keeping its comments and other fields, or create the file when there’s none. Forwarding a host port that’s already listed replaces its sandbox port. For a stopped sandbox, or one that doesn’t exist yet, the change applies when it starts. When the host port is in use, fbk port forward fails with couldn't forward localhost:<port>: <reason> and changes nothing.

To see which ports to forward, list the forwards next to the TCP ports that listen in the running sandbox:

Terminal window
fbk port ls
┌──────┬───────┬─────────────┬────────────┬───────────────┐
│ HOST │ GUEST │ ADDRESS │ PROCESS │ STATUS │
├──────┼───────┼─────────────┼────────────┼───────────────┤
│ 3000 │ 3000 │ 127.0.0.1 │ node (412) │ forwarded │
│ - │ 5173 │ 0.0.0.0, :: │ vite (530) │ listening │
│ 8080 │ 8081 │ - │ - │ not listening │
└──────┴───────┴─────────────┴────────────┴───────────────┘

forwarded means a forward reaches a port that something listens on, listening that nothing forwards it yet, and not listening that a forward reaches a port where nothing listens. The list is read from the sandbox when you run the command, so a server you just started shows up right away, without a restart. For a stopped sandbox, fbk port ls lists the forwards with status stopped. Add --format json for a JSON array. The sandbox reports the ports and process names itself, so treat them as a hint, not a guarantee.

When a host port is already in use, the sandbox still starts and fbk start prints warning: couldn't forward localhost:<port>: <reason>. Free the port and run fbk start again. Ports must be from 1 to 65535, and each host port may appear once. See also Troubleshooting.

Dev servers that serve HTTPS in the sandbox, such as the Aspire dashboard or an ASP.NET Core app with its development certificate, use a certificate your browser doesn’t trust. Every forward handles this for you: when your browser opens https://localhost:<port>, fbkd answers with a certificate of its own and passes the requests on to the dev server over a second HTTPS connection. HTTP/2, gRPC and WebSockets work as before, and plain HTTP and other protocols are forwarded as they are.

fbkd’s certificate is signed by a localhost certificate authority (CA) that it keeps in its data directory and that may only sign certificates for localhost, its subdomains and the loopback addresses. Trust it once:

Terminal window
fbk cert trust
Trusted the firebrick localhost CA in the system trust store (/etc/ca-certificates/trust-source/anchors).
Trusted the firebrick localhost CA in the NSS database /home/me/.pki/nssdb.
Restart your browser to pick it up.

On Linux it asks for your password to change the system store, and also updates the certificate databases of Chrome and Firefox when certutil is installed (libnss3-tools on Debian and Ubuntu, nss-tools on Fedora, nss on Arch). On macOS it adds the CA to your login keychain, and on Windows to your user’s root store, which asks you to confirm. fbk cert clean removes the CA again.

fbkd keeps the CA until its files are removed or damaged. When it has to create a new one, it logs a warning with the reason, and your browser warns again until you run fbk cert trust once more.

The CA’s key never enters a sandbox, so an agent can’t use it, and your host never trusts a certificate made in the sandbox. Some clients don’t work through an HTTPS forward:

  • A dev server that requires client certificates, because the browser’s certificate ends at fbkd.
  • A client that trusts only the dev server’s own certificate, such as curl --cacert with that certificate. Trust the localhost CA instead; its certificate is tls/ca.crt in Firebrick’s data directory.
  • A server that only speaks TLS 1.0 or 1.1.

Logins that send your browser back to localhost, such as gh auth login --web, need no listed port. The sandbox has no browser, so the base image hands URLs it opens to fbkd, which opens them in the browser on your host. When such a URL’s redirect_uri or own host is localhost:<port>, fbkd forwards that port to the sandbox before the browser opens. The forward closes after 10 minutes without connections, or when the sandbox stops.

SSH doesn’t use the sandbox’s network either. The generated SSH config tunnels each connection through fbk and the daemon’s socket to the SSH server in the sandbox; no sshd port is published on the host. See Editor support.

The base image disables IPv6 in the guest. microsandbox gives the guest IPv6 even when the host can’t route it, and then resets IPv6 connections after the handshake, so clients never fall back to IPv4 (microsandbox#1226). The image’s /sbin/init applies the setting at boot, so images built on the base image inherit it, unless they set init: false.