feat: systemd unit acties via podman-helper Unix socket

start/stop/restart van systemd units gaan nu via de host-helper
(/run/podman-helper.sock) in plaats van directe systemctl subprocess
vanuit de container. Hiermee wordt de user namespace isolatie omzeild
die D-Bus calls vanuit de container onbetrouwbaar maakt.

- common.py: _helper_call(action, unit) toegevoegd
- app_system.py: /{action}/{unit} route gebruikt helper voor start/stop/restart
- app_containers.py: container_action() gebruikt helper
- daemon-reload en is-active blijven subprocess (read-only, werkt al)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-22 11:24:25 +01:00
parent 580c301718
commit 7d2c205930
3 changed files with 35 additions and 2 deletions
+5 -1
View File
@@ -3,6 +3,7 @@ import subprocess
from fastapi import APIRouter, HTTPException
from common import (
_helper_call,
_podman_get_json as _common_podman_get_json,
_systemctl as _common_systemctl,
run,
@@ -93,7 +94,10 @@ def init_system_router(session, podman_api_base: str, workloads_dir: str) -> API
if action not in ("status", "start", "stop", "restart"):
raise HTTPException(status_code=400, detail="Invalid action")
cmd = ["systemctl", "--user", action, unit]
code, out = _run_systemctl_action(action, unit)
if action in ("start", "stop", "restart"):
code, out = _helper_call(action, unit)
else:
code, out = _run_systemctl_action(action, unit)
return {"cmd": " ".join(cmd), "exit": code, "output": out}
return router