Skip to main content
A network policy limits where a machine may connect to on the internet. Without a policy, a machine can reach any public address. With one, it reaches only the domains and address ranges that you list, or nothing at all. Use a policy when a machine runs code you do not fully trust, such as an agent or a build, and you want it to reach GitHub and your own API and nothing else.
A policy limits only what the machine sends out. SSH, exec, files, the terminal, the desktop, and published ports into the machine work as before.

Block all outbound connections

Pass --block-outbound when a machine needs no internet access. The machine then connects to nothing, and no name resolves in it.
Software that the machine downloads at start, such as packages from apt or npm, fails under this policy. Install what you need first, save a snapshot, and create the sealed machine from that snapshot.

Allow only listed domains

Pass --allow-domain once for each name. The machine then connects only to those names, over any protocol and port, so HTTPS and git clone git@github.com:... over SSH both work.
A name is matched in one of two ways: Quote a name with * so that your shell does not expand it. A name that you did not list does not resolve in the machine, so a program gets “could not resolve host” at once and does not wait for a timeout.

Allow address ranges

Pass --allow-cidr for a destination that you know by address, such as a database with a fixed IP. You can combine ranges with domains.
A range is IPv4 or IPv6, and one address without a length is that address alone. A connection to an address that no range lists, and that no allowed name resolved to, is refused.

Change the policy on a running machine

instabox network shows a machine’s policy, and with a flag it replaces the policy as a whole.
The new policy takes effect at once, without a restart. Connections that it no longer allows are closed, and connections that it still allows continue.
To remove the policy, so that the machine connects anywhere again, pass --open-outbound.
In the dashboard, choose Outbound network when you create a machine, or change it under Settings in the machine’s sheet. The choices are Open, Allowlist, and Blocked.

Keep the policy across pause, stop, and fork

A machine keeps its policy when you pause and resume it, and when you stop and start it. A fork starts with its source’s policy. To give the forks their own policy, pass the same flags to instabox fork.
A machine that you create from a snapshot does not take the policy of the machine the snapshot came from. Pass the flags again on that create.

Set a policy with the API

Send networkPolicy when you create a machine. outbound: "restricted" with both lists empty blocks everything.
PATCH /v1/machines/{id} with networkPolicy replaces the policy, and outbound: "open" removes it. A machine without a policy has no networkPolicy field. The fields are in the API reference.

How a domain allowlist works

Every machine resolves names through InstaBox’s resolver. Under a policy, the resolver answers only the names that you listed. When it answers one, it opens the machine’s firewall for the addresses in the answer, for as long as the DNS record is valid (at least 60 seconds, at most 1 hour) and 30 seconds more. Every other address stays closed. This works for any protocol, because the rule is on the address and not on the port. It also means that the policy follows a name when its addresses change.

What a domain allowlist does not guarantee

A domain allowlist is not strict data-loss prevention. It stops software from connecting to places that you did not list. It does not stop someone who controls both the code in the machine and a destination that you allowed.
  • Shared addresses. Many sites share one address behind a CDN or a cloud load balancer. While an allowed name’s address is open, the machine can reach every other site on that address too. InstaBox does not check the name inside the TLS handshake (SNI).
  • An address stays allowed until its entry expires. After a name’s DNS record changes, the old address stays reachable until the entry for it runs out, at most 1 hour and 30 seconds later.
  • An allowed service can relay anything. If you allow github.com, the machine can push to any repository there.
  • Only InstaBox’s resolver opens the firewall. A program must look names up with ordinary DNS, which InstaBox answers. A program that uses DNS over HTTPS or DNS over TLS gets no answer that opens the firewall, so its connections are refused.
  • Everything inside a listed range is reachable, under any name.
To send only to exact destinations, list address ranges that you control and no domains.

Limits

A policy takes up to 100 domains and up to 50 address ranges. A machine can have up to 4096 resolved IPv4 addresses and 4096 resolved IPv6 addresses open at one time. When that set is full, a new name does not resolve until older entries expire.
  • A domain is a name of at least two labels, such as example.com, in lower case. A scheme, a port, a path, or an IP address in --allow-domain is refused.
  • A range cannot be the whole address space (0.0.0.0/0). To allow everything, remove the policy.
  • A range inside private, loopback, link-local, or reserved space, such as 10.0.0.0/8, is refused. A machine cannot reach those addresses with or without a policy.
  • A range with bits set beyond its length, such as 140.82.112.9/20, is refused, and the error names the range that you probably meant.
Linux machines on every plan. A macOS, Windows, or GPU machine is refused with 400, and nothing is created or changed.A policy is set for one machine. There is no default for a workspace or a template.
A policy only narrows what a machine can reach. A destination that InstaBox blocks for every machine stays blocked when your policy lists it. The connection and bandwidth limits on Limits apply to allowed traffic.With Org Secrets, the outbound proxy adds credentials only to connections that the policy allows.
  • 400 bad_request: a name or a range is not valid. The message names it.
  • 409 operation_conflict: the machine has an operation in progress. Change the policy when it is done.
  • 503 host_unavailable: the machine’s host did not take the policy. The earlier policy stays in force. Try again.

Org Secrets

Keep API keys out of the machine and add them to allowed requests.

CLI reference

Every flag of instabox network.