diff --git a/ssh-bridge/Dockerfile b/ssh-bridge/Dockerfile index bf00cb6..b56c9a8 100644 --- a/ssh-bridge/Dockerfile +++ b/ssh-bridge/Dockerfile @@ -2,8 +2,11 @@ FROM alpine:3.22 RUN apk add --no-cache openssh tailscale -# Low-privilege login account; nologin shell — sessions exist only to forward. -RUN adduser -D -H -s /sbin/nologin bridge +# Low-privilege login account, key-only. ash shell so interactive jump +# sessions (ssh bridge@... then ssh onward) work; -D leaves shadow "!" +# (locked) which OpenSSH rejects even for pubkey auth, so unlock it. +# Password auth stays off in sshd_config, so an empty password field is inert. +RUN adduser -D -H -s /bin/ash bridge && passwd -u bridge COPY sshd_config /etc/ssh/sshd_config COPY run.sh /run.sh diff --git a/ssh-bridge/README.md b/ssh-bridge/README.md index 3e61ecc..6d3a30c 100644 --- a/ssh-bridge/README.md +++ b/ssh-bridge/README.md @@ -30,7 +30,7 @@ yellow:2223 (LAN/WAN), then jumps to tailnet hosts or opens a SOCKS proxy ## 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, nologin shell user. +- 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, diff --git a/ssh-bridge/config.yaml b/ssh-bridge/config.yaml index a03f352..54341a5 100644 --- a/ssh-bridge/config.yaml +++ b/ssh-bridge/config.yaml @@ -1,5 +1,5 @@ name: "SSH Bridge (Tailscale)" -version: "1.0.3" +version: "1.0.4" slug: "ssh_bridge" description: "Contained tailscale+sshd jump host for tailnet access. Runs in its own network namespace; Home Assistant and the host itself do NOT join the tailnet." url: "https://git.halfast.com/hermes/ha-addons" diff --git a/ssh-bridge/sshd_config b/ssh-bridge/sshd_config index 3a3caa6..16916b1 100644 --- a/ssh-bridge/sshd_config +++ b/ssh-bridge/sshd_config @@ -5,9 +5,9 @@ ListenAddress 0.0.0.0 HostKey /data/ssh/ssh_host_ed25519_key # Hard limits -UsePAM no -# (Alpine's PAM rejects passwordless accounts as "locked" before key auth is -# tried; this container has no PAM-dependent needs — key-only by design.) +# (No UsePAM here: Alpine's OpenSSH is built without PAM and rejects the +# option. The "account is locked" check is OpenSSH's own; the bridge account +# is unlocked in the Dockerfile instead.) PermitRootLogin no PasswordAuthentication no KbdInteractiveAuthentication no