Updated: Sep 15
In this post, I demonstrate how to install Kasm Workspaces on a Linux Machine, and then set up a Kali Linux Hacking Lab for pen testing.
Kasm is a container-streaming platform that enables you to stream docker apps from your web browser! That's right! Imagine isolated docker containers, but from the comfort of your browser - That's Kasm!
The community edition of Kasm Workspaces is available for free and can be installed on a local Linux Machine. I prefer to install it on a cloud instance because it makes it easier to access my docker apps from anywhere on the Internet, and also since the apps are not running on my own Computer, I do not have to worry about any malicious activity of zero-day attacks.
But if you want to install it on your local Linux machine, go for it! It doesn't make Kasm less capable in any aspect.
Step1. Create a swap partition of 1GiB
sudo dd if=/dev/zero bs=1M count=1024 of=/mnt/1GiB.swap sudo chmod 600 /mnt/1GiB.swap sudo mkswap /mnt/1GiB.swap sudo swapon /mnt/1GiB.swap
Step2. Make the swap partition available on boot
echo '/mnt/1GiB.swap swap swap defaults 0 0' | sudo tee -a /etc/fstab
Step3. Download the latest version of the Kasm Workspaces community edition
curl -O https://kasm-static-content.s3.amazonaws.com/kasm_release_22.214.171.12442e.tar.gz
Step4. Extract the file
tar -xf kasm_release*.tar.gz
Step5. Run the installation script
sudo bash kasm_release/install.sh
This will install Kasm Workspaces on your machine and download all the pre-built images. It takes around 10 minutes for this process to complete.
Once installed, you will be given the randomly generated login credentials to your Kasm Workspaces, note them down.
Now, access your Kasm Workspaces UI by going to https://<YOUR_IP>
Log in with your credentials, and you will be taken to your dashboard. Here you can see all the pre-built apps. You can spawn up a container of any of these apps instantly by clicking on "Launch Session".
Setting Up Kali Linux
Kali Linux is one of the pre-built apps that comes with Kasm but as you can see from the screenshot above, it is disabled (greyed out) by default.
- To enable it, go to the "Admin" tab, and then "Images".
- Search for Kali Linux and click "Edit"
- Check the box that says "Enable"
- Then, scroll down and paste the following JSON value in the "Docker Run Config Override" field. This JSON enables you to use OpenVPN from your Kali Linux container.
- Finally, click Save.
It takes some time for Kasm to download the image of Kali Linux and set it up for you, so just be patient. In my case, it took around 5 minutes before Kali Linux was usable.
Once Kali Linux is available, click on it and select "Launch Session". This will spawn up an isolated Kali Linux container in your browser!
Now, you can use Kali Linux right from your browser! Once you are done with it, you can simply destroy your session which will kill the container completely leaving no tracks!
If you're intending to use this Kali Linux container for penetration testing, you will most probably also need OpenVPN so that you can connect to the target's network.
OpenVPN is installed by default, but you still have to upgrade it to the latest version to be able to use it without any issues.
- First, update your repos
sudo apt-get update
- Next, upgrade OpenVPN to the latest version
sudo apt install openvpn
- And that's it! You can now use OpenVPN without any issues!
sudo openvpn myfile.ovpn
So, that'll be all for this post. If you want to watch the full video where I demonstrate how to install Kasm, setup Kali Linux, and also hack a TryHackMe room called "Internal" from the Kali Linux container, check it out on YouTube: https://youtu.be/ir3QhZp8864