summaryrefslogtreecommitdiffstats
path: root/core/modules/remote-access
diff options
context:
space:
mode:
authorSimon Rettberg2020-10-05 15:43:45 +0200
committerSimon Rettberg2020-10-05 15:43:45 +0200
commit64052c706240be50288ac89a4cdc25907208c29f (patch)
tree2ddefac6730b5ac87967468bf19255137c590197 /core/modules/remote-access
parent[xorg] Improve intel matching for IRIS fix (diff)
downloadmltk-64052c706240be50288ac89a4cdc25907208c29f.tar.gz
mltk-64052c706240be50288ac89a4cdc25907208c29f.tar.xz
mltk-64052c706240be50288ac89a4cdc25907208c29f.zip
[remote-access] Make sure x11vnc doesn't restart with wrong X instance
We make a copy of the xauth cookie, so if the server restarts, we'll use the wrong one, which leads to a connection failure.
Diffstat (limited to 'core/modules/remote-access')
-rwxr-xr-xcore/modules/remote-access/data/etc/X11/Xsetup.d/50-launch-vncserver12
1 files changed, 9 insertions, 3 deletions
diff --git a/core/modules/remote-access/data/etc/X11/Xsetup.d/50-launch-vncserver b/core/modules/remote-access/data/etc/X11/Xsetup.d/50-launch-vncserver
index de244d9a..40c8d61d 100755
--- a/core/modules/remote-access/data/etc/X11/Xsetup.d/50-launch-vncserver
+++ b/core/modules/remote-access/data/etc/X11/Xsetup.d/50-launch-vncserver
@@ -23,10 +23,16 @@
passwd="$( < /dev/urandom tr -c -d 'a-zA-Z0-9#&/=()[]{}' | dd bs=8 count=1 status=none )"
printf "%s" "$passwd" > "/tmp/vnc-passwd"
url="http://${SLX_PXE_SERVER_IP}/slx-admin/api.php?do=remoteaccess"
- curl -L --retry 4 --retry-connrefused --max-time 3 --retry-max-time 10 \
- --data-urlencode "password=$passwd" "$url"
- killall x11vnc
+ curl -s -S -L --retry 4 --retry-connrefused --max-time 3 --retry-max-time 10 \
+ --data-urlencode "password=$passwd" "$url" > /dev/null
(
+ # Make a copy of xauth, so if the xserver restarts, we'll use the old one and fail to connect
+ if [ -n "$XAUTHORITY" ]; then
+ copy="$( mktemp )"
+ cat "$XAUTHORITY" > "$copy"
+ export XAUTHORITY="$copy"
+ trap 'rm -f -- "$copy"' EXIT INT TERM
+ fi
fails=0
while true; do
s="$( date +%s )"