Scripts and Guide for setting up OpenVPN with Most VPN,s on Enigma2

dsayers2014

VIP Member
Guide for setting up OpenVPN with Most VPN,s on Enigma2



This Guide is for setting up OpenVPN with my private network if done correctly it should download and install your openvpn configs via a simple script


Create an account with my private network -
Code:
https://client.my-private-network.co.uk/aff.php?aff=2640

Please take up on the Free 3-day trial to put the VPN to test


Putty can be downloaded at
Code:
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

If using a Mac there are instructions at the end of the document for an alternative to Putty


First open Putty, and in the HostName (or IP address) box enter the enigma2 boxes IP address, and then click the Telnet radio button and click open
Screenshot (132).png

And then log in using the word, root


Screenshot (133).png



Download the script from here
Code:
https://www.dropbox.com/s/zfimquxeed9vctx/myvn.txt?dl=1
We only need to edit lines 1 to 3

Change line 1 uuuu with your username between the ""

Example USERNAME='davesayers19'

Change line 2 pppp with your password between the ""

example PASSWORD='149356d'


On line 3 change GBR to the country you want the VPN to connect to

Example COUNTRY='NLD'

NLD is for Netherlands

Do not edit anything below line 3 as it bay cause errors

You can change the country you want the VPN server you want to connect to use the 3 letters 3 Letter Code ie GBR for United Kingdom a list of countries here
Code:
https://help.my-private-network.co.uk/support/solutions/articles/8461-which-countries-can-i-connect-to-

Once you have edited your details copy the script and paste into putty as per example below

Screenshot (131).png


And hit enter


Before starting OpenVPN we can run an IP check script this will tell you if the vpn is working and you can test it when changing servers.

The script should have downloaded a plugin called IP Checker.

Goto plugin and you should see IP Checker press ok on the plugin and it should run a simple IP check script

You should get something like this I have removed part of my IP address


IP Check sh.jpg

Now start openvpn on box


OpenVPN.jpg

After starting openvpn the above should stay green and say running, You can now go back to plugins and start IP Checker and see if the IP Address has changed


If using Mac


There is a version of Putty for Mac but is not very good.


Open Applications ->Utilities ->

Type the following command telnet 192.168.X.X (change the IP address to the one for the Zgemma/Enigma2 boxes)

Enter the username root (and password if you have set one) and press enter

Then follow the instructions above.

Problem 1,

When enabling OpenVPN I lose internet connection.

Possible Solution

Goto your network settings on box and change DHPC to no then blue button to Edit DNS

Try Google DNS

Nameserver 1 8.8.8.8

Nameserver2 8.8.4.4

I have been working on this script since last Friday, I had a few teething problems but thanks to MYVPN with there help we sorted it and also a big thankyou to
@grog68 with his suggestions and help with making the script more simpler.



==================================================================================================================================================================

New beta OpenVPN script generator


First open Putty, and in the HostName (or IP address) box enter the enigma2 boxes IP address, and then click the Telnet radio button and click open




And then log in using the word, root




Users can now visit
Code:
http://e2openvpn.com/OpenVPN_Generator/
Add there username and password this will now generate a script.

Copy and paste the script in putty and hit enter you should now have the option for what VPN you want to use:

1) Nord VPN
2) IP Vanish
3) Digibit
4) PureVPN
5) PIA VPN
6) Windscrape
7) SurfShark
8) TorGuard
9) Ivacy
10) Quite


Choose your option and hit Enter this should then download the configs and once finished it will say OpenVPN Configs downloaded Please Start OpenVPN.


You will be asked to enter your choice again but you can ignore this.

Reboot box and goto plugins, VPN Changer and choose a country.

Attached is a guide for setting up Digibit, IP Vanish, Pure VPN and Nord

OpenATV 6.3 not currently supported
 

Attachments

Last edited:

dsayers2014

VIP Member
Any chance of a script for Digibit VPN users ?
Ill have a look but most other VPN,s have separate conf files for each server location so its harder to work out to switch location. My Private Network only uses one config and you can easily use script to edit it.
 

dsayers2014

VIP Member
For other VPN,s to use VPN Changer

In the first part I will show you how to rename all .ovpn files to .conf and add auth-user-pass/auth-user-pass password.conf you can skip this part if you have already done this. The second step will show you how to copy all conf files into subfolders with one command and add password.conf to each sub folder.

Feel free to edit password.conf to user,txt or whatever you prefer.

