57 lines
3.3 KiB
Markdown
57 lines
3.3 KiB
Markdown
# ssh-bridge — contained SSH→Tailscale fleet relay as a Home Assistant add-on
|
|
|
|
What this is: one Alpine container running tailscaled + sshd + crond. tailscale0
|
|
lives in the container's own network namespace. The HAOS host and HA core never
|
|
join the tailnet and the container has no HA API access. Work laptops SSH to
|
|
`ev46.halfast.com:22403` (router → Yellow:2223), then jump to tailnet hosts,
|
|
run SOCKS (`ssh -D`), ProxyJump (`ssh -W`), cron fleet supervision, and
|
|
git-over-ssh (`~/fleet.git`).
|
|
|
|
## Roles
|
|
1. Jump host: sshd (key-only, user `bridge`), host port 2223, container 2222.
|
|
Host key pinned at /data/ssh/ssh_host_ed25519_key — never regenerate;
|
|
clients pin its fingerprint.
|
|
2. Tailnet DNS: `tailscale up --accept-dns=true` (MagicDNS for tailnet names;
|
|
internet + *.local.hass.io forwarded to HAOS DNS).
|
|
3. Supervisor: persistent home /data/home/bridge (bash), busybox crond with
|
|
crontabs spooled in /data/crontabs (survives updates).
|
|
4. Git host: git installed (git-upload-pack/git-receive-pack on PATH),
|
|
no ForceCommand — non-interactive `ssh host cmd` works.
|
|
|
|
## Files
|
|
- config.yaml add-on manifest (NET_ADMIN + /dev/net/tun only; ports)
|
|
- Dockerfile alpine + openssh + tailscale + bash + git
|
|
- sshd_config key-only, AllowUsers bridge, MaxSessions 20, forwarding on
|
|
- run.sh persistent dirs -> tailscaled -> tailscale up -> crond -> sshd
|
|
|
|
## One-time setup (user-driven)
|
|
1. Source of truth: `hermes/ha-addons` (public, root `repository.yaml` manifest).
|
|
Already registered on the Yellow as repo `087e3765` "Halfast HA Add-ons";
|
|
this add-on installs from there. (A reference copy also lives in murphy/ha.)
|
|
2. Create `/share/ssh-bridge/` on the HA host (Samba share or File editor):
|
|
- `authorized_keys` your laptop public keys, one per line, file must
|
|
end with a newline (append-safe)
|
|
- `tailscale_authkey` a REUSABLE auth key from the Tailscale admin console
|
|
(Keys → Generate auth key → reusable, ephemeral OFF,
|
|
expiry 90d is fine; pre-authorize the node and add
|
|
the tag there if using auto-tags)
|
|
3. Start the add-on. First start registers the node `ssh-bridge`.
|
|
4. Router: forward WAN port 22403 → Yellow LAN IP:2223.
|
|
Keep the NAS VM bridge running until the new one is proven, then retire it.
|
|
5. Laptops: update ~/.ssh/config Host entries to the new port/host.
|
|
|
|
## What it deliberately does NOT do
|
|
- No advertise_routes, no exit node → the bridge exposes zero LAN to the tailnet.
|
|
- No hassio_api/homeassistant_api → cannot reach HA even from inside the container.
|
|
- No password auth, no root login. Key-only bash user for jump sessions.
|
|
|
|
## Notes / known edges
|
|
- Chrome + SOCKS: QUIC (UDP) bypasses the SOCKS tunnel; sites that prefer QUIC
|
|
may fall back to TCP or fail — normal for ssh -D setups, worth knowing.
|
|
- `--accept-dns=true` makes tailnet MagicDNS the container resolver; non-tailnet
|
|
queries forward to HAOS DNS (covers github.com and *.local.hass.io).
|
|
- Reusable authkey in /share means HAOS/add-on restarts re-join without UI
|
|
interaction and keep the same tailnet identity (untagged, user-owned).
|
|
- Everything persistent is under /data: host key, tailscale state, bridge home,
|
|
crontabs. Add-on updates rebuild the image but keep /data.
|