Browse Source

Add qubes.ConnectTCP RPC for allowing dom0 sockets binding

Frédéric Pierret (fepitre) 4 years ago
parent
commit
7d1b6e24a9
3 changed files with 12 additions and 0 deletions
  1. 1 0
      Makefile
  2. 10 0
      qubes-rpc/qubes.ConnectTCP
  3. 1 0
      rpm_spec/core-dom0.spec.in

+ 1 - 0
Makefile

@@ -193,6 +193,7 @@ endif
 	cp qubes-rpc/qubes.GetRandomizedTime $(DESTDIR)/etc/qubes-rpc/
 	cp qubes-rpc/qubes.NotifyTools $(DESTDIR)/etc/qubes-rpc/
 	cp qubes-rpc/qubes.NotifyUpdates $(DESTDIR)/etc/qubes-rpc/
+	cp qubes-rpc/qubes.ConnectTCP $(DESTDIR)/etc/qubes-rpc/
 	install qubes-rpc/qubesd-query-fast $(DESTDIR)/usr/libexec/qubes/
 	install -m 0755 qvm-tools/qubes-bug-report $(DESTDIR)/usr/bin/qubes-bug-report
 	install -m 0755 qvm-tools/qubes-hcl-report $(DESTDIR)/usr/bin/qubes-hcl-report

+ 10 - 0
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

+ 1 - 0
rpm_spec/core-dom0.spec.in

@@ -406,6 +406,7 @@ fi
 /etc/qubes-rpc/qubes.GetRandomizedTime
 /etc/qubes-rpc/qubes.NotifyTools
 /etc/qubes-rpc/qubes.NotifyUpdates
+/etc/qubes-rpc/qubes.ConnectTCP
 %attr(2770,root,qubes) %dir /var/log/qubes
 %attr(0770,root,qubes) %dir /var/run/qubes