mirror of
https://github.com/kasmtech/workspaces-core-images.git
synced 2024-11-07 08:04:06 +01:00
KASM-4975 "Feature/ vnc session recording"
This commit is contained in:
parent
302590dee5
commit
b1cf97dc31
@ -1,6 +1,8 @@
|
||||
files: &UNIVERSAL_CHANGE_FILES
|
||||
- src/common/**
|
||||
- src/common/startup_scripts/**
|
||||
- src/common/scripts/**
|
||||
- src/common/scripts/kasm_hook_scripts/**
|
||||
- src/ubuntu/install/audio/**
|
||||
- src/ubuntu/install/audio_input/**
|
||||
- src/ubuntu/install/cleanup/**
|
||||
@ -18,6 +20,7 @@ files: &UNIVERSAL_CHANGE_FILES
|
||||
- src/ubuntu/install/squid/**
|
||||
- src/ubuntu/install/tools/**
|
||||
- src/ubuntu/install/webcam/**
|
||||
- src/ubuntu/install/recorder/**
|
||||
- ci-scripts/**
|
||||
- .gitlab-ci.yml
|
||||
|
||||
|
@ -87,12 +87,16 @@ RUN bash $INST_SCRIPTS/gamepad/install_gamepad.sh && rm -rf $INST_SCRIPTS/gamepa
|
||||
COPY ./src/ubuntu/install/webcam $INST_SCRIPTS/webcam/
|
||||
RUN bash $INST_SCRIPTS/webcam/install_webcam.sh && rm -rf $INST_SCRIPTS/webcam/
|
||||
|
||||
### Install Printer
|
||||
### Install Printer Service
|
||||
COPY ./src/ubuntu/install/printer $INST_SCRIPTS/printer/
|
||||
COPY ./src/ubuntu/install/printer/start_cups.sh /etc/cups/start_cups.sh
|
||||
RUN bash $INST_SCRIPTS/printer/install_printer.sh && rm -rf $INST_SCRIPTS/printer
|
||||
COPY ./src/ubuntu/install/printer/resources/*.ppd /etc/cups/ppd/
|
||||
|
||||
### Install Recorder Service
|
||||
COPY ./src/ubuntu/install/recorder $INST_SCRIPTS/recorder/
|
||||
RUN bash $INST_SCRIPTS/recorder/install_recorder.sh && rm -rf $INST_SCRIPTS/recorder
|
||||
|
||||
### Install custom cursors
|
||||
COPY ./src/ubuntu/install/cursors $INST_SCRIPTS/cursors/
|
||||
RUN bash $INST_SCRIPTS/cursors/install_cursors.sh && rm -rf $INST_SCRIPTS/cursors/
|
||||
@ -140,6 +144,11 @@ ENV HOME=/home/kasm-user
|
||||
WORKDIR $HOME
|
||||
RUN mkdir -p $HOME && chown -R 1000:0 $HOME
|
||||
|
||||
### Create user exclusively for session recording purposes
|
||||
RUN (groupadd -g 1001 kasm-recorder \
|
||||
&& useradd -M -u 1001 -g 1001 kasm-recorder \
|
||||
&& usermod -a -G kasm-recorder) ; exit 0
|
||||
|
||||
### FIX PERMISSIONS ## Objective is to change the owner of non-home paths to root, remove write permissions, and set execute where required
|
||||
# these files are created on container first exec, by the default user, so we have to create them since default will not have write perm
|
||||
RUN touch $STARTUPDIR/wm.log \
|
||||
@ -159,6 +168,7 @@ RUN touch $STARTUPDIR/wm.log \
|
||||
&& chmod 755 $STARTUPDIR/gamepad/kasm_gamepad_server \
|
||||
&& chmod 755 $STARTUPDIR/webcam/kasm_webcam_server \
|
||||
&& chmod 755 $STARTUPDIR/printer/kasm_printer_service \
|
||||
&& chmod 755 $STARTUPDIR/recorder/kasm_recorder_service \
|
||||
&& chmod 755 $STARTUPDIR/generate_container_user \
|
||||
&& chmod +x $STARTUPDIR/jsmpeg/kasm_audio_out-linux \
|
||||
&& rm -rf $STARTUPDIR/install \
|
||||
|
@ -89,12 +89,16 @@ RUN bash $INST_SCRIPTS/gamepad/install_gamepad.sh && rm -rf $INST_SCRIPTS/gamepa
|
||||
COPY ./src/ubuntu/install/webcam $INST_SCRIPTS/webcam/
|
||||
RUN bash $INST_SCRIPTS/webcam/install_webcam.sh && rm -rf $INST_SCRIPTS/webcam/
|
||||
|
||||
### Install Printer
|
||||
### Install Printer Service
|
||||
COPY ./src/ubuntu/install/printer $INST_SCRIPTS/printer/
|
||||
COPY ./src/ubuntu/install/printer/start_cups.sh /etc/cups/start_cups.sh
|
||||
RUN bash $INST_SCRIPTS/printer/install_printer.sh && rm -rf $INST_SCRIPTS/printer
|
||||
COPY ./src/ubuntu/install/printer/resources/*.ppd /etc/cups/ppd/
|
||||
|
||||
### Install Recorder Service
|
||||
COPY ./src/ubuntu/install/recorder $INST_SCRIPTS/recorder/
|
||||
RUN bash $INST_SCRIPTS/recorder/install_recorder.sh && rm -rf $INST_SCRIPTS/recorder
|
||||
|
||||
### Copy built Squid
|
||||
COPY --from=squid_builder /usr/local/squid /usr/local/squid
|
||||
|
||||
@ -134,6 +138,11 @@ ENV HOME /home/kasm-user
|
||||
WORKDIR $HOME
|
||||
RUN mkdir -p $HOME && chown -R 1000:0 $HOME
|
||||
|
||||
### Create user exclusively for session recording purposes
|
||||
RUN (groupadd -g 1001 kasm-recorder \
|
||||
&& useradd -M -u 1001 -g 1001 kasm-recorder \
|
||||
&& usermod -a -G kasm-recorder) ; exit 0
|
||||
|
||||
### FIX PERMISSIONS ## Objective is to change the owner of non-home paths to root, remove write permissions, and set execute where required
|
||||
# these files are created on container first exec, by the default user, so we have to create them since default will not have write perm
|
||||
RUN touch $STARTUPDIR/wm.log \
|
||||
@ -154,6 +163,7 @@ RUN touch $STARTUPDIR/wm.log \
|
||||
&& chmod 755 $STARTUPDIR/webcam/kasm_webcam_server \
|
||||
&& chmod 755 $STARTUPDIR/generate_container_user \
|
||||
&& chmod 755 $STARTUPDIR/printer/kasm_printer_service \
|
||||
&& chmod 755 $STARTUPDIR/recorder/kasm_recorder_service \
|
||||
&& chmod +x $STARTUPDIR/jsmpeg/kasm_audio_out-linux \
|
||||
&& rm -rf $STARTUPDIR/install \
|
||||
&& mkdir -p $STARTUPDIR/kasmrx/Downloads \
|
||||
|
@ -91,12 +91,16 @@ RUN bash $INST_SCRIPTS/gamepad/install_gamepad.sh && rm -rf $INST_SCRIPTS/gamepa
|
||||
COPY ./src/ubuntu/install/webcam $INST_SCRIPTS/webcam/
|
||||
RUN bash $INST_SCRIPTS/webcam/install_webcam.sh && rm -rf $INST_SCRIPTS/webcam/
|
||||
|
||||
### Install Printer
|
||||
### Install Printer Service
|
||||
COPY ./src/ubuntu/install/printer $INST_SCRIPTS/printer/
|
||||
COPY ./src/ubuntu/install/printer/start_cups.sh /etc/cups/start_cups.sh
|
||||
RUN bash $INST_SCRIPTS/printer/install_printer.sh && rm -rf $INST_SCRIPTS/printer
|
||||
COPY ./src/ubuntu/install/printer/resources/*.ppd /etc/cups/ppd/
|
||||
|
||||
### Install Recorder Service
|
||||
COPY ./src/ubuntu/install/recorder $INST_SCRIPTS/recorder/
|
||||
RUN bash $INST_SCRIPTS/recorder/install_recorder.sh && rm -rf $INST_SCRIPTS/recorder
|
||||
|
||||
### Copy built Squid
|
||||
COPY --from=squid_builder /usr/local/squid /usr/local/squid
|
||||
|
||||
@ -136,6 +140,11 @@ ENV HOME /home/kasm-user
|
||||
WORKDIR $HOME
|
||||
RUN mkdir -p $HOME && chown -R 1000:0 $HOME
|
||||
|
||||
### Create user exclusively for session recording purposes
|
||||
RUN (groupadd -g 1001 kasm-recorder \
|
||||
&& useradd -M -u 1001 -g 1001 kasm-recorder \
|
||||
&& usermod -a -G kasm-recorder) ; exit 0
|
||||
|
||||
### FIX PERMISSIONS ## Objective is to change the owner of non-home paths to root, remove write permissions, and set execute where required
|
||||
# these files are created on container first exec, by the default user, so we have to create them since default will not have write perm
|
||||
RUN touch $STARTUPDIR/wm.log \
|
||||
@ -156,6 +165,7 @@ RUN touch $STARTUPDIR/wm.log \
|
||||
&& chmod 755 $STARTUPDIR/webcam/kasm_webcam_server \
|
||||
&& chmod 755 $STARTUPDIR/generate_container_user \
|
||||
&& chmod 755 $STARTUPDIR/printer/kasm_printer_service \
|
||||
&& chmod 755 $STARTUPDIR/recorder/kasm_recorder_service \
|
||||
&& chmod +x $STARTUPDIR/jsmpeg/kasm_audio_out-linux \
|
||||
&& rm -rf $STARTUPDIR/install \
|
||||
&& mkdir -p $STARTUPDIR/kasmrx/Downloads \
|
||||
|
@ -99,12 +99,16 @@ RUN bash $INST_SCRIPTS/gamepad/install_gamepad.sh && rm -rf $INST_SCRIPTS/gamepa
|
||||
COPY ./src/ubuntu/install/webcam $INST_SCRIPTS/webcam/
|
||||
RUN bash $INST_SCRIPTS/webcam/install_webcam.sh && rm -rf $INST_SCRIPTS/webcam/
|
||||
|
||||
### Install Printer
|
||||
### Install Printer Service
|
||||
COPY ./src/ubuntu/install/printer $INST_SCRIPTS/printer/
|
||||
COPY ./src/ubuntu/install/printer/start_cups.sh /etc/cups/start_cups.sh
|
||||
RUN bash $INST_SCRIPTS/printer/install_printer.sh && rm -rf $INST_SCRIPTS/printer
|
||||
COPY ./src/ubuntu/install/printer/resources/*.ppd /etc/cups/ppd/
|
||||
|
||||
### Install Recorder Service
|
||||
COPY ./src/ubuntu/install/recorder $INST_SCRIPTS/recorder/
|
||||
RUN bash $INST_SCRIPTS/recorder/install_recorder.sh && rm -rf $INST_SCRIPTS/recorder
|
||||
|
||||
### Copy built Squid
|
||||
COPY --from=squid_builder /usr/local/squid /usr/local/squid
|
||||
|
||||
@ -144,6 +148,11 @@ ENV HOME /home/kasm-user
|
||||
WORKDIR $HOME
|
||||
RUN mkdir -p $HOME && chown -R 1000:0 $HOME
|
||||
|
||||
### Create user exclusively for session recording purposes
|
||||
RUN (groupadd -g 1001 kasm-recorder \
|
||||
&& useradd -M -u 1001 -g 1001 kasm-recorder \
|
||||
&& usermod -a -G kasm-recorder) ; exit 0
|
||||
|
||||
### FIX PERMISSIONS ## Objective is to change the owner of non-home paths to root, remove write permissions, and set execute where required
|
||||
# these files are created on container first exec, by the default user, so we have to create them since default will not have write perm
|
||||
RUN touch $STARTUPDIR/wm.log \
|
||||
@ -164,6 +173,7 @@ RUN touch $STARTUPDIR/wm.log \
|
||||
&& chmod 755 $STARTUPDIR/webcam/kasm_webcam_server \
|
||||
&& chmod 755 $STARTUPDIR/generate_container_user \
|
||||
&& chmod 755 $STARTUPDIR/printer/kasm_printer_service \
|
||||
&& chmod 755 $STARTUPDIR/recorder/kasm_recorder_service \
|
||||
&& chmod +x $STARTUPDIR/jsmpeg/kasm_audio_out-linux \
|
||||
&& rm -rf $STARTUPDIR/install \
|
||||
&& mkdir -p $STARTUPDIR/kasmrx/Downloads \
|
||||
|
@ -114,12 +114,16 @@ RUN bash $INST_SCRIPTS/gamepad/install_gamepad.sh && rm -rf $INST_SCRIPTS/gamepa
|
||||
COPY ./src/ubuntu/install/webcam $INST_SCRIPTS/webcam/
|
||||
RUN bash $INST_SCRIPTS/webcam/install_webcam.sh && rm -rf $INST_SCRIPTS/webcam/
|
||||
|
||||
### Install Printer
|
||||
### Install Printer Service
|
||||
COPY ./src/ubuntu/install/printer $INST_SCRIPTS/printer/
|
||||
COPY ./src/ubuntu/install/printer/start_cups.sh /etc/cups/start_cups.sh
|
||||
RUN bash $INST_SCRIPTS/printer/install_printer.sh && rm -rf $INST_SCRIPTS/printer
|
||||
COPY ./src/ubuntu/install/printer/resources/*.ppd /etc/cups/ppd/
|
||||
|
||||
### Install Recorder Service
|
||||
COPY ./src/ubuntu/install/recorder $INST_SCRIPTS/recorder/
|
||||
RUN bash $INST_SCRIPTS/recorder/install_recorder.sh && rm -rf $INST_SCRIPTS/recorder
|
||||
|
||||
### Copy built Squid
|
||||
COPY --from=squid_builder /usr/local/squid /usr/local/squid
|
||||
|
||||
@ -163,6 +167,11 @@ ENV HOME /home/kasm-user
|
||||
WORKDIR $HOME
|
||||
RUN mkdir -p $HOME && chown -R 1000:0 $HOME
|
||||
|
||||
### Create user exclusively for session recording purposes
|
||||
RUN (groupadd -g 1001 kasm-recorder \
|
||||
&& useradd -M -u 1001 -g 1001 kasm-recorder \
|
||||
&& usermod -a -G kasm-recorder) ; exit 0
|
||||
|
||||
### FIX PERMISSIONS ## Objective is to change the owner of non-home paths to root, remove write permissions, and set execute where required
|
||||
# these files are created on container first exec, by the default user, so we have to create them since default will not have write perm
|
||||
RUN touch $STARTUPDIR/wm.log \
|
||||
@ -183,6 +192,7 @@ RUN touch $STARTUPDIR/wm.log \
|
||||
&& chmod 755 $STARTUPDIR/webcam/kasm_webcam_server \
|
||||
&& chmod 755 $STARTUPDIR/generate_container_user \
|
||||
&& chmod 755 $STARTUPDIR/printer/kasm_printer_service \
|
||||
&& chmod 755 $STARTUPDIR/recorder/kasm_recorder_service \
|
||||
&& chmod +x $STARTUPDIR/jsmpeg/kasm_audio_out-linux \
|
||||
&& rm -rf $STARTUPDIR/install \
|
||||
&& mkdir -p $STARTUPDIR/kasmrx/Downloads \
|
||||
|
@ -89,12 +89,16 @@ RUN bash $INST_SCRIPTS/gamepad/install_gamepad.sh && rm -rf $INST_SCRIPTS/gamepa
|
||||
COPY ./src/ubuntu/install/webcam $INST_SCRIPTS/webcam/
|
||||
RUN bash $INST_SCRIPTS/webcam/install_webcam.sh && rm -rf $INST_SCRIPTS/webcam/
|
||||
|
||||
### Install Printer
|
||||
### Install Printer Service
|
||||
COPY ./src/ubuntu/install/printer $INST_SCRIPTS/printer/
|
||||
COPY ./src/ubuntu/install/printer/start_cups.sh /etc/cups/start_cups.sh
|
||||
RUN bash $INST_SCRIPTS/printer/install_printer.sh && rm -rf $INST_SCRIPTS/printer
|
||||
COPY ./src/ubuntu/install/printer/resources/*.ppd /etc/cups/ppd/
|
||||
|
||||
### Install Recorder Service
|
||||
COPY ./src/ubuntu/install/recorder $INST_SCRIPTS/recorder/
|
||||
RUN bash $INST_SCRIPTS/recorder/install_recorder.sh && rm -rf $INST_SCRIPTS/recorder
|
||||
|
||||
### Copy built Squid
|
||||
COPY --from=squid_builder /usr/local/squid /usr/local/squid
|
||||
|
||||
@ -138,6 +142,11 @@ ENV HOME /home/kasm-user
|
||||
WORKDIR $HOME
|
||||
RUN mkdir -p $HOME && chown -R 1000:0 $HOME
|
||||
|
||||
### Create user exclusively for session recording purposes
|
||||
RUN (groupadd -g 1001 kasm-recorder \
|
||||
&& useradd -M -u 1001 -g 1001 kasm-recorder \
|
||||
&& usermod -a -G kasm-recorder) ; exit 0
|
||||
|
||||
### FIX PERMISSIONS ## Objective is to change the owner of non-home paths to root, remove write permissions, and set execute where required
|
||||
# these files are created on container first exec, by the default user, so we have to create them since default will not have write perm
|
||||
RUN touch $STARTUPDIR/wm.log \
|
||||
@ -158,6 +167,7 @@ RUN touch $STARTUPDIR/wm.log \
|
||||
&& chmod 755 $STARTUPDIR/webcam/kasm_webcam_server \
|
||||
&& chmod 755 $STARTUPDIR/generate_container_user \
|
||||
&& chmod 755 $STARTUPDIR/printer/kasm_printer_service \
|
||||
&& chmod 755 $STARTUPDIR/recorder/kasm_recorder_service \
|
||||
&& chmod +x $STARTUPDIR/jsmpeg/kasm_audio_out-linux \
|
||||
&& rm -rf $STARTUPDIR/install \
|
||||
&& mkdir -p $STARTUPDIR/kasmrx/Downloads \
|
||||
|
@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
action=$1
|
||||
|
||||
pid=$(pgrep -f '^/dockerstartup/recorder/kasm_recorder_service')
|
||||
|
||||
case $action in
|
||||
"stop"|"pause")
|
||||
if [ -z "$pid" ]; then
|
||||
echo "No recording process found."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
kill -s SIGINT $pid
|
||||
while [ ! -f "/tmp/kasm_recorder.ack" ]; do
|
||||
sleep 1
|
||||
done
|
||||
;;
|
||||
"resume")
|
||||
if [ ! -z "$pid" ]; then
|
||||
echo "Recording process already running."
|
||||
exit 0
|
||||
fi
|
||||
kill `pgrep -f "kasm_recorder_startup.sh"`
|
||||
/dockerstartup/kasm_recorder_startup.sh &
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {stop|pause|resume}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
18
src/common/scripts/kasm_hook_scripts/kasm_recorder_startup.sh
Executable file
18
src/common/scripts/kasm_hook_scripts/kasm_recorder_startup.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
mkdir -p /opt/kasm/recordings
|
||||
sudo chown kasm-recorder:kasm-recorder /opt/kasm/recordings
|
||||
sudo chmod 700 /opt/kasm/recordings
|
||||
|
||||
# wait until X display is avaiable and allow the recorder to connect to it
|
||||
while ! xhost +SI:localuser:kasm-recorder 2>/dev/null; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
rm -rf /tmp/kasm_recorder.ack
|
||||
|
||||
while [ ! -f "/tmp/kasm_recorder.ack" ]; do
|
||||
runuser -m kasm-recorder -c "$STARTUPDIR/recorder/kasm_recorder_service --debug 1 --directory /opt/kasm/recordings/ --log /tmp/recorder.log" || true
|
||||
sleep 1
|
||||
done
|
13
src/ubuntu/install/recorder/install_recorder.sh
Normal file
13
src/ubuntu/install/recorder/install_recorder.sh
Normal file
@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
### every exit != 0 fails the script
|
||||
set -e
|
||||
|
||||
COMMIT_ID="b9f195d8aac56b3127be9083470bddc360e30377"
|
||||
BRANCH="main"
|
||||
COMMIT_ID_SHORT=$(echo "${COMMIT_ID}" | cut -c1-6)
|
||||
|
||||
ARCH=$(arch | sed 's/aarch64/arm64/g' | sed 's/x86_64/amd64/g')
|
||||
|
||||
mkdir -p $STARTUPDIR/recorder
|
||||
wget -qO- https://kasmweb-build-artifacts.s3.amazonaws.com/kasm_recorder_service/${COMMIT_ID}/kasm_recorder_service_${ARCH}_${BRANCH}.${COMMIT_ID_SHORT}.tar.gz | tar -xvz -C $STARTUPDIR/recorder/
|
||||
echo "${BRANCH}:${COMMIT_ID}" > $STARTUPDIR/recorder/kasm_recorder_service.version
|
Loading…
Reference in New Issue
Block a user