Skip to content

Lesson 4 of 14 · 18m

Put Admin Surfaces on a Tailnet

Tailscale/WireGuard take SSH, Grafana, and Portainer off the public internet entirely — an access boundary, not a privacy product.

The most-attacked interfaces on a homelab aren't the apps you publish — they're the admin panels you didn't mean to expose. Portainer, a Grafana, a database web UI, phpMyAdmin, SSH itself: none of these need to be reachable by the public internet at all. The industry-standard fix is not a stronger password on a public panel. It's taking the panel off the public internet.

The mesh, mechanically

Tailscale is a WireGuard-based mesh VPN. Two components, worth separating: the coordination server exchanges public keys and brokers NAT traversal — it learns which peers exist and where they are, but never sees payload data. The data plane is pure WireGuard: node-to-node, end-to-end encrypted with the Noise IK handshake, peer IPs drawn from 100.64.0.0/10. When direct UDP paths fail — CGNAT on both ends — traffic falls back to DERP relays, which relay ciphertext they cannot read.

curl -fsSL https://tailscale.com/install.sh | sh
sudo tailscale up
tailscale ip -4        # your box's stable 100.x address

Laptop, phone, and server all join the tailnet; MagicDNS gives them names. The box is now reachable at an address that only exists for devices in your mesh.

Then close the door behind it

sudo ufw allow in on tailscale0 to any port 22
sudo ufw delete allow 22/tcp

SSH now answers only on the tailnet interface — auth.log goes quiet overnight because the internet physically cannot reach the port. The same pattern for every admin surface: bind Grafana to the tailnet IP, or tailscale serve --bg 3000 to expose a localhost port to the tailnet only. tailscale funnel does the opposite — exposes a service to the public internet through Tailscale's edge — which is sometimes exactly what you want and is worth knowing is a different, deliberate thing.

Tailscale SSH (tailscale up --ssh) goes further: it replaces authorized_keys with your tailnet's ACL policy, so access is granted by identity in the admin console instead of by key files scattered across machines. Offboarding = remove from ACLs, not revoke keys you can't enumerate.

The privacy-product misconception

The wrong mental model: "VPN means anonymity." This VPN is an access boundary, not a privacy product — the coordination server sees connection metadata (which nodes talk, when) even though it can't see content. If that's unacceptable, Headscale is a self-hosted drop-in coordination server that runs the same Tailscale clients. For purists, raw WireGuard: wg-quick with a wg0.conf of [Interface] PrivateKey/ListenPort 51820 and [Peer] PublicKey/AllowedIPs — a single UDP port, auditable in an afternoon, no third party at all. The tradeoff is real: Tailscale solves NAT traversal, key distribution, and device management for free; raw WireGuard solves nothing but transport, and you own every hard part.

Why this matters, in evidence

In December 2021, CVE-2021-43798 gave unauthenticated path traversal on internet-facing Grafana — /plugins/ endpoints serving /etc/passwd to anyone who asked — and it was mass-exploited within days. Every instance behind a tailnet was unreachable for the entire attack. That's the claim, concretely: the best exploit mitigations for admin surfaces are ones where the attacker can't send a packet to the vulnerable code at all.

Field notes

  • ACLs live in the Tailscale admin console as a HuJSON policy file — keep it minimal: your devices, your ports, nothing else.
  • The VPS provider's rescue console still reaches the box; that's the fallback path, not a violation of the model.
  • Tailscale needs no inbound firewall rule — connections are outbound NAT-traversing. On a box you only reach via tailnet, verify ssh deploy@boxname works before closing public 22.
  • tailscale status shows which peers are direct versus relayed — a box permanently on DERP relays is a NAT problem worth chasing, not a mystery to accept.

Was this lesson helpful?

Sign in to rate

Keep reading

Related articles from the SudoSecurity blog.