Remote access
The Tailscale tailnet that reaches both sites' private addresses, and the grants that decide who reaches what.
Remote access is a Tailscale tailnet that the owner uses to reach both sites' private addresses from off the LAN. OpenTofu declares the tailnet, and Atlantis applies it.
Parts#
| Part | Job | Where it runs |
|---|---|---|
| Connector | Routes tailnet traffic into the site, and advertises its LAN networks, K8S_NODE_CIDR and LB_RANGE | One in each cluster |
policy.hujson | Holds the grants, and approves the Connectors' routes | Tailscale |
devices.tf | Authorizes each device, sets its key expiry and assigns its tags | Tailscale |
| CI identity | Lets the nixos-deploy workflow join as tag:ci with a GitHub OIDC token | GitHub Actions |
| forge OAuth client | Enrolls forge as tag:lab-host | forge |
The Kubernetes nodes run no Tailscale client (nix/system/tailscale-disable.nix), so tailnet traffic reaches each site through its Connector. folly's LAN networks are Management and the Anchor network, and offsite's is Default.
OpenTofu stores the forge client's secret in 1Password. After the Atlantis apply, copy it into forge's SOPS file as tailscale-auth-key.
Grants#
| Source | Reaches |
|---|---|
| The owner | Every tagged device, the owner's own devices, both sites' LAN networks, the offsite-bell subnet, and both clusters' node subnets and load-balancer addresses (VIPs) |
| Every tailnet member | tag:kthx-ingress, the kthx tailnet Ingress, on TCP port 443, and Tailscale SSH to their own devices after a fresh sign-in check |
tag:folly | offsite's node subnet, VIPs and Default network |
tag:offsite | folly's node subnet and VIPs |
tag:ci | tag:pi4 devices on TCP port 22 |
tag:gcp | Nothing |
The Connectors carry tag:k8s, tag:k8s-<site>, and tag:folly or tag:offsite. autoApprovers accepts routes from tag:k8s-folly and tag:k8s-offsite without review. devices.tf also gives tag:offsite to desktop-g7i75ls, which no host sheet covers. offsite-bell is an ipset in policy.hujson, and no UniFi root declares its subnet.
Rules#
- The CI identity accepts only
nixos-deploy.yamlruns onmain. - The tailnet requires device approval. A new device waits until Atlantis applies its entry in
devices.tf. policy.hujsonholds literal subnets. After a topology change, edit itsautoApprovers,ipsetsandtests. Otherwise new routes wait for approval, the grants deny the new range, and the policy apply fails.
Where it lives#
terraform/network/tailscale/: the tailnet settings, policy and device map, the CI identity ingithub_actions.tfand the forge client inoauth_clients.tfterraform/network/tailscale/fleet.tf.json: the tailnet nameclusters/base/networking/tailscale/: thetailscale-operatorHelmReleaseclusters/<site>/networking/tailscale-connectors/: each site's Connectornix/hosts/forge.nix: forge'stailscale-auth-keysecret
Related#
Linked from 5
- HostsEvery host in the homelab, with its role, site, hardware, OS and status, and how to reach it.
- NetBoxThe record of every machine in the lab, on capsule, reachable only over the tailnet.
- NetworkThe two sites, their UniFi gateways and networks, and the tunnel, routes, ingress and tailnet that connect them.
- Ingress and DNSThe Gateways, DNS records, certificates, tunnels and lab resolvers that give cluster services a name and a path from the LAN, tailnet or internet.
- GlossaryThe lab-specific terms that the wiki pages use, what each means, and the page that defines it.