Skip to main content
There are two things to control: who can operate a Sailbox, and who can reach the services it exposes.

Choose who can operate the Sailbox

Every Sailbox has a visibility:
  • Org (the default) lets anyone in your organization run commands, copy files, SSH in, and pause, sleep, checkpoint, or terminate it.
  • Private restricts all of that to you. Your organization can still see the Sailbox in listings, but cannot act on it. An org admin can override that for any operation by giving a reason, which is recorded in the audit log. SSH logins are the exception: only the creator can log in over SSH, so an admin uses commands or a shell instead. Creating one requires an API key created by your user, so that Sail can identify the creator. A service key, which belongs to the organization rather than to a member, cannot create or operate one.
Code running inside a Sailbox can read that Sailbox, sleep it, schedule its wake, and manage its cron jobs without an API key. See guest identity.

Change a Sailbox’s visibility

The creator of a Sailbox can switch it between org and private at any time. An org admin can too, by giving a reason that the audit log records. A private Sailbox stays private to its creator, not to the admin who changed it. The change applies to new commands, file copies, and lifecycle operations right away. Shells and commands already running are not interrupted.
SSH follows the visibility in effect when you last enabled it:
  • After a Sailbox becomes org-wide, SSH still accepts only the creator’s certificate. Enable SSH again to let the rest of your organization in.
  • You cannot make a Sailbox private while SSH is enabled, because its SSH server would keep accepting everyone in your organization. Unexpose port 22, make the Sailbox private, then enable SSH again.
  • After you make a Sailbox private, a checkpoint can still hold its old org-wide SSH settings. Restoring that checkpoint unexposes port 22; enable SSH again for creator-only logins. Checkpoints that hold the creator-only setup keep SSH enabled across sleep and resume.
  • If the visibility changes while SSH is being enabled, enabling SSH fails with a conflict error and port 22 stays as it was. Enable SSH again to set it up for the new visibility.
Cron jobs and ingress tokens that teammates created while the Sailbox was org-wide keep working after you make it private. Delete them if they should stop.

Make a web server public

A Sailbox does not accept inbound traffic until you expose a port. Exposing an HTTP port gives it a public HTTPS URL that anyone can reach, with TLS handled for you. Nothing inside the Sailbox needs to know about certificates or hostnames.
In the SDKs, expose and unexpose add and remove ports on a running Sailbox: sb.expose(8080) in Python, await sb.expose(8080) in TypeScript, sb.expose(8080, IngressProtocol::Http, &[]).await? in Rust. Add or remove ports on a running Sailbox with sail box expose <id> <port> and sail box unexpose <id> <port>. sail box listeners <id> shows what is exposed. HTTP and WebSocket traffic both work, and a sleeping Sailbox wakes when a request arrives. To serve on your own hostname, see Custom Domains.

Restrict who can reach it

Pass an allowlist when you expose a port. An entry is an address or range, or the name of a Sail app, which admits authenticated requests from Sailboxes in that app. Anything else fails before it reaches the Sailbox.
Pass the same allowlist on the port when you create the Sailbox: ingress_ports=[sail.IngressPort(8080, allowlist=[...])] in Python, ingressPorts: [{ guestPort: 8080, protocol: "http", allowlist: [...] }] in TypeScript, and the allowlist field of IngressPort in Rust. Re-exposing a port replaces its whole allowlist, so you can use the same command to tighten or relax access. An app name does not have to exist yet, and names from other organizations never match. An app-name allowlist matches on the identity of the calling Sailbox. When one Sailbox calls another Sailbox’s listener, Sail adds the calling Sailbox’s identity to the request, so a request from an allowlisted Sailbox is accepted.

Raw TCP ports

Expose a port as raw TCP for protocols other than HTTP, such as Postgres or a custom server. You get a public host and port.
A raw TCP port has no platform-side authentication. Whatever is listening inside the Sailbox is the only access control, so make sure it requires credentials.
Raw TCP connections have no app identity, so a TCP allowlist can contain only addresses and ranges. Exposing a well-known unauthenticated port such as Postgres, MySQL, or Redis without an allowlist is rejected. Pass --allowlist 0.0.0.0/0 --allowlist ::/0 to confirm you want it open to everyone.

UDP ports

Expose a port as raw UDP for services such as game servers, voice calls, or VPNs. You get a public host and port. Clients send datagrams to that address, and the Sailbox’s replies come back from it. Some older Sailboxes cannot expose UDP: the request fails with a message that UDP is not supported on the Sailbox’s network. Run upgrade on such a Sailbox first. A Sailbox that has been paused or asleep for a long time must be resumed before it can expose a UDP port.
A raw UDP port has no platform-side authentication, and a datagram’s source address can be forged, so an allowlist does not prove who sent it. Make the service inside the Sailbox authenticate its clients.
A guest port can have a TCP listener and a UDP listener at the same time. They share one public host and port, and each keeps its own allowlist.
At create time, list the guest port once for each protocol, such as ingress_ports=[sail.IngressPort(7777, "tcp"), sail.IngressPort(7777, "udp")] in Python. How UDP ports behave:
  • A UDP allowlist applies only to UDP. Like a TCP allowlist, it can contain only addresses and ranges.
  • Re-exposing a port with the same protocol replaces that listener’s allowlist. A port with a TCP or UDP listener cannot also have an HTTP listener.
  • unexpose without a protocol removes every listener on the port.
  • An unexposed UDP address stays owned by your org, like a TCP one. Sail may reassign it to another of your Sailboxes, never to another org, so read the endpoint from each expose response instead of reusing an old one.
  • Reading a port’s listener returns its HTTP or TCP listener. Pass the udp protocol to read or wait for its UDP listener.
  • A UDP server waiting for datagrams does not keep its Sailbox awake. A datagram sent to a sleeping Sailbox wakes it and is delivered once the Sailbox is running. A large burst sent during the wake can be dropped.
UDP on a well-known amplification port (19, 53, 123, 161, 389, 1900, or 11211) needs an allowlist. Small requests to these services draw large replies, so an open port lets anyone who forges a source address use your Sailbox to flood that address. Pass --allowlist 0.0.0.0/0 --allowlist ::/0 to make it public anyway.

Connect with a shell

The quickest way into a Sailbox is sail box shell. It opens an interactive terminal over the same channel the CLI uses to run commands.
While the shell is open, servers the Sailbox runs on localhost and links it opens are forwarded to your machine, so you can develop against it without exposing anything. Pass --no-forward to turn that off.

SSH access

Use SSH when you need a real SSH endpoint rather than a terminal: scp and rsync, an editor’s remote mode, or port forwarding you control. Enabling it exposes port 22, which counts against your organization’s raw TCP limit. SSH is organization-scoped. Enabling it exposes port 22, and the Sailbox trusts your organization’s certificate authority, so anyone in the org can connect with a short-lived certificate for their own key. There are no per-Sailbox keys to hand out. A private Sailbox is the exception: its SSH server accepts only its creator’s certificates.
Use --identity-file to select your local SSH private key. Its matching .pub file is used to issue a short-lived certificate; the private key stays on your machine. If omitted, the CLI looks for ~/.ssh/id_ed25519, then ~/.ssh/id_rsa. The SDK call enables SSH on the Sailbox. To connect from a machine, run sail box ssh alias <id> --identity-file ~/.ssh/id_ed25519 there once. The CLI’s enable does that for you.

SSH lifecycle

Enabling SSH is safe to repeat, and it is the first thing to try when ssh stops connecting: run sail box ssh enable <id> or the SDK call again. On a Sailbox that runs systemd, the SSH server also restarts on its own when it exits. Sailboxes built on a devbox image run systemd; for a Debian image, add with_systemd(). Open SSH connections stay up when the server restarts or you enable SSH again. Enable SSH again when:
  • The SSH server stopped on a Sailbox without systemd, or failed repeatedly and systemd stopped restarting it.
  • The Sailbox rebooted.
  • You unexposed port 22, made a Sailbox private, and re-enabled SSH, then restored a checkpoint with its old org-wide SSH settings. Restoring those settings unexposes port 22 again. See changing visibility.