Skip to content

Networking

Every client, host agent, and node connects over iroh: end-to-end encrypted QUIC authenticated by each peer’s cryptographic key. Nodes need no public IP and no inbound TCP port.

Your client file pins every node by its node_id. anastroctl dials that key—trying direct addrs and the node’s relay in parallel and upgrading to a direct path whenever possible. Addresses and relay URLs are just hints; the handshake fails unless the remote peer proves it owns the pinned key.

Each node owns a single iroh endpoint on UDP 7444 (machined), serving the node API directly and forwarding cluster API streams to apid. That keeps the node API reachable even if apid or Postgres is down.

Relays forward encrypted datagrams when two endpoints can’t punch through directly (relays never see plaintext).

anastro.toml
[iroh]
run_relay = true # every control-plane node runs a relay
# nodes/cp1.toml
[node.iroh]
relay_url = "http://10.10.0.11:3340" # this node's home relay
  • With run_relay = true, each control-plane node runs a relay on TCP 3340 on its private IP and must set a unique relay_url (copy that URL into your client file’s relay field).
  • Worker-only nodes set relay_url to one of your control-plane nodes’ relays.
  • Without run_relay, list your own external relays in iroh.relays.

Anastro never uses public iroh relays or public discovery—relays only forward traffic for enrolled cluster endpoints.

Nodes drop unknown peers right after the QUIC handshake, admitting only:

Peer Authorized via Access
Operator key Listed in running cluster.operator_keys Full node API admin; host list/cordon/drain/rebalance on cluster API
Enrolled device Approved by a user or enrolled via link That user’s org and project roles
Cluster node Registered or listed in signed config Cluster traffic
Host agent Registered with node proof Host-agent protocol only

Every node caches the enrolled peer list from Postgres locally so existing peers can still connect if Postgres goes down. Revoked devices are cut off within seconds.

The node OS firewall drops all inbound traffic except:

Port Proto Allowed from Purpose
7444 UDP Anywhere Node iroh endpoint (node API, cluster API, peers)
7445 UDP Anywhere Worker host agent (commands, terminals, live moves)
5432 TCP network.private.cidr Postgres
8008 TCP network.private.cidr Patroni API (3 or 5 nodes)
2379, 2380 TCP network.private.cidr etcd client and peer (3 or 5 nodes)
5433, 8009 TCP network.private.cidr Parallel Postgres + Patroni during a major upgrade
3340 TCP network.private.cidr Built-in relay (iroh.run_relay)
3901, 3903 TCP network.private.cidr In-cluster Garage (storage role)

Keep control-plane nodes on a low-latency private LAN—every HA Postgres commit waits for a replica. See Ports and protocols for loopback sockets, guest vsock ports, and outbound destinations.

Linux machines each get a stable IP (preserved across live moves) and reach the public internet through host NAT. Host nftables rules block them from reaching other machines, the host itself, private/CGNAT/link-local ranges, the host’s LAN, or any non-default route.

Web traffic (TCP 80 and 443) passes through anastro-egress on the host, which inspects package registries and logs SNI/hostnames. QUIC (UDP 443) is inspected for hostname and dropped for package registries so clients fall back to TCP. See Package firewall.

HA clusters secure etcd peer traffic with mutual TLS using per-member certificates stored in secrets.age. Leaf certificates last a year and the CA ten; each control-plane node raises CertExpiringSoon 30 days before either ends. Renew leaf certificates before expiry:

Terminal window
anastroctl cluster bundle renew-etcd
anastroctl cluster unseal

Rotate the etcd peer CA in three stages—waiting for every node to receive each stage before moving on—so all members trust the new CA before switching to it:

Terminal window
anastroctl cluster bundle etcd-ca prepare
anastroctl cluster unseal
anastroctl cluster bundle etcd-ca activate
anastroctl cluster unseal
anastroctl cluster bundle etcd-ca finish
anastroctl cluster unseal

Commit the updated secrets.age afterward.

The API and web UI intentionally have no public HTTPS endpoint. anastroctl ui and the native apps connect over iroh as your enrolled device; device sign-in (anastroctl login, invites, recovery links) and anastroctl cluster recover travel over iroh as well.

An optional, locally managed Cloudflare Tunnel exposes public hostnames without opening inbound ports or needing a public IP—strictly for three things:

  • Per-node relays (e.g. relay-1.example.com, one hostname per control-plane node since relays are stateful). Cloudflare only sees encrypted iroh traffic.
  • One hooks hostname (e.g. hooks.example.com) for GitHub webhooks, GitHub/connector OAuth redirects, and the cluster’s signed /.well-known/anastro discovery document.
  • Nothing else. The API and web UI are never routed through the tunnel; everything else returns 404.

Ingress rules come strictly from your signed cluster config (not the Cloudflare dashboard), and the node firewall restricts cloudflared to Cloudflare’s edge and its own local ingress ports.

Set up the tunnel with cloudflared on your workstation:

Terminal window
cloudflared tunnel login
cloudflared tunnel create anastro
anastroctl cluster bundle set cloudflare/tunnel_credentials < ~/.cloudflared/<tunnel-id>.json
cloudflared tunnel route dns anastro hooks.example.com
cloudflared tunnel route dns anastro relay-1.example.com # one per control-plane node

Enable it in anastro.toml and point each control-plane node’s relay_url at its tunnel hostname:

anastro.toml
[cloudflare]
enabled = true
tunnel_id = "<tunnel-id>"
credentials = "secret:cloudflare/tunnel_credentials"
hooks_hostname = "hooks.example.com"
[iroh]
run_relay = true
# nodes/cp1.toml
[node.iroh]
relay_url = "https://relay-1.example.com"
Terminal window
anastroctl cluster unseal
anastroctl cluster apply

Note that Cloudflare’s free Universal SSL covers single-level subdomains (hooks.example.com), not deeper ones (hooks.anastro.example.com).

With the tunnel active, cluster apply signs /.well-known/anastro with your operator key so new workstations can discover the cluster by hostname: anastroctl login hooks.example.com --operator-key <key>.

Package firewall.