Confession time: Despite my best intentions (and all of the time I’ve spent studying for AWS certifications), I still *stink* at Linux! I mean I can get around, edit things, start/stop services, but I don’t understand it in the fundamental way that I understand windows. I have been meaning to get better at it (honest!)… but for some reason there’s always something else that needs to get done.
I’ve installed Linux distros onto VMware Workstation about a dozen times with the best of intentions, but then what happens? Life happens! Some tight timeline thing comes along and I start to struggle with the OS & not the project. I throw my hands up and switch back over to good old windows where I know how to move around at least.
I told you that story to preface this article. I’m currently taking the free Introduction to OS Command Injections course over at Cybr. During the lab setup phase the instructor helps to setup your homelab by:
- Installing VirtualBox
- Downloading the Kali Linux distro
- Running that ISO in VirtualBox
Because I stink at Linux (see above…) I ran into several issues. Here is a step by step for getting Docker on Kali Linux on WSL 2 on Windows up and running!
Install WSL 2 (make sure you are on Windows 10 version 2004, build 19041 or higher!):
- Run Powershell as Admin:
2. Enable WSL, from PowerShell type:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Download the Linux kernel update package
Set WSL 2 as your default version:
wsl --set-default-version 2
Install Kali Linux from MS Store
Type “store” in the start menu:
Put Kali Linux in the search bar and go get it!
From the Kali CLI, perform the following tasks:
sudo apt update && sudo apt upgrade -y sudo apt install kali-desktop-xfce -y sudo apt install xrdp -y sudo service xrdp start
Install Docker Desktop for Windows
Once this is done, open settings and change resources so that WSL integration is ON for all the distros that you want to run docker in:
Now that this is done, go back into the Kali CLI and input the following commands:
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add - echo 'deb [arch=amd64] https://download.docker.com/linux/debian buster stable' | sudo tee /etc/apt/sources.list.d/docker.list sudo apt-get update sudo apt-get install docker-ce
Note: Instead of using
sudo systemctl start docker
sudo /etc/init.d/docker start
OK! Now that I’ve got that sorted out, I can create my 2 docker environments and start learning about OS command injections: