diff options
author | Gordon GECOS <u@adam> | 2023-05-31 20:54:28 -0400 |
---|---|---|
committer | Gordon GECOS <u@adam> | 2023-05-31 20:54:28 -0400 |
commit | 25911a0cb2569dcdbbcc4ac49f05addb9d9f74a5 (patch) | |
tree | d2512e69ca0940564103d99e723d40e7d3e1f6f4 | |
parent | c0a0041f01536a968584234a65e2140ad4f76343 (diff) |
also old changes
-rwxr-xr-x | xvnc | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -1,4 +1,10 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | # TODO: create systemd service for ssh-x11vnc@ with dependency service | ||
3 | # xvncviewer@ | ||
4 | # | ||
5 | # Restrict connections to the port opened by ssh in xvncviewer@ to the | ||
6 | # corresponding ssh-x11vnc@ service. | ||
7 | |||
2 | remote_display=0 | 8 | remote_display=0 |
3 | reverse_connection() | 9 | reverse_connection() |
4 | { | 10 | { |
@@ -7,9 +13,16 @@ reverse_connection() | |||
7 | remote_port=$((58000 + remote_display)) | 13 | remote_port=$((58000 + remote_display)) |
8 | 14 | ||
9 | local_port=$((59000 + display)) | 15 | local_port=$((59000 + display)) |
16 | fuser -vk $local_port/tcp | ||
10 | xvncviewer -listen $((local_port - 5500)) & | 17 | xvncviewer -listen $((local_port - 5500)) & |
11 | ssh "$@" -f -R "localhost:$remote_port:localhost:$local_port" -- \ | 18 | pid=$! |
12 | x11vnc -q -connect_or_exit localhost:$remote_port -display :$remote_display | 19 | ( |
20 | remote_display_arg=${remote_display:+ -display :$remote_display} | ||
21 | set -x | ||
22 | ssh "$@" -n -R "localhost:$remote_port:localhost:$local_port" -- \ | ||
23 | x11vnc -q -connect_or_exit localhost:$remote_port ${remote_display_arg:- -find} | ||
24 | ) | ||
25 | kill $pid | ||
13 | } | 26 | } |
14 | 27 | ||
15 | direct_connection() | 28 | direct_connection() |