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 on Linux: https://tailscale.com/kb/1031/install-linux
tailscale upand the CLI: https://tailscale.com/kb/1080/cli- Download for every platform: https://tailscale.com/download
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.
- ufw guide (Ubuntu): https://documentation.ubuntu.com/server/how-to/security/firewalls/
- ufw community reference: https://help.ubuntu.com/community/UFW
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 to0.0.0.0. Always bind to the Tailscale IP.
So in every compose file you’ll see ports written as:
ufw-docker, but binding to the tailnet is enough for a single box.)
1.4 Lock SSH to the mesh (recommended)
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:
✅ Verification (must pass before Step 2)
From your laptop (on Tailscale):100. address and ufw shows default-deny, the edge is locked. This is the load-bearing step — everything else sits behind it.