ssh-bridge 1.1.0: fleet relay per brief - persistent /data/home/bridge (bash), git+openssh-client pkgs, busybox crond with /data/crontabs spool, accept-dns=true, MaxSessions 20, no ForceCommand
This commit is contained in:
1 parent
83be6c6309
commit
685b3542e9
5 files changed
+58
-56
No files matched your search
+15
-4
@@ -1,8 +1,10 @@
|
||||
#!/bin/ash
|
||||
set -e
|
||||
|
||||
# Persistent state lives in the add-on's /data (survives restarts/HAOS updates).
|
||||
mkdir -p /data/ssh
|
||||
# Everything persistent lives under /data (survives restarts and updates).
|
||||
mkdir -p /data/ssh /data/home/bridge /data/crontabs
|
||||
chown bridge:bridge /data/home/bridge /data/crontabs
|
||||
chmod 700 /data/home/bridge
|
||||
|
||||
# --- tailscaled (real TUN inside this container's netns; host never joins tailnet)
|
||||
tailscaled \
|
||||
@@ -20,13 +22,16 @@ until [ -e /var/run/tailscale/tailscaled.sock ]; do
|
||||
done
|
||||
|
||||
# Auth key is a file in /share (never shown in the add-on options UI).
|
||||
# --accept-dns=true: MagicDNS for tailnet names; non-tailnet names (internet
|
||||
# and *.local.hass.io) are forwarded to the container's upstream resolver,
|
||||
# which is HAOS DNS.
|
||||
if [ -r /share/ssh-bridge/tailscale_authkey ]; then
|
||||
AUTHKEY="$(cat /share/ssh-bridge/tailscale_authkey)"
|
||||
# shellcheck disable=SC2086
|
||||
tailscale up \
|
||||
--authkey="$AUTHKEY" \
|
||||
--hostname="${tailscale_hostname:-ssh-bridge}" \
|
||||
--accept-dns=false \
|
||||
--accept-dns=true \
|
||||
${tailscale_extra_args} \
|
||||
--reset
|
||||
unset AUTHKEY
|
||||
@@ -34,7 +39,13 @@ else
|
||||
echo "WARN: /share/ssh-bridge/tailscale_authkey missing; tailscale node not registered"
|
||||
fi
|
||||
|
||||
# --- sshd host key (generated once, kept in /data)
|
||||
# --- busybox crond with a persistent crontab spool (user-owned crontabs,
|
||||
# e.g. bridge's fleet supervise entry). -b daemonizes; logs to /data.
|
||||
ln -sfn /data/crontabs /var/spool/cron/crontabs
|
||||
crond -b -l 6 -L /data/cron.log
|
||||
|
||||
# --- sshd host key (generated once, kept in /data; never regenerate —
|
||||
# client hosts pin this fingerprint)
|
||||
if [ ! -f /data/ssh/ssh_host_ed25519_key ]; then
|
||||
ssh-keygen -q -t ed25519 -N "" -f /data/ssh/ssh_host_ed25519_key
|
||||
fi
|
||||
|
||||
Reference in new issue
Block a user