feat: OS-aware service restarts and cross-platform shell detection #2
Loading…
Reference in a new issue
No description provided.
Delete branch "kmendell-fnl-fuzzy-adventure"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fleet updates permanently took Alpine (OpenRC) and OpenBSD (rc.d) nodes
offline: the agent only sent itself SIGTERM, and neither
command_background="yes" nor rc_bg=YES respawns anything. SSH sessions also
silently dropped every supplementary group, because leaving
syscall.Credential.Groups nil makes Go call setgroups(0, nil).
Add internal/platform, which detects the OS, distribution, init system and
container runtime, and maps each to a restart strategy: a native restart for
systemd and launchd, a plain exit where something respawns the service, and an
in-place syscall.Exec (preserving the pid, so rc.d and OpenRC pidfiles stay
valid) where nothing does. Both self-update paths use it, and an in-place
re-exec now shuts the SSH server down first so live sessions are not orphaned.
Rewrite login shell resolution to match sshd on every platform: parse both the
7-field and 10-field passwd layouts, defer to getent/dscl whenever the file
cannot answer authoritatively (absent user, NIS inclusion markers), validate
that the shell is an executable regular file, and fall back per-OS (ksh on the
BSDs, ash on musl, zsh on macOS). PATH now comes from login.defs, login.conf or
path_helper instead of a hardcoded Linux list, a missing home falls back to /,
and supplementary groups are restored.
Teach the installer about sysvinit, runit and s6, switch OpenRC to
supervise-daemon so an updated node comes back, and write service.env recording
what detection cannot know: the operator's service name and whether the unit
actually respawns. Nodes report their platform to the control plane, which
surfaces it in the servers list.
Co-authored-by: Copilot App 223556219+Copilot@users.noreply.github.com