Use a secure temp directory to put vnc server socket in

Helps get rid of the special VNC_APPLICATION_DIRECTORY
bit by bit
This commit is contained in:
YuviPanda 2019-10-29 14:31:12 -07:00
parent 58750b5499
commit dbdd709d5e
1 changed files with 7 additions and 2 deletions

View File

@ -1,24 +1,29 @@
import os import os
import tempfile
HERE = os.path.dirname(os.path.abspath(__file__)) HERE = os.path.dirname(os.path.abspath(__file__))
def setup_desktop(): def setup_desktop():
VNC_APPLICATION_DIR = os.path.join(os.getenv('CONDA_DIR'), 'vnc') VNC_APPLICATION_DIR = os.path.join(os.getenv('CONDA_DIR'), 'vnc')
# make a secure temporary directory for sockets
# This is only readable, writeable & searchable by our uid
sockets_dir = tempfile.mkdtemp()
sockets_path = os.path.join(sockets_dir, 'vnc-socket')
return { return {
'command': [ 'command': [
'websockify', '-v', 'websockify', '-v',
'--web', VNC_APPLICATION_DIR + '/noVNC-1.1.0', '--web', VNC_APPLICATION_DIR + '/noVNC-1.1.0',
'--heartbeat', '30', '--heartbeat', '30',
'5901', '5901',
'--unix-target', VNC_APPLICATION_DIR + '/socket', '--unix-target', sockets_path,
'--', '--',
VNC_APPLICATION_DIR + '/bin/vncserver', VNC_APPLICATION_DIR + '/bin/vncserver',
'-verbose', '-verbose',
'-xstartup', os.path.join(HERE, 'share/xstartup'), '-xstartup', os.path.join(HERE, 'share/xstartup'),
'-geometry', '1024x768', '-geometry', '1024x768',
'-SecurityTypes', 'None', '-SecurityTypes', 'None',
'-rfbunixpath', VNC_APPLICATION_DIR + '/socket', '-rfbunixpath', sockets_path,
'-fg', '-fg',
':1', ':1',
], ],