Skip to main content
Goal: the box is reachable from your own devices over a private mesh, and nothing is exposed to the open internet except the one SSH door. Do this before installing any services.
Principle: Zero ingress. You don’t secure a box by listing what to block. You expose nothing, then open one hole you control. See PRINCIPLES.md.
There’s a script that does all of this idempotently: scripts/lock-edge.sh. Read it, then run it — or follow the steps below by hand so you understand each one.

1.1 Put the box on a private mesh (Tailscale)

Tailscale builds an encrypted WireGuard network between your machines. Your laptop, phone, and this box all get stable private IPs and can reach each other from anywhere — without opening a single public port. On the box:
tailscale up prints a URL — open it in your browser and sign in to authorize the box. The free personal plan covers this build. Get the box’s tailnet IP (starts with 100.), you’ll use it everywhere:
Install Tailscale on your laptop and phone too (same account) so they’re on the mesh.

1.2 Close the public surface (ufw)

Now deny everything inbound except SSH, which we keep temporarily so you can’t lock yourself out:
ufw enable will warn that it may disrupt SSH — it won’t, because you just allowed port 22. Type y.

1.3 The Docker gotcha (know this now, before Step 2)

Docker bypasses ufw. When you install Docker in Step 2 and publish a container port, Docker writes its own iptables rules underneath ufw, so a container you thought was firewalled can be world-reachable. The fix used throughout this build is simple and reliable: never publish a container to 0.0.0.0. Always bind to the Tailscale IP. So in every compose file you’ll see ports written as:
That keeps the service on the mesh even though Docker sidesteps ufw. (There are heavier fixes like ufw-docker, but binding to the tailnet is enough for a single box.) Once you’ve confirmed you can reach the box over Tailscale (ssh ubuntu@100.x.y.z), you can remove the public SSH rule so even port 22 is only reachable on the tailnet:
Now the box has zero open public ports. You reach it exclusively over the mesh. (Keep the OCI/Hetzner web console as your break-glass access.)

✅ Verification (must pass before Step 2)

From your laptop (on Tailscale):
On the box:
If you can reach the box over the 100. address and ufw shows default-deny, the edge is locked. This is the load-bearing step — everything else sits behind it.