fix: dom0 qrexec call target qube

This commit is contained in:
Ben Grande 2023-12-21 22:38:32 +01:00
parent a820751ba3
commit f21f676adf
2 changed files with 10 additions and 22 deletions

View File

@ -26,8 +26,8 @@ is_git_repo(){
helper="${0##*/git-}"
case "${1-}" in
-h|--?help) usage;;
"") qube="@default";;
*) qube="${1}";;
"") authority="@default";;
*) authority="${1}";;
esac
case "${2-}" in
"") is_git_repo; repo="$(basename "$(git rev-parse --show-toplevel)")";;
@ -40,18 +40,12 @@ default_qube="sys-git"
rpc_cmd="${vendor}.${rpc}+${repo}"
if command -v qrexec-client-vm >/dev/null; then
exec qrexec-client-vm -- "${qube}" "${rpc_cmd}"
exec qrexec-client-vm -- "${authority}" "${rpc_cmd}"
elif command -v qrexec-client >/dev/null; then
qubes_version="$(awk -F '=' '/^VERSION_ID=/{print $2}' /etc/os-release)"
if test "$(echo "${qubes_version}" | tr -d ".")" -le 41; then
if test "${qube}" = "@default"; then
qube="${default_qube}"
fi
else
policy="$(qrexec-policy --assume-yes-for-ask dom0 "${qube}" "${rpc_cmd}")"
qube="$(echo "${policy}" | awk -F '=' '/^target=/{print $2}')"
if test "${authority}" = "@default"; then
authority="${default_qube}"
fi
exec qrexec-client -d "${qube}" -- "DEFAULT:QUBESRPC ${rpc_cmd} dom0"
else
die "Qrexec programs not found: qrexec-client-vm, qrexec-client"
exec qrexec-client -d "${authority}" -- "DEFAULT:QUBESRPC ${rpc_cmd} dom0"
fi
die "Qrexec programs not found: qrexec-client-vm, qrexec-client"

View File

@ -69,14 +69,8 @@ if command -v qrexec-client-vm >/dev/null; then
log "->" qrexec-client-vm -- "${authority}" "${rpc_cmd}"
exec qrexec-client-vm -- "${authority}" "${rpc_cmd}"
elif command -v qrexec-client >/dev/null; then
qubes_version="$(awk -F '=' '/^VERSION_ID=/{print $2}' /etc/os-release)"
if test "$(echo "${qubes_version}" | tr -d ".")" -le 41; then
if test "${authority}" = "@default"; then
authority="${default_qube}"
fi
else
policy="$(qrexec-policy --assume-yes-for-ask dom0 "${authority}" "${rpc_cmd}")"
authority="$(echo "${policy}" | awk -F '=' '/^target=/{print $2}')"
if test "${authority}" = "@default"; then
authority="${default_qube}"
fi
log "->" qrexec-client -d "${authority}" -- "DEFAULT:QUBESRPC ${rpc_cmd} dom0"
exec qrexec-client -d "${authority}" -- "DEFAULT:QUBESRPC ${rpc_cmd} dom0"