From e27296da3c1b3daab9b0cc2f35d4a0589bef500f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Pierret=20=28fepitre=29?= Date: Thu, 8 Aug 2019 15:10:52 +0200 Subject: [PATCH] Allow creating TCP sockets between qubes QubesOS/qubes-issues#2148 --- Makefile | 1 + debian/qubes-core-agent.install | 1 + qubes-rpc/qubes.ConnectTCP | 10 ++++++++++ rpm_spec/core-agent.spec.in | 1 + 4 files changed, 13 insertions(+) create mode 100644 qubes-rpc/qubes.ConnectTCP diff --git a/Makefile b/Makefile index 65fee25..b0e1cc9 100644 --- a/Makefile +++ b/Makefile @@ -281,6 +281,7 @@ install-common: install-doc install -m 0755 qubes-rpc/qubes.PostInstall $(DESTDIR)/etc/qubes-rpc install -m 0755 qubes-rpc/qubes.GetDate $(DESTDIR)/etc/qubes-rpc install -m 0755 qubes-rpc/qubes.ShowInTerminal $(DESTDIR)/etc/qubes-rpc + install -m 0755 qubes-rpc/qubes.ConnectTCP $(DESTDIR)/etc/qubes-rpc install -d $(DESTDIR)/etc/qubes/rpc-config for config in qubes-rpc/*.config; do \ install -m 0644 $$config $(DESTDIR)/etc/qubes/rpc-config/`basename $$config .config`; \ diff --git a/debian/qubes-core-agent.install b/debian/qubes-core-agent.install index fb136aa..e90651c 100644 --- a/debian/qubes-core-agent.install +++ b/debian/qubes-core-agent.install @@ -28,6 +28,7 @@ etc/qubes-rpc/qubes.SuspendPost etc/qubes-rpc/qubes.SuspendPostAll etc/qubes-rpc/qubes.SuspendPre etc/qubes-rpc/qubes.SuspendPreAll +etc/qubes-rpc/qubes.ConnectTCP etc/qubes-rpc/qubes.VMShell etc/qubes-rpc/qubes.VMRootShell etc/qubes-rpc/qubes.WaitForSession diff --git a/qubes-rpc/qubes.ConnectTCP b/qubes-rpc/qubes.ConnectTCP new file mode 100644 index 0000000..c9493d8 --- /dev/null +++ b/qubes-rpc/qubes.ConnectTCP @@ -0,0 +1,10 @@ +#!/bin/bash +PORT="$1" +[[ -z "$PORT" ]] && { echo "Please provide PORT"; exit 1; }; + +if [[ "$PORT" -ge 1 ]] && [[ "$PORT" -le 65535 ]]; then + socat STDIO TCP:localhost:"$PORT" +else + echo "Invalid port provided" + exit 1 +fi diff --git a/rpm_spec/core-agent.spec.in b/rpm_spec/core-agent.spec.in index f60b0c6..e4800e4 100644 --- a/rpm_spec/core-agent.spec.in +++ b/rpm_spec/core-agent.spec.in @@ -549,6 +549,7 @@ rm -f %{name}-%{version} %config(noreplace) /etc/qubes-rpc/qubes.OpenInVM %config(noreplace) /etc/qubes-rpc/qubes.OpenURL %config(noreplace) /etc/qubes-rpc/qubes.GetAppmenus +%config(noreplace) /etc/qubes-rpc/qubes.ConnectTCP %config(noreplace) /etc/qubes-rpc/qubes.VMShell %config(noreplace) /etc/qubes-rpc/qubes.VMRootShell %config(noreplace) /etc/qubes-rpc/qubes.SuspendPre