Locked network
By default a machine can reach the whole internet, apart from the
ports we always block. That is what
pip install needs, and it is also what code that should not have run needs to
send your data somewhere.
A locked machine refuses every outbound connection except HTTP and HTTPS to the hosts you list. Use it when the code is untrusted and you know the few places it needs to reach.
curl -sS -X POST https://api.sistemo.io/v1/machines \ -H "Authorization: Bearer $SISTEMO_API_KEY" \ -H "Content-Type: application/json" \ -d '{"stack":"python","network":"locked","allow":["pypi.org","files.pythonhosted.org"]}'Inside that machine, pip install requests works and
curl https://example.com is refused. Nothing in the machine needs configuring:
no proxy variable, no certificate.
In the dashboard, the create form has a Network section, and each machine has a Network tab where you can change the policy and read its log.
From the SDKs (0.2.0 and later): Sandbox(network="locked", allow=[…], secrets=[…]) in
Python, Sandbox.create({ network, allow, secrets }) in JavaScript — see
Python and
JavaScript.
What allow accepts
Section titled “What allow accepts”| Entry | Matches |
|---|---|
pypi.org |
Exactly pypi.org |
*.pythonhosted.org |
Any subdomain (files.pythonhosted.org), not pythonhosted.org itself |
Up to 64 entries, lowercased and de-duplicated. These are a 400: an IP
address, a scheme (https://…), a port, a path, a bare *, allow without
"network": "locked", and a private-network name (*.internal, .local,
.localhost, .home.arpa, .lan, .corp): a locked machine only ever reaches
public addresses.
"network": "locked" with an empty allow (or none) is a machine with no public
outbound at all — the right default for code that only computes.
The address your machine’s traffic comes from
Section titled “The address your machine’s traffic comes from”Outbound traffic leaves from the public address of the host the machine runs on, shared with every other machine on that host — yours and other customers’. So:
- A third party’s per-IP rate limit counts all of those machines together. If a
service starts answering
429while you are calling it slowly, that is the likely reason; back off and retry. - Do not add that address to a firewall allow-list as if it were yours alone, and do not rely on it staying the same: a machine created later may run on another host.
What a refused call looks like
Section titled “What a refused call looks like”| From inside the machine | Result |
|---|---|
http:// to a host not on the list |
403 with {"code": "egress_domain_not_allowed", "host": "…", "retryable": false} |
https:// to a host not on the list |
The connection is closed — no status can be sent inside TLS without decrypting it |
| A port other than 80 or 443, to any host | Refused — TCP gets an immediate reset |
| Straight to an IP address | Refused |
| An allowed name that resolves only to a private or reserved address | 403 with {"code": "egress_address_not_public", "retryable": false} |
A name that is not on the list still resolves — to the egress path, never to a real address. Do not test for a blocked host by checking whether DNS fails; check whether the request succeeds.
Plain-HTTP refusals carry retryable: false on purpose: the same call will be
refused again until you change the policy.
DNS for allowed names answers only the lookups a client needs to connect:
A, AAAA and CNAME. TXT, MX and other types are refused, and a query
with more than one question is dropped.
Change the policy
Section titled “Change the policy”curl -sS -X POST "https://api.sistemo.io/v1/machines/$MACHINE_ID/network" \ -H "Authorization: Bearer $SISTEMO_API_KEY" \ -H "Content-Type: application/json" \ -d '{"network":"locked","allow":["api.example.com"]}'allow is the whole new list, not an addition to the old one. On a running
machine the change applies immediately, without a restart, and connections already
open to a host that is no longer allowed are closed. On a stopped machine it
applies at the next start. Send {"network": "open"} to unlock.
network is required in this call: an empty body is a 400, never a silent
switch to open. Locking a running machine resets an established TCP
connection the next time it sends — an active one within about a second. An idle
connection that sends nothing ends only when it next sends or receives, or at its
own timeout.
Every change is recorded in the Activity log as
machine.network_changed, with the mode and the number of hosts — not the list.
See what it tried to reach
Section titled “See what it tried to reach”curl -sS "https://api.sistemo.io/v1/machines/$MACHINE_ID/egress/activity?action=blocked" \ -H "Authorization: Bearer $SISTEMO_API_KEY"{ "activity": [ { "host": "evil.example", "action": "blocked", "at": "2026-11-21T10:42:00Z" }, { "host": "pypi.org", "action": "allowed", "at": "2026-11-21T10:41:00Z" } ], "complete": true}One row per host, result and minute, newest first. Host names only — never a path, a header or a body. The log is a recent window kept with the machine and ends when the machine does.
complete is false when rows may be missing: the log reached its size limit,
the machine is not running, or the machine is open (open machines are not logged).
An empty list means “no outbound calls” only when complete is true.
Refused calls are also copied into the Activity log as
egress.blocked about a minute later. That copy outlives the machine and is
kept for 365 days; filter for it with category=egress.
Things to know
Section titled “Things to know”- HTTP and HTTPS only. SSH, database ports,
git://and anything else are refused even to an allowed host. Clone overhttps://. - Package managers fetch from more than one host. pip needs
pypi.organdfiles.pythonhosted.org; npm needsregistry.npmjs.org. Read the blocked log to find what else a tool wants. - A host that cannot enforce
lockeddoes not boot the machine open. The create fails with503 no_host_available; retry. - An allowed host is still a way out. If it accepts uploads — a code host, a paste site, a storage bucket — code can send data there. Allow only what the job needs.
- A wildcard reaches that zone’s nameservers. With
*.example.comallowed, every lookup of a name under it —anything.example.com— reachesexample.com’s DNS servers, which is a (slow) way to send data out. Prefer exact names when the zone is not yours. - The policy is on the host name, not the server behind it. HTTPS is decided
on the TLS server name. If you allow a shared CDN hostname, a request can carry a
different
Hostheader to whatever that CDN is willing to serve under it. - A clone must choose. A machine created from a snapshot or a kept root disk
of a locked machine needs
networkin the request —"locked"with itsallow, or"open". Leaving it out is a400: an omitted network means open, and a clone must not get that by accident. The dashboard sends the source’s policy for you. - Refused host names are stored.
egress.blockedkeeps the name the machine asked for, for 365 days. Code that puts data into a host name (a secret, say) writes it into your Activity log.
Related
Section titled “Related”- Secrets — give a machine credentials, and lock where they can go
- Network API — every field and status code
- Security — isolation and the ports blocked for everyone