How to Set Up OpenVPN on OpenElec / KODI
Please note that there is no option in OpenELEC and/or KODI to change the OpenVPN port. The default port is 1194 and this should work fine for most people.
Step 1: Download the required files
To configure OpenVPN on OpenELEC/KODI you need to modify a .ovpn file and use SFTP and SSH.
First download our TLS key and VPN certificate (CA):
Choose a VPN.ht OpenVPN configuration on our servers page (https://vpn.ht/servers) or download our default configuration.
Step 2: Create a authentication file
Create a new text file pass.txt on your dekstop and insert your VPN.ht VPN Username and VPN.ht VPN password. Username in first line and password in second line.
Step 3: Modify the OpenVPN configuration
Open the .ovpn file you downloaded in step 1 and modify the following:
1. Find the lines that say <tls-auth> and </tls-auth>. Remove everything that's in and between these lines so that the complete block is gone.
2. Now add tls-auth /storage/.config/vpnht-tls.key 1 on a new line.
3. Find the line that says auth-user-pass and change it to auth-user-pass /storage/.config/pass.txt
3. Find the lines that say <ca> and </ca>. Remove everything that's in and between these lines so that the complete block is gone.
4. Now add ca /storage/.config/vpnht.crt on a new line.
Step 4: Transfer the files
Start your favourite SFTP client (WinSCP on Windows for example) and transfer the .ovpn files, vpnht.crt, vpnht-tls.key and pass.txt to /storage/.config/ on the OpenELEC/Kodi device.
The default user is 'root' and the default password is 'openelec'.
Step 5: Connect
Now start your favourite SSH client (terminal on Unix, Putty on Windows) and run the following command:
Wait a few seconds and you should be connected!
You can check your connection by executing:
Step 6 (Optional): Start at boot
Make sure you're still connected using your favourite SSH client. And execute the following command:
touch /storage/.config/autostart.sh && chmod +x /storage/.config/autostart.sh
Then start nano (or your favourite command line text editor):
Now make sure the file contains the following (write and save it) and the VPN will connect at startup:
openvpn /storage/.config/your-OpenVPN-filename.ovpn &