Hi Everyone,
I spent the last week scouring the forums to help setup an OpenVPN client on my OMV 4 installation on my Banana Pi. I emailed the instructions to Surfshark but I thought I would share them on the OMV forum as well.
Here is a guide on how to set up auto-connect for Raspberry Pi and other single board computers that are based on Debian. In this case we are working with an Openmediavault installation on a Banana Pi:
Note that the file used for this example is the Canadian Montreal file: ca-mon.prod.surfshark.com_udp.ovpn. This file is eventually renamed to ca-mon. Be sure that if you use a different file, you rename it within these directions accordingly.
1.Open a terminal window (through Putty or another app) and SSH into your Raspberry Pi machine.
2. Install the necessary packages by entering the command:
sudo apt-get install openvpn unzip
If you are requested to enter your password, please enter your computer's admin password.
3. Navigate to OpenVPN directory by entering:
cd /etc/openvpn
4. Download your VPN provider’s OpenVPN configuration files. In this case we are using the address provided by Surfshark:
sudo wget https://account.surfshark.com/api/v1/server/configurations
5. Extract `configurations.zip`:
sudo unzip configurations
6. Remove the .zip file which will not be used:
sudo rm configurations
7. To see the list of all the available servers enter:
ls
8. Choose one of the servers from the servers list and connect to Surfshark by entering:
sudo openvpn ca-mon.prod.surfshark.com_udp.ovpn
9. OpenVPN will ask you for service credentials. Find your VPN providers credentials for your account (typically through their web site).
10. You have successfully connected to your vpn provider if in the Terminal logs you can see "Initialization Sequence Completed".
Now you can start the autoconnect sequence.
1. Create auth.txt file inside /etc/openvpn directory via this command:
sudo nano /etc/openvpn/auth.txt
Fill it with your SurfShark Service Credentials:
username
password
Save it.
2. Then open the file which you are using to establish a connection. Note that we have chosen the “ca-mon.prod.surfshark.com_udp.ovpn” file, but you can choose whichever .ovpn file suits you best:
sudo nano /etc/openvpn/ca-mon.prod.surfshark.com_udp.ovpn
And change this line:
auth-user-pass
into
auth-user-pass auth.txt
Save the file and change its name:
sudo mv /etc/openvpn/ca-mon.prod.surfshark.com_udp.ovpn /etc/openvpn/ca-mon.conf
3. Then you will have to edit the startup on boot file via this command:
sudo nano /etc/default/openvpn
When the text editor opens, go to the line with #AUTOSTART=“all” and remove the # so that it looks like this:
AUTOSTART=”all”
Save the file.
4. Reload the daemons
sudo systemctl daemon-reload
5. Run the following command to enable Openvpn service while booting:
sudo systemctl enable openvpn@ca-mon.service
6. Start Openvpn with the following command:
sudo systemctl start openvpn@ca-mon.service
7. Reboot your Linux device:
reboot
8. After the reboot - open the terminal and type in:
sudo traceroute 8.8.8.8
The first hop address should be 10.8.8.1 and in ipleak.net you should see Canada Montreal servers IP address.
There it is! Now OMV should reconnect to the VPN client at every reboot.