Connect Kali Docker container to TryHackMe with OpenVPN
Makara
3/18/20241 min read
Purpose of this blog :
Get OpenVPN running with docker kali image
Solve Came across error with “ — cipher” when connecting to TryHackMe VPN
Solve relevant Error related to tun “(OpenVPN — ERROR: Cannot open TUN/TAP dev /dev/net/tun: No such file or directory (errno=2))”
Assuming you have:
Docker install on your system
TryHackMe account
Downloaded Kali image
Basic understanding of Docker
Step:
First you need to download VPN configuration file. Avoid EU-Regular-3 (It is not working on my machine during this time of testing, and other people have reported similar encounter with OpenVPN 2.6.*)
Run container (on host machine) docker run --privileged -it [image_name].
In my case, I renamed the image to kali docker run --privileged -it kali
Make sure to use “ — privileged” flag, otherwise you are not able to connect to VPN.
Copy file from your Host to your Container (on host machine) docker cp host_path_to_downlaoded_file/file.ovpn container_name:/vpn3.ovpn
In my case, I am already inside the directory where i saved configuration file as vpn.ovpn, and great_rhodes is my container name and destination that I wanted it to be is in /:
docker cp vpn.ovpn great_rhodes:/vpn.ovpn
install tools for kali (in container, container’s terminal)
You can watch this video for installation or run:
sudo apt install kali-linux-headless
Navigate to / then run: (container’s terminal)
sudo openvpn vpn.opvn
You should be connected, and you can verify in TryHackMe or run ifconfig in container’s terminal to see your IP.
NOTE: if there is error with — cipher, make sure you nano in openvpn config file and it shows “data-ciphers AES-256-CBC” not just “cipher” (somewhere with in the first 10th lines)
Resources: