fix(update): self-upgrade via sudo systemd-run + animiertes Modal

handler: edgeguard-User darf systemd-run nicht direkt aufrufen ("Inter-
active authentication required"). sudo -n + sudoers-Whitelist auf
exakt die Unit-Form für edgeguard-upgrade.service.

UI: UpdateBanner-Komponente neu — Pattern wie mail-gateway/enconf:
Banner mit Force-Check-Button + Popconfirm. Beim Apply zeigt full-
screen-Overlay mit animiertem Orbit (zwei Ringe + Dots), Versions-
sprung, vier Step-Indicators (Download/Install/Restart/Verify) und
Live-Timer. Poll auf /system/health detektiert Version-Flip ODER
"sah down dann up" und window.reload nach 1.5s. Sicherheits-Timeout
2 min schickt sonst auch reload.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Debian
2026-05-11 22:02:54 +02:00
parent 26f321de9d
commit 117d16e597
10 changed files with 247 additions and 161 deletions

View File

@@ -261,14 +261,22 @@ rm -f /tmp/edgeguard-upgrade.sh
}
const unitName = "edgeguard-upgrade.service"
_ = exec.Command("systemctl", "reset-failed", unitName).Run()
cmd := exec.Command("systemd-run",
// API läuft als edgeguard-User; systemd-run + systemctl reset-failed
// brauchen root. Sudoers-Whitelist in postinst lässt exakt diese
// beiden Aufrufe durch. Ohne sudo schlug das früher mit
// "Interactive authentication required" fehl und der Fallback
// (setsid bash als edgeguard) konnte kein apt-get update — das
// Modal blieb hängen und die Box nicht aktualisiert.
_ = exec.Command("sudo", "-n", "/usr/bin/systemctl", "reset-failed", unitName).Run()
cmd := exec.Command("sudo", "-n", "/usr/bin/systemd-run",
"--unit="+unitName,
"--description=EdgeGuard self-upgrade",
"--collect",
"bash", "/tmp/edgeguard-upgrade.sh")
if err := cmd.Run(); err != nil {
// systemd-run unavailable (dev env) — fall back to setsid
// systemd-run unavailable (dev env without sudo) — fall back
// to setsid. In Prod sollte das nie greifen.
slog.Warn("upgrade: sudo systemd-run failed, falling back to setsid", "error", err)
fallback := exec.Command("setsid", "bash", "/tmp/edgeguard-upgrade.sh")
fallback.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
if err2 := fallback.Start(); err2 != nil {