How is hAPI reachable on the network? #45

Closed
opened 2026-11-23 16:05:22 -05:00 by bobby · 1 comment
Owner

Part of #44

Question

Which parts of hAPI are reachable from where? Persons must reach hAPI from anywhere without a VPN; Bots (including Home Assistant) will mostly come from the Owner's home LAN. The Owner's lean is hybrid: a narrow public surface for Persons, everything Bot-facing reachable only over a private link from home. Decide the public surface, the private path, and what is never exposed (admin, DB, broker, cluster API). Consider whether the public surface should sit behind an identity-aware proxy vs. the API's own auth.

Part of #44 ## Question Which parts of hAPI are reachable from where? Persons must reach hAPI from anywhere **without a VPN**; Bots (including Home Assistant) will mostly come from the Owner's home LAN. The Owner's lean is **hybrid**: a narrow public surface for Persons, everything Bot-facing reachable only over a private link from home. Decide the public surface, the private path, and what is never exposed (admin, DB, broker, cluster API). Consider whether the public surface should sit behind an identity-aware proxy vs. the API's own auth.
bobby added the wayfinder:grilling label 2026-11-23 16:05:22 -05:00
bobby added a new dependency 2026-11-23 16:05:34 -05:00
bobby added a new dependency 2026-11-23 16:05:35 -05:00
bobby added a new dependency 2026-11-23 16:05:35 -05:00
bobby added a new dependency 2026-11-23 16:05:35 -05:00
bobby self-assigned this 2026-11-23 21:44:26 -05:00
Author
Owner

Resolution

One public surface, gated only by hAPI's own auth; no tunnel to home. Recorded as ADR-0002.

Key constraint: the home network sits behind ISP CGNAT with a changing IP. The cluster can't open connections into the home, and the home IP can't be allowlisted (a CGNAT address is shared with other customers).

  • Public surface: the hAPI API over HTTPS on :443, for Persons and Bots alike. No identity-aware proxy or CDN (no Cloudflare): no third party in the public request path.
  • Bots: no separate network path (no VPN, no Bot port, no client certs in v1). A cron job is just curl with a token. In exchange, Bot credentials must be per-Bot, scoped, individually revocable, and stored hashed; a long-lived JWT that can't be revoked is not acceptable.
  • Cluster ↔ home: traffic only ever starts from home. The HA job bridge must be one that HA connects out to.
  • Rule for every public endpoint: TLS-only, per-Principal auth, no anonymous endpoints. Uptime Kuma is a Bot with a health-only scope. :80 is closed, so certificates use ACME DNS-01. A public broker is allowed under the same rule.
  • Owner administration: no HTTP route. An admin CLI runs inside the hAPI pod, reached through cluster management access. Persons' own actions, including granting Bindings, stay on the public API.
  • Management access: the Kubernetes and Talos APIs are never public. They're reachable only over a management-only Tailscale tailnet (node extension plus the Owner's devices) with Tailnet Lock on, which works because the k8s operator isn't used. Break-glass: Linode LISH, or a temporary firewall rule for the Owner's current IP.
  • Never public: the database, metrics, detailed health, internal services.

Rejected alternatives: a tunnel for every Bot (Tailscale operator or WireGuard), client-cert-gated Bot endpoints, and an IAP/CDN. Reasons are in the ADR.

Supporting facts gathered during grilling: Gateway API client-cert validation (GEP-91) is set per port, not per hostname, and is in Cilium only in v1.21.0-pre. HA can present a client cert only over MQTT (rest/rest_command can't). Talos has no SSH (talosctl uses mTLS on 50000) and has an official Tailscale extension. Tailscale connects directly behind CGNAT once the public peer opens UDP 41641.

## Resolution **One public surface, gated only by hAPI's own auth; no tunnel to home.** Recorded as [ADR-0002](https://git.bobbypalko.com/bobby/hapi/src/branch/main/docs/adr/0002-network-exposure.md). Key constraint: the home network sits behind **ISP CGNAT** with a changing IP. The cluster can't open connections into the home, and the home IP can't be allowlisted (a CGNAT address is shared with other customers). - **Public surface:** the hAPI API over HTTPS on `:443`, for Persons and Bots alike. No identity-aware proxy or CDN (no Cloudflare): no third party in the public request path. - **Bots:** no separate network path (no VPN, no Bot port, no client certs in v1). A cron job is just `curl` with a token. In exchange, Bot credentials must be **per-Bot, scoped, individually revocable, and stored hashed**; a long-lived JWT that can't be revoked is not acceptable. - **Cluster ↔ home:** traffic only ever starts from home. The HA job bridge must be one that HA connects out to. - **Rule for every public endpoint:** TLS-only, per-Principal auth, no anonymous endpoints. Uptime Kuma is a Bot with a health-only scope. `:80` is closed, so certificates use ACME DNS-01. A public broker is allowed under the same rule. - **Owner administration:** no HTTP route. An admin CLI runs inside the hAPI pod, reached through cluster management access. Persons' own actions, including granting Bindings, stay on the public API. - **Management access:** the Kubernetes and Talos APIs are never public. They're reachable only over a management-only Tailscale tailnet (node extension plus the Owner's devices) with **Tailnet Lock** on, which works because the k8s operator isn't used. Break-glass: Linode LISH, or a temporary firewall rule for the Owner's current IP. - **Never public:** the database, metrics, detailed health, internal services. Rejected alternatives: a tunnel for every Bot (Tailscale operator or WireGuard), client-cert-gated Bot endpoints, and an IAP/CDN. Reasons are in the ADR. Supporting facts gathered during grilling: Gateway API client-cert validation (GEP-91) is set **per port**, not per hostname, and is in Cilium only in v1.21.0-pre. HA can present a client cert **only over MQTT** (`rest`/`rest_command` can't). Talos has no SSH (`talosctl` uses mTLS on 50000) and has an official Tailscale extension. Tailscale connects directly behind CGNAT once the public peer opens UDP 41641.
bobby closed this issue 2026-11-23 22:09:50 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: bobby/hapi#45