Kasm Workspaces: Spinning up containers on the Raspberry Pi
Installation and initial configuration steps

Currently working as a Senior Consultant at Netcompany spending my full-time job solving the SharePoint riddles. In the free time I'm expanding my understanding of cybersecurity through hacking activities. Git fanboy.
Raspberry Pi Kasm Guide was inspired by NetworkChuck, go watch this and his other videos, he's living inspiration β
Prerequisites
I am running the following setup, but feel free to test on other configurations.
I'm getting a small commision for the purchases made from the links below
- Raspberry Pi 4B 8GB RAM
- SD Card (at least 64GB)
- Raspberry Pi 4 Power Supply
- Argon NEO Raspberry Pi 4 Case
- Ethernet cable (for the initial configuration or Internet over LAN)
Prepare Ubuntu Server SD Card
- Download Ubuntu Server 20.04 LTS for Raspberry Pi 4 from the official download page.

Verify hash (should match)

On Windows you can get SHA256 sum from PowerShell
# PowerShell Get-FileHash -Algorithm SHA256 .\ubuntu-20.04.3-preinstalled-server-arm64+raspi.img.xzRun Raspberry Pi Imager or Etcher.IO to write Ubuntu to the SD Card.
Unfortunately this distro doesn't work with Advanced features of Raspberry Pi Imager (Ctrl+Shift+X). Raspberry just won't boot if any of advanced options is used.
- When the process ends, insert a SD Card, connect power and wait a bit for the device to boot. Then SSH into the Ubuntu and start post-install steps.
Optional post-install steps
The following steps are optional, but highly recommended from a hardening perspective.
Additonally I have my own shell profile that I can download from the GitHub whenever I know I will be using Linux instance for a longer while.
$ wget https://github.com/KamilPacanek/configs/raw/master/kali-rearm/.shell_aliases -O ~/.bash_aliases $ source ~/.bash_aliases
- Login via SSH (default credentials
ubuntu:ubuntu) and change password to more secure one - we will be using it later forsudocommands. - As we didn't have possibility to change username or hostname during the system installation, we have option to do it now. Change hostname (
/etc/hostsand/etc/hostname, then reboot). - Now perform following steps from Hardening section: Add new suduer account, Enable SSH login, Disable root & password login, Remove default user.
- Add the following aliases to your
.bash_aliases. These are easier to call than remembering the paths.alias kasm-start="sudo /opt/kasm/bin/start" alias kasm-stop="sudo /opt/kasm/bin/stop"
Mandatory post-install steps
- Relogin on new user using SSH and update packages and distribution (see the
apt-updaterfrom my.shell_aliases) - As you probably will be exposing Kasm to the Internet, it's best to have the important patches applied both manually and automatically. For the second part, I recently started using the
unattended-upgradespackage. - Ensure swap partition is available. Run
$ cat /proc/swapsto see if any swap is already created. In my case, it isn't, so I'm running this command to create and mount 4GB of swap.
Kasm recommend 1GB per concurrent session and I don't plan to run more than two images simultaneously. I have plenty space on my SD Card, so 2GB buffor sounds reasonable with my 8GB RAM on Raspberry.# don't bother tinkering with 'bs' and 'count' arguments; # did a test with 1M/4096 and 512K/8192 and both completed at same time $ sudo dd if=/dev/zero bs=1M count=4096 of=/mnt/4GiB.swap $ sudo chmod 600 /mnt/4GiB.swap $ sudo mkswap /mnt/4GiB.swap $ sudo swapon /mnt/4GiB.swap # make swap available on boot $ echo '/mnt/4GiB.swap swap swap defaults 0 0' | sudo tee -a /etc/fstab





