Connect Kali Docker container to TryHackMe with OpenVPN

Makara

3/18/20241 min read

black iphone 7 plus box
black iphone 7 plus box

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:

  1. 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.*)

  2. 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.

  3. 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

  1. install tools for kali (in container, container’s terminal)

    You can watch this video for installation or run:

    sudo apt install kali-linux-headless

  2. 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:

  1. https://tryhackme.com/r/access

  2. Kali on docker https://www.youtube.com/watch?v=yMlOmBdBwoQ&t=3s&ab_channel=KeepItTechie

  3. Docker Privilege https://phoenixnap.com/kb/docker-privileged

  4. Error with cipher https://www.youtube.com/watch?v=r8sqhJU3Jng&t=99s&ab_channel=HamadCyber