Compare commits

..

2 Commits

Author SHA1 Message Date
Dmitry Maksyoma
0df8de241e More XDG work I'll probably never need 2021-07-01 20:08:49 +12:00
Dmitry Maksyoma
905a65b0cd Proof of concept xdg-portal KDE + Firefox 2021-06-18 07:53:27 +12:00
6 changed files with 40 additions and 199 deletions

View File

@@ -1,11 +1,11 @@
# KasmVNC - Linux Web Remote Desktop # KasmVNC - Linux Web Remote Desktop
<a href="https://kasmweb.com"><img src="https://kasm-static-content.s3.amazonaws.com/logo_kasm.png" width="300"><a/> [![Kasm Technologies](https://kasm-static-content.s3.amazonaws.com/368_kasm_logo_.jpg "Kasm Logo")](https://kasmweb.com)
[Kasm Technologies](https://www.kasmweb.com) developed Kasm Workspaces, the Containerized Streaming Platform. Kasm has open-sourced the Workspace docker images, which include containerized [full desktops and apps](https://github.com/kasmtech/workspaces-images) and [base images](https://github.com/kasmtech/workspaces-core-images) intended for developers to create custimized streaming containers. These containers can be used standalone or within the [Kasm Workspaces Platform](https://www.kasmweb.com) which provides a full Enterprise feature set. KasmVNC is used as the streaming tech for our container images, however, you can use KasmVNC for individual servers. While the term VNC is in the name, KasmVNC is not intended to remain compliant with the RFB spec and has different goals than other VNC projects: [Kasm Technologies LLC](https://www.kasmweb.com) developed Kasm Server, a Containerized Desktop Infrastructure (CDI) solution. Kasm started with TigerVNC and eventually forked it to create KasmVNC. KasmVNC is used within the overal Kasm CDI infrastructure, however, you can use KasmVNC for individual servers. KasmVNC has different goals than TigerVNC:
- Web-based - KasmVNC is designed to provide a web accessible remote desktop. It comes with a web server and websocket server built in. There is no need to install other components. Simply run and navigate to your desktop's URL on the port you specify. While you can still tun on the legacy VNC port, it is disabled by default. - Web-based - KasmVNC is designed to provide a web accessible remote desktop. It comes with a web server and websocket server built in. There is no need to install other components. Simply run and navigate to your desktop's URL on the port you specify. While you can still tun on the legacy VNC port, it is disabled by default.
- Security - The RFB specification (VNC) limits the password field to 8 characters, so while the client may take a longer password, only the first 8 characters are sent. KasmVNC defaults to HTTPS with HTTP Basic Auth and disables the legacy VNC authentication method which is not sufficiently secure for internet accessible systems. - Security - KasmVNC defaults to HTTPS and allows for HTTP Basic Auth. VNC Password authentication is limited by specification to 8 characters and is not suffecient for use on an internet accessible remote desktop. Our goal is to create a by default secure, web based experience.
- Simplicity - KasmVNC aims at being simple to deploy and configure. - Simplicity - KasmVNC aims at being simple to deploy and configure.
# New Features! # New Features!
@@ -91,13 +91,11 @@ The options for vncserver:
| interface | Which interface to bind the web server to. | | interface | Which interface to bind the web server to. |
### Development ### Development
Would you like to contribute to KasmVNC? Please reachout to us at info@kasmweb.com. We have investigated or are working on the following, if you have experience in these fields and would like to help please let us know. Would you like to contribute to KasmVNC? Please reachout to us at info@kasmweb.com
Real-time H264 encoding using NVIDIA and Intel encoding technology. We need help, especially in packaging KasmVNC for various operating systems. We would love to have standard debian or RMP packages and host our own repo, however, that all requires a lot of experience, proper testing, and pipeline development for automated builds.
Windows version of KasmVNC. We have been able to get it to compile for Windows and increased the performance, but still not releasable. Experienced Windows developers with a background in cross compiling would help. We also need help with Windows, which is not currently supported. While KasmVNC can technically be built for Windows 10, it is unusably slow, due to all the changes that occured in Windows since the original Windows support was added in the chain of VNC forked projects.
ARM version of KasmVNC, we have had requests for this and at one point we did have an ARM build of KasmVNC but it takes dev cycles to mainain and bring it back to life.
### Compiling From Source ### Compiling From Source
See the [builder/README.md](https://github.com/kasmtech/KasmVNC/blob/master/builder/README.md). We containerize our build systems to ensure highly repeatable builds. See the [builder/README.md](https://github.com/kasmtech/KasmVNC/blob/master/builder/README.md). We containerize our build systems to ensure highly repeatable builds.

View File

@@ -34,13 +34,10 @@ RUN apt-get purge -y pm-utils xscreensaver*
RUN apt-get update && apt-get install -y vim less RUN apt-get update && apt-get install -y vim less
RUN apt-get update && apt-get -y install lsb-release RUN apt-get update && apt-get -y install lsb-release
RUN apt-get update && apt-get install -y task-cinnamon-desktop RUN apt-get update && apt-get -y install xdg-desktop-portal firefox-esr
RUN apt-get update && apt-get install -y task-gnome-desktop COPY ./xdg-desktop-portal-gtk_1.2.0-1_amd64.deb /tmp
RUN mkdir -p /usr/share/man/man1 RUN apt-get install -y /tmp/xdg-*.deb
RUN apt-get update && apt-get install -y apt-utils openjdk-11-jre # RUN apt-get install -y xdg-desktop-portal-gtk
RUN apt-get update && apt-get install -y task-lxde-desktop
RUN apt-get update && apt-get install -y task-mate-desktop
RUN apt-get update && apt-get install -y task-kde-desktop
RUN echo 'source $STARTUPDIR/generate_container_user' >> $HOME/.bashrc RUN echo 'source $STARTUPDIR/generate_container_user' >> $HOME/.bashrc
@@ -55,8 +52,12 @@ RUN dpkg -i /tmp/*.deb; apt-get -yf install
### END CUSTOM STUFF ### ### END CUSTOM STUFF ###
RUN sed -i -e 's/about:home/postimages.org/' /usr/lib/firefox-esr/browser/defaults/preferences/firefox.js
RUN sed -i -e '/browser.startup.firstrunSkipsHomepage/d' /usr/lib/firefox-esr/browser/defaults/preferences/firefox.js
RUN echo 'pref("browser.startup.firstrunSkipsHomepage", false);' >> /usr/lib/firefox-esr/browser/defaults/preferences/firefox.js
RUN chown -R 1000:0 $HOME RUN chown -R 1000:0 $HOME
USER 1000:ssl-cert USER 1000:ssl-cert
WORKDIR $HOME WORKDIR $HOME
ENV GTK_USE_PORTAL=1
ENTRYPOINT [ "/dockerstartup/vnc_startup.sh" ] ENTRYPOINT [ "/dockerstartup/vnc_startup.sh" ]

View File

@@ -33,6 +33,7 @@ RUN apt-get update && apt-get install -y supervisor xfce4 xfce4-terminal xterm l
RUN apt-get purge -y pm-utils xscreensaver* RUN apt-get purge -y pm-utils xscreensaver*
RUN apt-get update && apt-get install -y vim less RUN apt-get update && apt-get install -y vim less
RUN apt-get update && apt-get -y install lsb-release RUN apt-get update && apt-get -y install lsb-release
RUN apt-get update && apt-get -y install xdg-desktop-portal xdg-desktop-portal-gtk firefox
RUN echo 'source $STARTUPDIR/generate_container_user' >> $HOME/.bashrc RUN echo 'source $STARTUPDIR/generate_container_user' >> $HOME/.bashrc
@@ -47,8 +48,12 @@ RUN dpkg -i /tmp/*.deb; apt-get -yf install
### END CUSTOM STUFF ### ### END CUSTOM STUFF ###
RUN echo 'pref("browser.startup.firstrunSkipsHomepage", false);' >> /usr/lib/firefox/browser/defaults/preferences/syspref.js
RUN echo 'pref("browser.startup.homepage", "postimages.org");' >> /usr/lib/firefox/browser/defaults/preferences/syspref.js
RUN chown -R 1000:0 $HOME RUN chown -R 1000:0 $HOME
USER 1000:ssl-cert USER 1000:ssl-cert
WORKDIR $HOME WORKDIR $HOME
ENV GTK_USE_PORTAL=1
ENTRYPOINT [ "/dockerstartup/vnc_startup.sh" ] ENTRYPOINT [ "/dockerstartup/vnc_startup.sh" ]

View File

@@ -5,183 +5,25 @@ set -e
display=:10 display=:10
interface=0.0.0.0 interface=0.0.0.0
cert_group=ssl-cert cert_group=ssl-cert
xstartup_script=~/.vnc/xstartup
de_was_selected_file="$HOME/.vnc/.kasmvncserver-easy-start-de-was-selected"
action=start if [[ "$1" = "--help" ]]; then
manual_xstartup_choice="Manually edit xstartup"
declare -A all_desktop_environments=(
[Cinnamon]=cinnamon-session
[Mate]="XDG_CURRENT_DESKTOP=MATE dbus-launch --exit-with-session mate-session"
[LXDE]=lxsession [Lxqt]=startlxqt
[KDE]=startkde
[Gnome]="XDG_CURRENT_DESKTOP=GNOME dbus-launch --exit-with-session /usr/bin/gnome-session"
[XFCE]=xfce4-session)
readarray -t sorted_desktop_environments < <(for de in "${!all_desktop_environments[@]}"; do echo "$de"; done | sort)
all_desktop_environments[$manual_xstartup_choice]=""
sorted_desktop_environments+=("$manual_xstartup_choice")
detected_desktop_environments=()
declare -A numbered_desktop_environments
debug() {
if [ -z "$debug" ]; then return; fi
echo "$@"
}
print_detected_desktop_environments() {
declare -i i=1
echo "Please choose Desktop Environment to run:"
for detected_de in "${detected_desktop_environments[@]}"; do
echo "[$i] $detected_de"
numbered_desktop_environments[$i]=$detected_de
i+=1
done
}
detect_desktop_environments() {
for de_name in "${sorted_desktop_environments[@]}"; do
if [[ "$de_name" = "$manual_xstartup_choice" ]]; then
detected_desktop_environments+=("$de_name")
continue;
fi
local executable=${all_desktop_environments[$de_name]}
executable=($executable)
executable=${executable[-1]}
if detect_desktop_environment "$de_name" "$executable"; then
detected_desktop_environments+=("$de_name")
fi
done
}
ask_user_to_choose_de() {
while : ; do
print_detected_desktop_environments
read -r de_number_to_run
de_name_from_number "$de_number_to_run"
if [[ -n "$de_name" ]]; then
break;
fi
echo "Incorrect number: $de_number_to_run"
echo
done
}
remember_de_choice() {
touch "$de_was_selected_file"
}
de_was_selected_on_previous_run() {
[[ -f "$de_was_selected_file" ]]
}
detect_desktop_environment() {
local de_name="$1"
local executable="$2"
if command -v "$executable" &>/dev/null; then
return 0
fi
return 1
}
did_user_forbid_replacing_xstartup() {
grep -q -v KasmVNC-safe-to-replace-this-file "$xstartup_script"
}
de_cmd_from_name() {
de_cmd=${all_desktop_environments[$de_name]}
}
de_name_from_number() {
local de_number_to_run="$1"
de_name=${numbered_desktop_environments[$de_number_to_run]}
}
warn_xstartup_will_be_overwriten() {
echo -n "WARNING: $xstartup_script will be overwritten y/N?"
read -r do_overwrite_xstartup
if [[ "$do_overwrite_xstartup" = "y" || "$do_overwrite_xstartup" = "Y" ]]; then
return 0
fi
return 1
}
setup_de_to_run_via_xstartup() {
warn_xstartup_will_be_overwriten
generate_xstartup "$de_name"
}
generate_xstartup() {
local de_name="$1"
de_cmd_from_name
cat <<-SCRIPT > "$xstartup_script"
#!/bin/sh
exec $de_cmd
SCRIPT
chmod +x "$xstartup_script"
}
enable_debug() {
debug=1
log_option="-log *:stderr:100"
}
kill_vnc_server() {
vncserver -kill $display
}
process_cli_options() {
for option in "$@"; do
case "$option" in
--help)
show_help
exit
;;
-d)
enable_debug
;;
-kill)
kill_vnc_server
exit
;;
-select-de)
action=select-de-and-start
;;
*)
echo >&2 "Unsupported argument: $option"
exit 1
esac
done
}
user_asked_to_select_de() {
[[ "$action" = "select-de-and-start" ]]
}
show_help() {
cat >&2 <<-USAGE cat >&2 <<-USAGE
Usage: `basename $0` [options] Usage: `basename $0` [options]
-d Debug output -d Debug output
-kill Kill vncserver -kill Kill vncserver
-select-de Select desktop environent to run
--help show this help --help show this help
USAGE USAGE
} exit
fi
process_cli_options "$@" if [[ "$1" = "-d" ]]; then
log_option="-log *:stderr:100"
fi
action=start
if [[ "$1" = "-kill" ]]; then
action=kill
fi
if groups | grep -qvw ssl-cert; then if groups | grep -qvw ssl-cert; then
cat <<-EOF cat <<-EOF
@@ -191,14 +33,9 @@ EOF
exit 1 exit 1
fi fi
if user_asked_to_select_de || ! de_was_selected_on_previous_run; then if [[ "$action" = "kill" ]]; then
detect_desktop_environments vncserver -kill $display
ask_user_to_choose_de exit
debug "You selected $de_name desktop environment"
if [[ "$de_name" != "$manual_xstartup_choice" ]]; then
setup_de_to_run_via_xstartup
fi
remember_de_choice
fi fi
vncserver $display -interface $interface vncserver $display -interface $interface

View File

@@ -61,8 +61,6 @@ kasmvncpasswd -d -u "$VNC_USER-to-delete" $HOME/.kasmpasswd
chmod 0600 $HOME/.kasmpasswd chmod 0600 $HOME/.kasmpasswd
openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout $HOME/.vnc/self.pem -out $HOME/.vnc/self.pem -subj "/C=US/ST=VA/L=None/O=None/OU=DoFu/CN=kasm/emailAddress=none@none.none" openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout $HOME/.vnc/self.pem -out $HOME/.vnc/self.pem -subj "/C=US/ST=VA/L=None/O=None/OU=DoFu/CN=kasm/emailAddress=none@none.none"
exec /bin/bash
vncserver :1 -interface 0.0.0.0 vncserver :1 -interface 0.0.0.0
vncserver -kill :1 vncserver -kill :1
@@ -90,6 +88,8 @@ detect_www_dir
detect_cert_location detect_cert_location
[ -n "$KASMVNC_VERBOSE_LOGGING" ] && verbose_logging_option="-log *:stderr:100" [ -n "$KASMVNC_VERBOSE_LOGGING" ] && verbose_logging_option="-log *:stderr:100"
# dbus-daemon --session --address=systemd: --nofork --nopidfile --syslog-only &
echo -e "start vncserver with param: VNC_COL_DEPTH=$VNC_COL_DEPTH, VNC_RESOLUTION=$VNC_RESOLUTION\n..." echo -e "start vncserver with param: VNC_COL_DEPTH=$VNC_COL_DEPTH, VNC_RESOLUTION=$VNC_RESOLUTION\n..."
vncserver $DISPLAY -depth $VNC_COL_DEPTH -geometry $VNC_RESOLUTION -FrameRate=$MAX_FRAME_RATE -websocketPort $VNC_PORT $cert_option -sslOnly -interface 0.0.0.0 $VNCOPTIONS $package_www_dir_option $verbose_logging_option #&> $STARTUPDIR/no_vnc_startup.log vncserver $DISPLAY -depth $VNC_COL_DEPTH -geometry $VNC_RESOLUTION -FrameRate=$MAX_FRAME_RATE -websocketPort $VNC_PORT $cert_option -sslOnly -interface 0.0.0.0 $VNCOPTIONS $package_www_dir_option $verbose_logging_option #&> $STARTUPDIR/no_vnc_startup.log

View File

@@ -8,7 +8,7 @@ cd "$(dirname "$0")"
docker build --build-arg KASMVNC_PACKAGE_DIR="build/${os_codename}" \ docker build --build-arg KASMVNC_PACKAGE_DIR="build/${os_codename}" \
-t kasmvnctester_${os}:$os_codename \ -t kasmvnctester_${os}:$os_codename \
-f dockerfile.${os}_${os_codename}.deb.test . -f dockerfile.${os}_${os_codename}.deb.test .
docker run -it -v $(realpath ${PWD}/..):/src -p 8443:8443 --rm \ docker run -it -p 443:8443 --rm \
-e KASMVNC_VERBOSE_LOGGING=$KASMVNC_VERBOSE_LOGGING \ -e KASMVNC_VERBOSE_LOGGING=$KASMVNC_VERBOSE_LOGGING \
-e "VNC_USER=foo" -e "VNC_PW=foobar" \ -e "VNC_USER=foo" -e "VNC_PW=foobar" \
kasmvnctester_${os}:$os_codename kasmvnctester_${os}:$os_codename