fix: secure spice temp file and localhost bind

This commit is contained in:
TimInTech committed 2026-01-10 23:56:25 +01:00
1 parent 2419a52157
commit d8fb9205b2
1 file changed
+6 -2
+6 -2
View File
@@ -502,7 +502,10 @@ spice_info() {
[[ -z "$port" ]] && port="$(grep -E "(spice).*port" "/var/log/qemu-server/${id}.log" 2>/dev/null | tail -1 | sed -n 's/.*port=\([0-9]\+\).*/\1/p')"
[[ -z "$port" ]] && port="$((61000 + id))"
printf '%s\n' "SPICE: spice://${host}:${port}"
local vv="/tmp/vm-${id}.vv"
umask 077
local vv
vv="$(mktemp -p "${TMPDIR:-/tmp}" "vm-${id}.XXXXXX.vv")" || { err "mktemp failed"; return 1; }
chmod 600 "$vv" || true
cat >"$vv" <<EOF
[virt-viewer]
type=spice
@@ -518,8 +521,9 @@ EOF
spice_enable() {
local id="$1"
local port="$((61000 + id))"
local addr="${PROXMOX_MANAGER_SPICE_ADDR:-127.0.0.1}"
qm set "$id" --vga qxl >/dev/null 2>&1 || true
if qm set "$id" --spice "port=${port},addr=0.0.0.0" >/dev/null 2>&1; then
if qm set "$id" --spice "port=${port},addr=${addr}" >/dev/null 2>&1; then
ok "SPICE für VM ${id} aktiviert. Port: ${port}. Neustart erforderlich."
printf '%s' "Jetzt neu starten? (y/N): "
local a