summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2022-02-24 11:41:05 -0500
committerAndrew Cady <d@jerkface.net>2022-02-24 11:41:11 -0500
commit44e506b3b4c1c3356f3f8c84eafe6b4e41b265e7 (patch)
tree6c6d5335e200804807c4f74fa7c4bbadc990f255
parentf56618e40f95d668f869c29683e25a4ccbb3c78d (diff)
Successfully eliminated TCP port on both sides!
This requires relying on xtigervncviewer on the remote side, since only tiger supports connecting to a unix socket file. This is for -r only. The regular connection still uses TCP :(
-rwxr-xr-xdot/local/bin/xvnc20
1 files changed, 10 insertions, 10 deletions
diff --git a/dot/local/bin/xvnc b/dot/local/bin/xvnc
index 375d13a..7eba3f2 100755
--- a/dot/local/bin/xvnc
+++ b/dot/local/bin/xvnc
@@ -1,4 +1,6 @@
1#!/bin/bash 1#!/bin/bash
2set -e
3set -o pipefail
2 4
3# x11vnc option '-noxrecord' added as workaround for crashing bug 5# x11vnc option '-noxrecord' added as workaround for crashing bug
4# See https://github.com/LibVNC/x11vnc/issues/61 6# See https://github.com/LibVNC/x11vnc/issues/61
@@ -44,25 +46,23 @@ share_display()
44 46
45 port=5500 47 port=5500
46 OUR_TMP=$(mktemp -d) || exit 48 OUR_TMP=$(mktemp -d) || exit
47 socket_file=$OUR_TMP/x11vnc.socket 49 local_socket_file=$OUR_TMP/x11vnc.socket
50 ssh_control=$OUR_TMP/ssh.socket
48 51
49 # killall x11vnc 52 x11vnc -noxrecord -q -nopw -ncache -ncache_cr -display "${local_display}" -unixsock "$local_socket_file" -rfbport 0 &
50 x11vnc -noxrecord -q -nopw -ncache -ncache_cr -display "${local_display}" -unixsock "$socket_file" &
51 X11VNC=$! 53 X11VNC=$!
52 trap atexit EXIT 54 trap atexit EXIT
53 55
54 # TODO: spin waiting for port 5500 56 rando=$(tr -dc A-Za-z0-9 < /dev/urandom | head -c15) && [ "$rando" ]
55 ssh -n \ 57 remote_socket_file=/tmp/xtigervncviewer.$rando.socket
56 ${remote_port:+ -p "$remote_port" } \ 58
57 "$remote_host" \
58 "fuser -vk $port/tcp && sleep 1"
59 ssh -n \ 59 ssh -n \
60 -o ControlPath=none \ 60 -o ControlPath=none \
61 -o ExitOnForwardFailure=yes \ 61 -o ExitOnForwardFailure=yes \
62 -R "localhost:$port:$socket_file" \ 62 -R "$remote_socket_file:$local_socket_file" \
63 ${remote_port:+ -p "$remote_port" } \ 63 ${remote_port:+ -p "$remote_port" } \
64 "$remote_host" \ 64 "$remote_host" \
65 "DISPLAY=${remote_display} xvncviewer localhost:$port" 2>&1 & 65 "${DEBUG:+ set -x; } trap 'rm -f $remote_socket_file' EXIT; DISPLAY=$remote_display xtigervncviewer $remote_socket_file" &
66 SSH=$! 66 SSH=$!
67 wait -n 67 wait -n
68} 68}