From e4a57f4a6a210f3f1ea89c6992bf79c8bb35c4b1 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Thu, 24 Oct 2024 12:58:20 +0500 Subject: [PATCH] Update KasmVNC with custom image config steps Add instructions for extending kasmtech custom images and modify the run script to attempt system-wide config creation, ensuring flexibility for environments without sudo access. --- kasmvnc/README.md | 19 +++++++++++++++++++ kasmvnc/run.sh | 19 ++++++++++++++++--- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/kasmvnc/README.md b/kasmvnc/README.md index 0639bf0..5244afb 100644 --- a/kasmvnc/README.md +++ b/kasmvnc/README.md @@ -21,3 +21,22 @@ module "kasmvnc" { ``` > **Note:** This module only works on workspaces with a pre-installed desktop environment. As an example base image you can use `codercom/enterprise-desktop` image. + +> **Note:** You can also use the kasmtech [custom images](https://kasmweb.com/docs/latest/guide/custom_images.html) by extending them as following: + +```Dockerfile +FROM kasmweb/postman:1.16.0 +ARG USER=kasm-user +USER root +# Overwrite the existing config file to disable ssl +RUN cat < /etc/kasmvnc/kasmvnc.yaml +network: + protocol: http + ssl: + require_ssl: false + udp: + public_ip: 127.0.0.1 +EOF +RUN addgroup $USER ssl-cert +USER $USER +``` diff --git a/kasmvnc/run.sh b/kasmvnc/run.sh index b2d35a6..76dcb14 100644 --- a/kasmvnc/run.sh +++ b/kasmvnc/run.sh @@ -158,9 +158,22 @@ else echo "Skipping installation." fi -# create the config file as the current user .vnc/kasmvnc.yaml -# There is already a config file in the image at /etc/kasmvnc/kasmvnc.yaml, but we need to set the websocket port -mkdir -p "$HOME/.vnc" # Ensure the directory exists +# Try to create /etc/kasmvnc/kasmvnc.yaml system-wide +# we don't fail as some images might be missing sudo permissions +sudo mkdir -p /etc/kasmvnc || true +sudo bash -c "cat > /etc/kasmvnc/kasmvnc.yaml < "$HOME/.vnc/kasmvnc.yaml" <