From ec05bc936fe9b71f592ec234b58d664bba31311e Mon Sep 17 00:00:00 2001 From: Kasra Bigdeli Date: Thu, 20 Jan 2022 21:19:04 -0800 Subject: [PATCH] Adding config driven support for sslOnly To fix https://github.com/kasmtech/workspaces-core-images/issues/2 --- src/common/startup_scripts/vnc_startup.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/common/startup_scripts/vnc_startup.sh b/src/common/startup_scripts/vnc_startup.sh index 03bc837..0d622d5 100644 --- a/src/common/startup_scripts/vnc_startup.sh +++ b/src/common/startup_scripts/vnc_startup.sh @@ -47,6 +47,13 @@ function start_kasmvnc (){ if [[ $DEBUG == true ]]; then echo -e "\n------------------ Start KasmVNC Server ------------------------" fi + + if [ ! $DISABLE_VNC_SSL ]; then + SSL_FLAG=-sslOnly + else + SSL_FLAG="" + fi + DISPLAY_NUM=$(echo $DISPLAY | grep -Po ':\d+') @@ -59,9 +66,9 @@ function start_kasmvnc (){ rm -rf $HOME/.vnc/*.pid if [[ "${BUILD_ARCH}" =~ ^aarch64$ ]] && [[ -f /lib/aarch64-linux-gnu/libgcc_s.so.1 ]] ; then - LD_PRELOAD=/lib/aarch64-linux-gnu/libgcc_s.so.1 vncserver $DISPLAY -depth $VNC_COL_DEPTH -geometry $VNC_RESOLUTION -websocketPort $NO_VNC_PORT -cert ${HOME}/.vnc/self.pem -httpd ${KASM_VNC_PATH}/www -sslOnly -FrameRate=$MAX_FRAME_RATE -interface 0.0.0.0 $VNCOPTIONS $KASM_SVC_SEND_CUT_TEXT $KASM_SVC_ACCEPT_CUT_TEXT + LD_PRELOAD=/lib/aarch64-linux-gnu/libgcc_s.so.1 vncserver $DISPLAY -depth $VNC_COL_DEPTH -geometry $VNC_RESOLUTION -websocketPort $NO_VNC_PORT -cert ${HOME}/.vnc/self.pem -httpd ${KASM_VNC_PATH}/www $SSL_FLAG -FrameRate=$MAX_FRAME_RATE -interface 0.0.0.0 $VNCOPTIONS $KASM_SVC_SEND_CUT_TEXT $KASM_SVC_ACCEPT_CUT_TEXT else - vncserver $DISPLAY -depth $VNC_COL_DEPTH -geometry $VNC_RESOLUTION -websocketPort $NO_VNC_PORT -cert ${HOME}/.vnc/self.pem -httpd ${KASM_VNC_PATH}/www -sslOnly -FrameRate=$MAX_FRAME_RATE -interface 0.0.0.0 $VNCOPTIONS $KASM_SVC_SEND_CUT_TEXT $KASM_SVC_ACCEPT_CUT_TEXT + vncserver $DISPLAY -depth $VNC_COL_DEPTH -geometry $VNC_RESOLUTION -websocketPort $NO_VNC_PORT -cert ${HOME}/.vnc/self.pem -httpd ${KASM_VNC_PATH}/www $SSL_FLAG -FrameRate=$MAX_FRAME_RATE -interface 0.0.0.0 $VNCOPTIONS $KASM_SVC_SEND_CUT_TEXT $KASM_SVC_ACCEPT_CUT_TEXT fi KASM_PROCS['kasmvnc']=$(cat $HOME/.vnc/*${DISPLAY_NUM}.pid)