Hello,
I have downloaded the openvpn file from the starting point on my kali linux virtual machine, but when I try to run the command openvpn ovpnfile.ovpn
(ovpnfile is the name of the downloaded file) it says:
Options error: In [CMD-LINE]:1: Error opening configuration file: ovpnfile.ovpn
Can you help me fix this? Thank you.
Try cat ovpnfile.ovpn
and see what it says.
Do you have read permissions on the file with the account you are running openvpn with?
Ok, I think I found my problem. Every time I try to log into hackthebox through the vm it freezes and I have to force quit it and open it again so I tried to download it using the terminal, but accidentally I downloaded the html file instead of the actual .ovpn file. How can I download the file without having to open the internet?
Well you cant download a file from the internet without accessing the internet.
If you want to keep your Kali VM isolated from the internet you can download it on your host and copy it over manually.
And how can I copy it over to the vm from the host?
well, several ways - but it depends on how you have set up your VM.
If you’ve enabled drag and drop, you can drag and drop.
If you’ve enabled copy and paste you can copy the contents and paste it into a file on your kali system.
You can spin up a webserver on your host and use wget/curl in kali to extract it.
You can base64 encode it and then paste the code into base64 -d in kali.
You can spin up an FTP server in kali and push it from the host.
You can set up an SSH server in Kali and use SCP from the host.
There are probably other options, but it hinges on how you have set up the environment.
Great, thank you so much!
Ok, now I’m pretty sure I have the file. When I run cat filename.ovpn it says “No such file or directory” when I try to drag and drop the file into the terminal it says this:
Sat Sep 5 01:27:31 2020 OpenVPN 2.4.9 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on May 2 2020
Sat Sep 5 01:27:31 2020 library versions: OpenSSL 1.1.1g 21 Apr 2020, LZO 2.10
Sat Sep 5 01:27:31 2020 OpenSSL: error:0909006C:PEM routines:get_name:no start line
Sat Sep 5 01:27:31 2020 OpenSSL: error:140AD009:SSL routines:SSL_CTX_use_certificate_file:PEM lib
Sat Sep 5 01:27:31 2020 Cannot load inline certificate file
Sat Sep 5 01:27:31 2020 Exiting due to fatal error
So it’s still not working
I think I fixed it. Thank you so much once again!
bro how did you fix it?
You can do it this way or you can use net manager to import the key.
I prefer doing this option as I don’t need to worry about running the script and can tweak it later with some other stuff.
If you’re interested just do the following…
right click network icon and hit edit connections…
click + sign
Scroll to the bottom on Import a saved VPN configuration…
create
browse to the key file…
This will open a new box with all the information.
Normally lands on the VPN tab.
Rename the very top box “Connection name” to whatever. IE ‘HTB VIP+ R0ckS!’
From here I personally goto Advanced bottom right…
I’ll rename the TUN from tun0 to like htb1 htb2 htb3 ect…
I tend to click the Specifiy exit or restart ping but don’t change anything.
(You can tweak other stuff but, stick with basic here to start)
Hit ok…
Next goto IPv4 Settings Tab
Click Routes
Click the checkbox for “Use this connection only for resources on its network”
Click ok…
Repeat on the IPv6 Tab
(I leave IPv6 on for HTB because some boxes can use this proto)
Now Save…
You’ll now be able to access this connection from Net Manager as if it was wifi.
Extra
For persistence I almost always do this on HTB connections or OSCP.
From terminal
nmcli connection modify <Your VPN connection name> vpn.persistent yes
You can use auto tab to help you complete your connection name.
There are a lot of options in this cli don’t screw around too much unless you know what you’re doing lol.
Sometimes Parrot acts a fool
Sometimes parrot won’t let you save the new setup. This is because it’s missing they User private Key on VPN… you can find it under /home/<user>/.cert/
as the -key.pem
All the files used for the VPN are here if you ever need that info.