From ce3cb1b60375a844d3762c9f6a5726bddec39cae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Pierret=20=28fepitre=29?= Date: Sat, 11 May 2019 12:11:31 +0200 Subject: [PATCH] admin.vm.Console: check if requested VM exists/is_running --- qubes-rpc/admin.vm.Console | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qubes-rpc/admin.vm.Console b/qubes-rpc/admin.vm.Console index 65b5765e..56a061b8 100755 --- a/qubes-rpc/admin.vm.Console +++ b/qubes-rpc/admin.vm.Console @@ -2,6 +2,8 @@ lock="/var/run/qubes/$QREXEC_REQUESTED_TARGET.terminal.lock" +qvm-check --quiet --running "$QREXEC_REQUESTED_TARGET" > /dev/null 2>&1 || { echo "Error: domain '$QREXEC_REQUESTED_TARGET' does not exist or is not running"; exit 1; } + # Create an exclusive lock to ensure that multiple qubes cannot access to the same socket # In the case of multiple qrexec calls it returns a specific exit code sudo flock -n -E 200 -x "$lock" socat - OPEN:"$(virsh -c xen ttyconsole "$QREXEC_REQUESTED_TARGET")"