On the box create a folder called vpn in hdd

Now FTP your config files to hdd/vpn

Now using Talnet/putty type

Code:
cd /hdd/vpn
This will put putty in hdd/vpn

Now to rename all .ovpn files to .conf

Type in talnet/putty
Code:
# rename .ovpn to .conf
for x in *.ovpn; do mv "$x" "${x%.ovpn}.conf"; done
To add auth-user-pass/auth-user-pass password.conf to each conf file in talnet/putty paste
Code:
# Edit all conf files to have auth-user-pass/auth-user-pass password.conf
find . -name "*.conf" -exec sed -i "s/auth-user-pass/auth-user-pass password.conf/g" '{}' \;



Now that is done we can move all configs into subfolders with the same name

Ensure Talnet is still in hdd/vpn before running this command

Copy and paste in talnet/putty
Code:
# Move all files into sub folders
for file in *; do
  if [[ -f "$file" ]]; then
    mkdir "${file%.*}"
    mv "$file" "${file%.*}"
  fi
done
Now to add password.conf to each sub folder we need to add password.conf to tmp with your username and password added.

Now use the following command to copy password.conf to each sub folder with this command

Code:
# copy password.conf to each sub folder
find /hdd/vpn -type d -exec cp /tmp/password.conf {} \;
Some VPN,s need cert files and other files simply edit the last command to suit

VPN Changer is pretty simple to use, only issue is with OpenVix pressing red to stop/start OpenVPN just exits the plugin this is due to Key Mapping issue so you will need to goto OpenVPN in network to stop OpenaVPN

VPN Changer
http://www.techkings.org/attachments/enigma2-plugin-extensions-vpnchanger_1-1-0_all-zip.31684/

This should work with most VPN,s
 
Last edited:

Damo666

Registered
So I have been playing with this today and have it half working. I downloaded the configs Digibit gave me, then unzip,t it.

On box I created a folder called digibit and dragged all the configs to that folder.

Now I used putty in typed
Code:
cd /digibit
this will put putty in the digibit folder

Now I used a simple command to rename all the .ovpn files to .conf
Code:
for x in *.ovpn; do mv "$x" "${x%.ovpn}.conf"; done
Now to add password.txt to each conf file with one command I used
Code:
sed -i -e "s/auth-user-pass/auth-user-pass password.txt/g" /digibit    /*.conf
Then created a password.txt in etc/openvpn and added my username and password

So now I have all the configs in /digibit I can just drag the server I want to etc/openvpn and start openvpn.

Unfortunately I,m not sure how to get the script to move one selected conf to etc/openvpn with using country at the top, but this works quite well.

On a side note I have seen a plugin that should allow you to switch configs that are on hdd/vpn but I haven't had chance to test it yet
Wooshbuild v7 has a digibit von plug in built in. You just enter your digibit user and pass then select server.
 

thomaskieron

Registered
I get this after hitting return in putty...

Connecting to raw.githubusercontent.com (151.101.0.133:443)
script.sh 100% |*******************************| 1833 0:00:00 ETA
sed: -i requires an argument
[email protected]:~# script.sh && chmod +x script.sh && ./script.sh
 

dsayers2014

VIP Member
I get this after hitting return in putty...

Connecting to raw.githubusercontent.com (151.101.0.133:443)
script.sh 100% |*******************************| 1833 0:00:00 ETA
sed: -i requires an argument
[email protected]:~# script.sh && chmod +x script.sh && ./script.sh
Just ran it and running fine. check you are only editing line 1 to 3 and copying and pasting the whole script.

Screenshot (1).png
 

dsayers2014

VIP Member
yep, username and password as per the MPN account screen
There must be an error how your inputting username and password they need to stay between ' ' example

Code:
USERNAME='thomaskieron'
PASSWORD='TK135'
COUNTRY='GBR'
###############################################################
# Standard Config
# If you change anything below this line, it probably wont 
# be able to connect to your VPN.
################################################################
wget -O script.sh https://raw.githubusercontent.com/davesayers2014/OpenVPN/master/myvpn/myvpn.sh && sed -i "s/uuuu/$USERNAME/g" script.sh && sed -i "s/pppp/$PASSWORD/g" script.sh && sed -i "s/GBR/$COUNTRY/g" script.sh && chmod +x script.sh && ./script.sh
If you copy and past the above into talnet without editing it still should download and edit the openvpn configs although username and password will be incorrect, then check etc/openvpn user.txt
 
Top