mirror of
https://github.com/kasmtech/workspaces-core-images.git
synced 2025-06-25 22:41:47 +02:00
Merge branch 'feature/KASM-5508_persistent_profile_logging' into 'develop'
KASM-5508 container centralized logging Closes KASM-5508 See merge request kasm-technologies/internal/workspaces-core-images!172
This commit is contained in:
commit
0fea5cdd6d
@ -1,6 +1,25 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
|
||||||
echo "Executing kasm_pre_shutdown_user.sh"
|
APP_NAME=$(basename "$0")
|
||||||
|
|
||||||
|
log () {
|
||||||
|
if [ ! -z "${1}" ]; then
|
||||||
|
LOG_LEVEL="${2:-DEBUG}"
|
||||||
|
INGEST_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
||||||
|
echo "${INGEST_DATE} ${LOG_LEVEL} (${APP_NAME}): $1"
|
||||||
|
if [ ! -z "${KASM_API_JWT}" ] && [ ! -z "${KASM_API_HOST}" ] && [ ! -z "${KASM_API_PORT}" ]; then
|
||||||
|
http_proxy="" https_proxy="" curl https://${KASM_API_HOST}:${KASM_API_PORT}/api/kasm_session_log?token=${KASM_API_JWT} --max-time 1 -X POST -H 'Content-Type: application/json' -d '[{ "host": "'"${KASM_ID}"'", "application": "Session", "ingest_date": "'"${INGEST_DATE}"'", "message": "'"$1"'", "levelname": "'"${LOG_LEVEL}"'", "process": "'"${APP_NAME}"'", "kasm_user_name": "'"${KASM_USER_NAME}"'", "kasm_id": "'"${KASM_ID}"'" }]' -k
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
log "The kasm_pre_shutdown_user script was interrupted." "ERROR"
|
||||||
|
}
|
||||||
|
|
||||||
|
trap cleanup 2 6 9 15
|
||||||
|
|
||||||
|
log "Executing kasm_pre_shutdown_user.sh" "INFO"
|
||||||
|
|
||||||
PAUSE_ON_EXIT="false"
|
PAUSE_ON_EXIT="false"
|
||||||
if [ -z ${KASM_PROFILE_CHUNK_SIZE} ]; then
|
if [ -z ${KASM_PROFILE_CHUNK_SIZE} ]; then
|
||||||
@ -53,22 +72,34 @@ if [ ! -z "$KASM_PROFILE_LDR" ]; then
|
|||||||
SIZE_LIMIT_MB=$(echo "$KASM_PROFILE_SIZE_LIMIT / 1000" | bc)
|
SIZE_LIMIT_MB=$(echo "$KASM_PROFILE_SIZE_LIMIT / 1000" | bc)
|
||||||
if [[ $CURRENT_SIZE -gt KASM_PROFILE_SIZE_LIMIT ]]; then
|
if [[ $CURRENT_SIZE -gt KASM_PROFILE_SIZE_LIMIT ]]; then
|
||||||
http_proxy="" https_proxy="" curl -k "https://${KASM_API_HOST}:${KASM_API_PORT}/api/set_kasm_session_status?token=${KASM_API_JWT}" -H 'Content-Type: application/json' -d '{"destroyed": true}'
|
http_proxy="" https_proxy="" curl -k "https://${KASM_API_HOST}:${KASM_API_PORT}/api/set_kasm_session_status?token=${KASM_API_JWT}" -H 'Content-Type: application/json' -d '{"destroyed": true}'
|
||||||
echo 'Profile size limit exceeded.'
|
log 'Profile size limit exceeded.' 'WARNING'
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$kasm_profile_sync_found" ]; then
|
if [ -z "$kasm_profile_sync_found" ]; then
|
||||||
echo >&2 "Profile sync not available"
|
log "Profile sync not available"
|
||||||
else
|
else
|
||||||
echo "Packing and uploading user profile to object storage."
|
log "Packing and uploading user profile to object storage."
|
||||||
|
PROFILE_SYNC_STATUS=1
|
||||||
if [[ $DEBUG == true ]]; then
|
if [[ $DEBUG == true ]]; then
|
||||||
http_proxy="" https_proxy="" /usr/bin/kasm-profile-sync --upload /home/kasm-user --insecure --filter "${KASM_PROFILE_FILTER}" --remote ${KASM_API_HOST} --port ${KASM_API_PORT} -c ${KASM_PROFILE_CHUNK_SIZE} --token ${KASM_API_JWT} --verbose
|
OUTPUT=$(http_proxy="" https_proxy="" /usr/bin/kasm-profile-sync --upload /home/kasm-user --insecure --filter "${KASM_PROFILE_FILTER}" --remote ${KASM_API_HOST} --port ${KASM_API_PORT} -c ${KASM_PROFILE_CHUNK_SIZE} --token ${KASM_API_JWT} --verbose 2>&1 )
|
||||||
|
PROFILE_SYNC_STATUS=$?
|
||||||
else
|
else
|
||||||
http_proxy="" https_proxy="" /usr/bin/kasm-profile-sync --upload /home/kasm-user --insecure --filter "${KASM_PROFILE_FILTER}" --remote ${KASM_API_HOST} --port ${KASM_API_PORT} -c ${KASM_PROFILE_CHUNK_SIZE} --token ${KASM_API_JWT}
|
OUTPUT=$(http_proxy="" https_proxy="" /usr/bin/kasm-profile-sync --upload /home/kasm-user --insecure --filter "${KASM_PROFILE_FILTER}" --remote ${KASM_API_HOST} --port ${KASM_API_PORT} -c ${KASM_PROFILE_CHUNK_SIZE} --token ${KASM_API_JWT} 2>&1 )
|
||||||
|
PROFILE_SYNC_STATUS=$?
|
||||||
fi
|
fi
|
||||||
echo "Profile upload complete."
|
|
||||||
|
while IFS= read -r line; do
|
||||||
|
log "$line"
|
||||||
|
done <<< "$OUTPUT"
|
||||||
|
|
||||||
|
if [ $PROFILE_SYNC_STATUS -ne 0 ]; then
|
||||||
|
log "Failed to syncronize user profile, see debug logs." "ERROR"
|
||||||
|
else
|
||||||
|
log "Profile upload complete."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Done"
|
echo "Done"
|
@ -2,6 +2,19 @@
|
|||||||
### every exit != 0 fails the script
|
### every exit != 0 fails the script
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
APP_NAME=$(basename "$0")
|
||||||
|
|
||||||
|
log () {
|
||||||
|
if [ ! -z "${1}" ]; then
|
||||||
|
LOG_LEVEL="${2:-DEBUG}"
|
||||||
|
INGEST_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
||||||
|
echo "${INGEST_DATE} ${LOG_LEVEL} (${APP_NAME}): $1"
|
||||||
|
if [ ! -z "${KASM_API_JWT}" ] && [ ! -z "${KASM_API_HOST}" ] && [ ! -z "${KASM_API_PORT}" ]; then
|
||||||
|
http_proxy="" https_proxy="" curl https://${KASM_API_HOST}:${KASM_API_PORT}/api/kasm_session_log?token=${KASM_API_JWT} --max-time 1 -X POST -H 'Content-Type: application/json' -d '[{ "host": "'"${KASM_ID}"'", "application": "Session", "ingest_date": "'"${INGEST_DATE}"'", "message": "'"$1"'", "levelname": "'"${LOG_LEVEL}"'", "process": "'"${APP_NAME}"'", "kasm_user_name": "'"${KASM_USER_NAME}"'", "kasm_id": "'"${KASM_ID}"'" }]' -k
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
no_proxy="localhost,127.0.0.1"
|
no_proxy="localhost,127.0.0.1"
|
||||||
|
|
||||||
if [ -f /usr/bin/kasm-profile-sync ]; then
|
if [ -f /usr/bin/kasm-profile-sync ]; then
|
||||||
@ -66,20 +79,27 @@ function pull_profile (){
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Downloading and unpacking user profile from object storage."
|
log "Downloading and unpacking user profile from object storage."
|
||||||
set +e
|
set +e
|
||||||
if [[ $DEBUG == true ]]; then
|
if [[ $DEBUG == true ]]; then
|
||||||
http_proxy="" https_proxy="" /usr/bin/kasm-profile-sync --download /home/kasm-user --insecure --remote ${KASM_API_HOST} --port ${KASM_API_PORT} -c ${KASM_PROFILE_CHUNK_SIZE} --token ${KASM_API_JWT} --verbose
|
OUTPUT=$(http_proxy="" https_proxy="" /usr/bin/kasm-profile-sync --download /home/kasm-user --insecure --remote ${KASM_API_HOST} --port ${KASM_API_PORT} -c ${KASM_PROFILE_CHUNK_SIZE} --token ${KASM_API_JWT} --verbose 2>&1 )
|
||||||
else
|
else
|
||||||
http_proxy="" https_proxy="" /usr/bin/kasm-profile-sync --download /home/kasm-user --insecure --remote ${KASM_API_HOST} --port ${KASM_API_PORT} -c ${KASM_PROFILE_CHUNK_SIZE} --token ${KASM_API_JWT}
|
OUTPUT=$(http_proxy="" https_proxy="" /usr/bin/kasm-profile-sync --download /home/kasm-user --insecure --remote ${KASM_API_HOST} --port ${KASM_API_PORT} -c ${KASM_PROFILE_CHUNK_SIZE} --token ${KASM_API_JWT} 2>&1 )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# log output of profile sync
|
||||||
|
while IFS= read -r line; do
|
||||||
|
log "$line"
|
||||||
|
done <<< "$OUTPUT"
|
||||||
|
|
||||||
|
# exit and log a non-zero exit code
|
||||||
PROCESS_SYNC_EXIT_CODE=$?
|
PROCESS_SYNC_EXIT_CODE=$?
|
||||||
set -e
|
set -e
|
||||||
if (( PROCESS_SYNC_EXIT_CODE > 1 )); then
|
if (( PROCESS_SYNC_EXIT_CODE > 1 )); then
|
||||||
echo "Profile-sync failed with a non-recoverable error. See server side logs for more details."
|
log "Profile-sync failed with a non-recoverable error. See server side logs for more details." "ERROR"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "Profile load complete."
|
log "Profile load complete."
|
||||||
# Update the status of the container to running
|
# Update the status of the container to running
|
||||||
sleep 3
|
sleep 3
|
||||||
http_proxy="" https_proxy="" curl -k "https://${KASM_API_HOST}:${KASM_API_PORT}/api/set_kasm_session_status?token=${KASM_API_JWT}" -H 'Content-Type: application/json' -d '{"status": "running"}'
|
http_proxy="" https_proxy="" curl -k "https://${KASM_API_HOST}:${KASM_API_PORT}/api/set_kasm_session_status?token=${KASM_API_JWT}" -H 'Content-Type: application/json' -d '{"status": "running"}'
|
||||||
@ -108,6 +128,10 @@ function profile_size_check(){
|
|||||||
notify-send "Profile Size" "Your home profile size is now under the limit and will be saved when your session is terminated." -i /usr/share/icons/ubuntu-mono-dark/apps/22/dropboxstatus-logo.svg -t 57000
|
notify-send "Profile Size" "Your home profile size is now under the limit and will be saved when your session is terminated." -i /usr/share/icons/ubuntu-mono-dark/apps/22/dropboxstatus-logo.svg -t 57000
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -f /tmp/.kasm_container_shutdown_failure ]; then
|
||||||
|
notify-send "Profile Size" "Your profile failed to save. Contact your administrator for assistance." -i /usr/share/icons/ubuntu-mono-dark/apps/22/dropboxstatus-logo.svg -t 57000
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -119,9 +143,7 @@ function cleanup () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function start_kasmvnc (){
|
function start_kasmvnc (){
|
||||||
if [[ $DEBUG == true ]]; then
|
log "Starting KasmVNC"
|
||||||
echo -e "\n------------------ Start KasmVNC Server ------------------------"
|
|
||||||
fi
|
|
||||||
|
|
||||||
DISPLAY_NUM=$(echo $DISPLAY | grep -Po ':\d+')
|
DISPLAY_NUM=$(echo $DISPLAY | grep -Po ':\d+')
|
||||||
|
|
||||||
@ -166,7 +188,7 @@ function start_kasmvnc (){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function start_window_manager (){
|
function start_window_manager (){
|
||||||
echo -e "\n------------------ Xfce4 window manager startup------------------"
|
log "Starting Window Manager"
|
||||||
|
|
||||||
if [ "${START_XFCE4}" == "1" ] ; then
|
if [ "${START_XFCE4}" == "1" ] ; then
|
||||||
if [ -f /opt/VirtualGL/bin/vglrun ] && [ ! -z "${KASM_EGL_CARD}" ] && [ ! -z "${KASM_RENDERD}" ] && [ -O "${KASM_RENDERD}" ] && [ -O "${KASM_EGL_CARD}" ] ; then
|
if [ -f /opt/VirtualGL/bin/vglrun ] && [ ! -z "${KASM_EGL_CARD}" ] && [ ! -z "${KASM_RENDERD}" ] && [ -O "${KASM_RENDERD}" ] && [ -O "${KASM_EGL_CARD}" ] ; then
|
||||||
@ -188,7 +210,7 @@ function start_window_manager (){
|
|||||||
|
|
||||||
function start_audio_out_websocket (){
|
function start_audio_out_websocket (){
|
||||||
if [[ ${KASM_SVC_AUDIO:-1} == 1 ]]; then
|
if [[ ${KASM_SVC_AUDIO:-1} == 1 ]]; then
|
||||||
echo 'Starting audio websocket server'
|
log 'Starting audio websocket server'
|
||||||
$STARTUPDIR/jsmpeg/kasm_audio_out-linux kasmaudio 8081 4901 ${HOME}/.vnc/self.pem ${HOME}/.vnc/self.pem "kasm_user:$VNC_PW" &
|
$STARTUPDIR/jsmpeg/kasm_audio_out-linux kasmaudio 8081 4901 ${HOME}/.vnc/self.pem ${HOME}/.vnc/self.pem "kasm_user:$VNC_PW" &
|
||||||
|
|
||||||
KASM_PROCS['kasm_audio_out_websocket']=$!
|
KASM_PROCS['kasm_audio_out_websocket']=$!
|
||||||
@ -202,7 +224,7 @@ function start_audio_out_websocket (){
|
|||||||
|
|
||||||
function start_audio_out (){
|
function start_audio_out (){
|
||||||
if [[ ${KASM_SVC_AUDIO:-1} == 1 ]]; then
|
if [[ ${KASM_SVC_AUDIO:-1} == 1 ]]; then
|
||||||
echo 'Starting audio server'
|
log 'Starting audio server'
|
||||||
|
|
||||||
if [ "${START_PULSEAUDIO:-0}" == "1" ] ;
|
if [ "${START_PULSEAUDIO:-0}" == "1" ] ;
|
||||||
then
|
then
|
||||||
@ -226,7 +248,7 @@ function start_audio_out (){
|
|||||||
|
|
||||||
function start_audio_in (){
|
function start_audio_in (){
|
||||||
if [[ ${KASM_SVC_AUDIO_INPUT:-1} == 1 ]]; then
|
if [[ ${KASM_SVC_AUDIO_INPUT:-1} == 1 ]]; then
|
||||||
echo 'Starting audio input server'
|
log 'Starting audio input server'
|
||||||
$STARTUPDIR/audio_input/kasm_audio_input_server --ssl --auth-token "kasm_user:$VNC_PW" --cert ${HOME}/.vnc/self.pem --certkey ${HOME}/.vnc/self.pem &
|
$STARTUPDIR/audio_input/kasm_audio_input_server --ssl --auth-token "kasm_user:$VNC_PW" --cert ${HOME}/.vnc/self.pem --certkey ${HOME}/.vnc/self.pem &
|
||||||
|
|
||||||
KASM_PROCS['kasm_audio_in']=$!
|
KASM_PROCS['kasm_audio_in']=$!
|
||||||
@ -240,7 +262,7 @@ function start_audio_in (){
|
|||||||
|
|
||||||
function start_upload (){
|
function start_upload (){
|
||||||
if [[ ${KASM_SVC_UPLOADS:-1} == 1 ]]; then
|
if [[ ${KASM_SVC_UPLOADS:-1} == 1 ]]; then
|
||||||
echo 'Starting upload server'
|
log 'Starting upload server'
|
||||||
$STARTUPDIR/upload_server/kasm_upload_server --ssl --auth-token "kasm_user:$VNC_PW" --port 4902 --upload_dir ${HOME}/Uploads &
|
$STARTUPDIR/upload_server/kasm_upload_server --ssl --auth-token "kasm_user:$VNC_PW" --port 4902 --upload_dir ${HOME}/Uploads &
|
||||||
|
|
||||||
KASM_PROCS['upload_server']=$!
|
KASM_PROCS['upload_server']=$!
|
||||||
@ -254,7 +276,7 @@ function start_upload (){
|
|||||||
|
|
||||||
function start_gamepad (){
|
function start_gamepad (){
|
||||||
if [[ ${KASM_SVC_GAMEPAD:-1} == 1 ]]; then
|
if [[ ${KASM_SVC_GAMEPAD:-1} == 1 ]]; then
|
||||||
echo 'Starting gamepad server'
|
log 'Starting gamepad server'
|
||||||
$STARTUPDIR/gamepad/kasm_gamepad_server --ssl --auth-token "kasm_user:$VNC_PW" --cert ${HOME}/.vnc/self.pem --certkey ${HOME}/.vnc/self.pem &
|
$STARTUPDIR/gamepad/kasm_gamepad_server --ssl --auth-token "kasm_user:$VNC_PW" --cert ${HOME}/.vnc/self.pem --certkey ${HOME}/.vnc/self.pem &
|
||||||
|
|
||||||
KASM_PROCS['kasm_gamepad']=$!
|
KASM_PROCS['kasm_gamepad']=$!
|
||||||
@ -268,7 +290,7 @@ function start_gamepad (){
|
|||||||
|
|
||||||
function start_webcam (){
|
function start_webcam (){
|
||||||
if [[ ${KASM_SVC_WEBCAM:-1} == 1 ]] && [[ -e /dev/video0 ]]; then
|
if [[ ${KASM_SVC_WEBCAM:-1} == 1 ]] && [[ -e /dev/video0 ]]; then
|
||||||
echo 'Starting webcam server'
|
log 'Starting webcam server'
|
||||||
if [[ $DEBUG == true ]]; then
|
if [[ $DEBUG == true ]]; then
|
||||||
$STARTUPDIR/webcam/kasm_webcam_server --debug --port 4905 --ssl --cert ${HOME}/.vnc/self.pem --certkey ${HOME}/.vnc/self.pem &
|
$STARTUPDIR/webcam/kasm_webcam_server --debug --port 4905 --ssl --cert ${HOME}/.vnc/self.pem --certkey ${HOME}/.vnc/self.pem &
|
||||||
else
|
else
|
||||||
@ -286,7 +308,7 @@ function start_webcam (){
|
|||||||
|
|
||||||
function start_printer (){
|
function start_printer (){
|
||||||
if [[ ${KASM_SVC_PRINTER:-1} == 1 ]]; then
|
if [[ ${KASM_SVC_PRINTER:-1} == 1 ]]; then
|
||||||
echo 'Starting printer service'
|
log 'Starting printer service'
|
||||||
if [[ $DEBUG == true ]]; then
|
if [[ $DEBUG == true ]]; then
|
||||||
$STARTUPDIR/printer/kasm_printer_service --debug --directory $HOME/PDF --relay /tmp/printer &
|
$STARTUPDIR/printer/kasm_printer_service --debug --directory $HOME/PDF --relay /tmp/printer &
|
||||||
else
|
else
|
||||||
@ -312,6 +334,7 @@ function custom_startup (){
|
|||||||
|
|
||||||
"$custom_startup_script" &
|
"$custom_startup_script" &
|
||||||
KASM_PROCS['custom_startup']=$!
|
KASM_PROCS['custom_startup']=$!
|
||||||
|
log "Executed custom startup script."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -323,7 +346,7 @@ function ensure_recorder_running () {
|
|||||||
local kasm_recorder_process="/dockerstartup/recorder/kasm_recorder_service"
|
local kasm_recorder_process="/dockerstartup/recorder/kasm_recorder_service"
|
||||||
local kasm_recorder_ack="/tmp/kasm_recorder.ack"
|
local kasm_recorder_ack="/tmp/kasm_recorder.ack"
|
||||||
|
|
||||||
if [[ -f "$kasm_recorder_ack" ]]; then
|
if [[ -f "$kasm_recorder_ack" ]]; then
|
||||||
local ack_user=$(stat -c '%U' $kasm_recorder_ack)
|
local ack_user=$(stat -c '%U' $kasm_recorder_ack)
|
||||||
if [[ "$ack_user" == "kasm-recorder" ]]; then
|
if [[ "$ack_user" == "kasm-recorder" ]]; then
|
||||||
SECONDS=0 #SECONDS is a built in bash variable that is incremented approximately every second
|
SECONDS=0 #SECONDS is a built in bash variable that is incremented approximately every second
|
||||||
@ -336,20 +359,20 @@ function ensure_recorder_running () {
|
|||||||
if [[ -z $kasm_recorder_pid ]]; then
|
if [[ -z $kasm_recorder_pid ]]; then
|
||||||
# This leverages the outside while loop that calls this function to provider checking ever x seconds.
|
# This leverages the outside while loop that calls this function to provider checking ever x seconds.
|
||||||
if [[ -z $recorder_pid ]] && (( $SECONDS > 15 )); then
|
if [[ -z $recorder_pid ]] && (( $SECONDS > 15 )); then
|
||||||
echo "$kasm_recorder_process: not started, exiting"
|
log "$kasm_recorder_process: not started, exiting" "ERROR"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
kasm_recorder_pid=$recorder_pid
|
kasm_recorder_pid=$recorder_pid
|
||||||
else
|
else
|
||||||
if [[ -z $recorder_pid ]]; then
|
if [[ -z $recorder_pid ]]; then
|
||||||
echo "$kasm_recorder_process: not running, exiting"
|
log "$kasm_recorder_process: not running, exiting" "ERROR"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
recorder_user=$(ps -p $recorder_pid -o user=)
|
recorder_user=$(ps -p $recorder_pid -o user=)
|
||||||
if [[ $recorder_user != "kasm-recorder" ]]; then
|
if [[ $recorder_user != "kasm-recorder" ]]; then
|
||||||
echo "$kasm_recorder_process: not running as kasm-recorder, exiting"
|
log "$kasm_recorder_process: not running as kasm-recorder, exiting" "ERROR"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -407,10 +430,7 @@ if [[ -f $PASSWD_PATH ]]; then
|
|||||||
echo -e "\n--------- purging existing VNC password settings ---------"
|
echo -e "\n--------- purging existing VNC password settings ---------"
|
||||||
rm -f $PASSWD_PATH
|
rm -f $PASSWD_PATH
|
||||||
fi
|
fi
|
||||||
#VNC_PW_HASH=$(python3 -c "import crypt; print(crypt.crypt('${VNC_PW}', '\$5\$kasm\$'));")
|
|
||||||
#VNC_VIEW_PW_HASH=$(python3 -c "import crypt; print(crypt.crypt('${VNC_VIEW_ONLY_PW}', '\$5\$kasm\$'));")
|
|
||||||
#echo "kasm_user:${VNC_PW_HASH}:ow" > $PASSWD_PATH
|
|
||||||
#echo "kasm_viewer:${VNC_VIEW_PW_HASH}:" >> $PASSWD_PATH
|
|
||||||
echo -e "${VNC_PW}\n${VNC_PW}\n" | kasmvncpasswd -u kasm_user -wo
|
echo -e "${VNC_PW}\n${VNC_PW}\n" | kasmvncpasswd -u kasm_user -wo
|
||||||
echo -e "${VNC_PW}\n${VNC_PW}\n" | kasmvncpasswd -u kasm_viewer -r
|
echo -e "${VNC_PW}\n${VNC_PW}\n" | kasmvncpasswd -u kasm_viewer -r
|
||||||
chmod 600 $PASSWD_PATH
|
chmod 600 $PASSWD_PATH
|
||||||
@ -438,7 +458,7 @@ echo -e "\n\n------------------ KasmVNC environment started ------------------"
|
|||||||
tail -f $HOME/.vnc/*$DISPLAY.log &
|
tail -f $HOME/.vnc/*$DISPLAY.log &
|
||||||
|
|
||||||
KASMIP=$(hostname -i)
|
KASMIP=$(hostname -i)
|
||||||
echo "Kasm User ${KASM_USER}(${KASM_USER_ID}) started container id ${HOSTNAME} with local IP address ${KASMIP}"
|
log "Kasm User ${KASM_USER}(${KASM_USER_ID}) started container id ${HOSTNAME} with local IP address ${KASMIP}" "INFO"
|
||||||
|
|
||||||
# start custom startup script
|
# start custom startup script
|
||||||
custom_startup
|
custom_startup
|
||||||
@ -458,20 +478,20 @@ do
|
|||||||
case $process in
|
case $process in
|
||||||
kasmvnc)
|
kasmvnc)
|
||||||
if [ "$KASMVNC_AUTO_RECOVER" = true ] ; then
|
if [ "$KASMVNC_AUTO_RECOVER" = true ] ; then
|
||||||
echo "KasmVNC crashed, restarting"
|
log "KasmVNC crashed, restarting" "WARNING"
|
||||||
start_kasmvnc
|
start_kasmvnc
|
||||||
else
|
else
|
||||||
echo "KasmVNC crashed, exiting container"
|
log "KasmVNC crashed, exiting container" "ERROR"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
window_manager)
|
window_manager)
|
||||||
echo "Window manager crashed, restarting"
|
log "Window manager crashed, restarting" "WARNING"
|
||||||
|
|
||||||
if [[ ${KASM_SVC_RECORDER:-0} == 1 ]]; then
|
if [[ ${KASM_SVC_RECORDER:-0} == 1 ]]; then
|
||||||
echo "Waiting for recorder service to upload all pending recordings"
|
log "Waiting for recorder service to upload all pending recordings"
|
||||||
ensure_recorder_terminates_gracefully
|
ensure_recorder_terminates_gracefully
|
||||||
echo "Recorder service has terminated, exiting container"
|
log "Recorder service has terminated, exiting container" "ERROR"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -528,4 +548,4 @@ do
|
|||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
echo "Exiting Kasm container"
|
log "Exiting Kasm container"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user