Control network access
A sandbox has no network device of its own. Its traffic goes through a proxy in kumobad, which enforces the sandbox's policy and logs every connection.
| Mode | The sandbox can reach |
|---|---|
open (default) | The public internet |
allowlist | Only the listed host names, *.example.com subdomains, IP addresses and ranges, on ports 80 and 443 or the :port given |
blocked | Nothing |
Private and IPv6 addresses are reachable only when the operator opens them, and loopback, link-local, cloud metadata and the host's own addresses never are, whatever the mode. Always blocked lists exactly which addresses.
Set the policy when you create a sandbox
kumoba create --image default --network.mode allowlist --network.hosts pypi.org,files.pythonhosted.org -qkumoba run takes the same options.
In allowlist mode the proxy only tunnels connections, so a plain http:// request through it gets 405 Method Not Allowed. Use https:// URLs, and install packages from sources that are http://, such as Debian's apt sources, while the mode is open.
An entry can be an IP address or a CIDR range, and any entry can name one port instead of 80 and 443:
kumoba create --image default --network.mode allowlist \
--network.hosts 10.20.0.0/16,git.example.com:7999,'[2001:db8::/32]:443' -qAddress and range entries match connections to an IP address; a host name is matched only by a name entry, even when it resolves into a listed range. A private range such as 10.20.0.0/16, and any IPv6 address, is reachable only when the operator also opens it, on that port, with KUMOBAD_ALLOW_PRIVATE_HOSTS, and the always blocked addresses never are. Write IPv6 entries in brackets, [2001:db8::7] or [2001:db8::/32]:443. The CLI reads a list that starts with [ as JSON, so pass a lone bracketed IPv6 entry as '["[2001:db8::7]:8443"]'. See Allowlist entries for the full syntax.
Change the policy of a sandbox
Update it, started or stopped:
kumoba update "$id" --network.mode allowlist --network.hosts pypi.orgOn a started sandbox the new policy applies without a restart: new connections follow it, and open connections it no longer allows are closed promptly and logged as revoked. This holds for a sandbox started with blocked too: its proxy refuses everything until the network is turned on. See Change the network of a started sandbox.
A stopped sandbox with secrets can't switch to blocked, because secrets are injected by the HTTPS proxy; remove its secrets first with kumoba set-secrets "$id" secrets='[]'. A started one can, to cut its network at once, but it won't start again until its network is opened or its secrets are removed.
A new policy must still reach a host of each of the sandbox's secrets. To take away a host that a secret is for, drop the secrets it no longer reaches in the same call:
kumoba update "$id" --network.mode allowlist --network.hosts pypi.org --drop-unreachable-secretsThe answer lists the removed secrets in droppedSecrets. Either the new policy and the removal both apply, or nothing changes. See Narrow the network and drop secrets in one call.
See what a sandbox connected to
kumoba access-logEach entry has the sandbox, host (the address, for a connection to an IP address), port, whether the connection was allowed, denied, or allowed but failed to connect (failed), and the bytes in each direction. By default you get the last two hours; --since-ms and --until-ms choose another window.
Reach an intranet or go through a corporate proxy
These are daemon settings, set in kumobad's environment:
KUMOBAD_ALLOW_PRIVATE_HOSTS=gitlab.corp.example,10.20.0.0/16,10.30.0.0/16:5432lets sandboxes reach those private hosts and ranges, on ports 80 and 443 unless an entry adds:portor:*. IPv6 ranges, always in brackets ([2600:1f18:abcd::/56]:443), are reachable only when listed here. The always blocked addresses stay blocked.KUMOBAD_UPSTREAM_PROXY=http://proxy.corp.example:3128sends outbound traffic through your proxy, except hosts inKUMOBAD_NO_PROXY. A host name inKUMOBAD_ALLOW_PRIVATE_HOSTSis reached directly, but a range there is not: connections to its addresses still go through the proxy unlessKUMOBAD_NO_PROXYlists each exact address, sinceKUMOBAD_NO_PROXYtakes names and single addresses, not ranges.
See Configuration for every setting.
Last updated on
Open a web app from a sandbox
Open a web app running inside a kumoba sandbox from your browser with kumoba expose, which gives the sandbox port a signed link that expires.
Give a sandbox a token without revealing it
Give code in a sandbox an API token it can use but never see: the guest gets a placeholder, and kumobad sends the real value only to the hosts you allow.