68 lines
3.5 KiB
Markdown
68 lines
3.5 KiB
Markdown
# ssh-bridge — contained SSH→Tailscale jump host as a Home Assistant local add-on
|
|
|
|
What this is: one Alpine container running tailscaled + sshd. 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 laptop SSHes to
|
|
yellow:2223 (LAN/WAN), then jumps to tailnet hosts or opens a SOCKS proxy
|
|
(`ssh -N -D 1080 bridge@...`) exactly like the old NAS VM did.
|
|
|
|
## Files
|
|
- config.yaml add-on manifest (NET_ADMIN + /dev/net/tun only; port 2223 on host, 2222 in-container)
|
|
- Dockerfile alpine + openssh + tailscale (community repo, in-image default)
|
|
- sshd_config key-only, AllowUsers bridge, forwarding on, everything else off
|
|
- run.sh tailscaled -> tailscale up (authkey from /share) -> 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
|
|
- `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 new WAN port (e.g. 2222) → 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 ash user for jump sessions.
|
|
|
|
## Tailscale ACL additions (merge into existing policy — review current first!)
|
|
Default Tailscale policy is allow-all; if the tailnet already has custom rules,
|
|
these must be ADDED, not pasted over. Sketch:
|
|
|
|
```
|
|
// auto-tag the bridge node by hostname
|
|
"autoTags": [
|
|
{ "match": "name:ssh-bridge", "tag": "tag:ssh-bridge" }
|
|
],
|
|
|
|
"acl": [
|
|
// bridge -> SSH jump targets only (tag the hosts, or list them)
|
|
{ "action": "accept", "src": ["tag:ssh-bridge"], "dst": ["tag:jump-hosts:22"] },
|
|
|
|
// bridge -> web UIs for the SOCKS/Chrome path (tag UI services 'web')
|
|
{ "action": "accept", "src": ["tag:ssh-bridge"], "dst": ["tag:web:443,80"] },
|
|
|
|
// no rule grants anything else: deny-by-default catches the rest.
|
|
// IMPORTANT: if the existing policy has a catch-all allow (default policy),
|
|
// the bridge inherits it — that catch-all must be narrowed for containment.
|
|
]
|
|
```
|
|
|
|
Tagging: in the admin console, add `tag:jump-hosts` to the hosts you ssh to and
|
|
`tag:web` to Grafana/Gitea/Longhorn-UI/etc. New services get tagged, no policy edits.
|
|
|
|
## 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=false` keeps tailnet MagicDNS from hijacking the container's resolver.
|
|
- Reusable authkey in /share means HAOS/add-on restarts re-join without UI interaction.
|
|
- The add-on rebuilds on install (tiny alpine layer set; fine on the Yellow).
|
|
Subsequent HAOS updates keep the built image.
|