With his how to you learn to install CyberGhost on OpenHAB. This potentially helps to increase privacy for your OpenHAB.
Note – you must read the below:
- Virtual Private Networks (VPN) are a great technology, but it is not in all countries and states allowed
- You are fully responsible and accountable to clarify first whether your country or state allows you to use VPN
- In case the usage of VPN is not allowed, you must close this website immediately!
- Again: You are the only one that is fully accountable and responsible! If you not sure, you better close this page!
Index Of How To Install Cyberghost on Raspberry Pi
Background
In this scenario, i am using a Raspberry 4, plus openhabian provided by OpenHAB 4.
Cyberghost offers internationally Virtual Private Networks. By doing so, Cyberghost also promises great Privacy. In case you prefer more privacy, then you maybe like to leverage on this VPN technology and on Cyberghost.
Please be aware, you are the only one that is fully accountable and responsible to clarify whether you are in your country or state allowed to use VPN technology. In case you are not allowed to use VPN technology, or you have not clarified this, then you must close this page immediately.
How To Install Cyberghost on OpenHAB
This How To consists of six main steps in order to get Cyberghost running on your OpenHAB:
- Cyberghost Online Account – You will be creating a configuration that you need for your OpenHAB
- Moving to OpenHAB Command Line To Install OpenVPN
- Download Of The Cyberghost Configuration by SCP To Your OpenHAB
- Configure the OpenVPN Package
- Autostart
- Test Configuration
Cyberghost Online Account (Cyberghost website):
- Surf to Cyberghost
- Click on “VPN” under products
- Search for the section “Manual Setup”
- Click “Configure Device”
Now, in the “Configure Routers or other devices” menu, we select the following
- Protocol: “OpenVPN TCP” or alternatively UDP that is faster
- Country: Select your preferred country
- Device name: Give your device a name
- Optional: activate extra features
Download Configuration: Once done, you click “Download Configuration”. We will need this in the next step. I downloaded it into the folder ../Downloads/raspi
OpenHAB Command Line To Install OpenVPN
First of all, update your OpenHAB:
sudo apt-get update && sudo apt-get upgrade
Install the Cyberghost package:
sudo apt-get install openvpn openssl openresolv
Download VPN Configuration by SCP to your OpenHAB
In the first step, once you configured Cyberghost on its website, you have downloaded the configuration. This configuration is typically available and stored on your computer as .zip file or (if you have) on a Mac Book already as an extracted zip file. You should (after extracting) find 4 files:
- ca.crt
- client.crt
- client.key
- openvpn.ovpn
These are the files which we now copy to the the Raspberry by leveraging on SCP. To do so, open a terminal on your computer. This most likely is easier on a Mac than on a Windows computer. However, you need to open a terminal or in case of Windows you leverage on a piece of software such as Putty.
In the terminal, go to the directory in which you have stored the downloaded files. On a Macbook it will most likely be “Downloads”. To get there, enter
cd Downloads
You maybe find the files in a sub directory of Downloaded. Simply find it. In my case its in Downloads/raspi. Hence i would enter:
cd Downloads/raspi
Now lets copy (of corse, you adjust for your files and directories as needed). This you can get done by the following command (in my case the IP address is 192.168.18.96. In your case its maybe most likely different. In this case you need to replace the IP address by your IP address:
scp ca.crt client.crt client.key openvpn.ovpn pi@192.168.18.96:openvpn
In case, you get an error message that looks like the below, than this is nothing bad, but the security of your system is good. As an alternative you simply copy to your pi user home directory and from this directory into the /etc/openvpn directory. To copy to pi home directory you execute: scp ca.crt client.crt client.key openvpn.ovpn pi@192.168.2.60:openvpn
scp: /etc/openvpn/ca.crt: Permission denied scp: /etc/openvpn/client.crt: Permission denied scp: /etc/openvpn/client.key: Permission denied scp: /etc/openvpn/openvpn.ovpn: Permission denied
Now, once you have place the files to /etc/openvpn, than lets move to the next steps.
Configure the OpenVPN Package
cd /etc/openvpn sudo nano /etc/openvpn/user.txt
Create a user file with the below content. Note: your username and password are not these that you use to login into the cyberghost website, but the one’s you created in step 1 “Cyberghost online account (Cyberghost website)”.
Simply type on the first line your “username” and on the second line your “password”. There is nothing else needed. The below “x” indicate the username and the below “z” indicate the password.
xxxxxxxxx zzzzzzzzz
Save your changes with ‘CTRL+O’ and leave the editor via ‘CTRL+X’
Now, next file. Open the file called openvpn.ovpn to inform about the above made configuration for username and password. This you do by:
sudo nano /etc/openvpn/openvpn.ovpn
Within this file you search for the line:
auth-user-pass
This line you adjust to before you do the second change (see below) at the bottom of the configuration file.
auth-user-pass /etc/openvpn/user.txt
and you will stay in this configuration file! At the bottom of /etc/openvpn/ you add these two lines:
up /etc/openvpn/update-resolv-conf down /etc/openvpn/update-resolv-conf
Hence, you made 3 changes to the /etc/openvpn file:
- 1st, you updated auth-user-pass by “/etc/openvpn/user.txt”
- 2nd and 3rd, you added to the bottom of the file the two above lines with up / down
Once done, safe the file. In nano by ‘CTRL+O’ and leave the editor with ‘CTRL+X’.
Next, enable auto loading of the VPN. Type the below two comments:
sudo cp /etc/openvpn/openvpn.ovpn /etc/openvpn/openvpn.conf sudo nano /etc/default/openvpn
Within this file /etc/default/openvpn you add:
AUTOSTART="openvpn"
Autostart
Final step. Lets ensure Cyberghost VPN starts automatically as a service. First, check your configuration:
cat /etc/resolv.conf
The last line should consist of “nameserver” and the IP of the your router. If that’s not the case, than you fix it so that the last line consists of the “nameserver” of your router. Eg. nameserver 192.168.191.1
Finally, start openvpn to connect to Cyberghost:
sudo service openvpn start
Check if the service is running. To do so enter:
sudo service openvpn status
If it is running, this should look like this:
sudo service openvpn status ● openvpn.service - OpenVPN service Loaded: loaded (/lib/systemd/system/openvpn.service; enabled; vendor preset: enabled) Active: active (exited) since Sun 2023-12-03 09:56:06 ; 1h ago Process: 9188 ExecStart=/bin/true (code=exited, status=0/SUCCESS) Main PID: 9188 (code=exited, status=0/SUCCESS) CPU: 5ms
Test the configuration
To test, we install a command line web browser called Lynx. To do so enter:
sudo apt-get install lynx
Once installed, lets check if we are truly connected via Cyberghost. Enter:
Lynx https://dnsleaktest.com/
Which way ever you test (standard or extended), it obviously should tell you different IP addresses than the one’s in which your really are. Btw. i suggest to restart the Raspberry and try again. This way, you ensure that it is also working after restart.
Additional Information
- Official OpenHAB Website
- Official Cyberghost Website
- Official Wikipedia Entry about Cyberghost (in French)
- List of countries VPNs are allowed / disallowed by Cyberghost (NOTE: You still need to double check with your authorities)
It would be amazing if you follow my myhowto.blog. To my blog is actually easy! You can leverage on
- Click to follow me on Twitter
- Bookmark this page and comeback from time to time
I am really looking forward for you to contact me if for example you found a better option or other idea then in this how to. Also, please touch base if you found an error or anything not working or if you have something that you would love to be added to the myhowto.blog. Simply click this link to touch base with me.
Linking Or Recommending The How To Or The myhowto.blog
I would love to see you are recommending this how to or link it to your website. Also, I would love if you link or recommend the whole myhowto.blog. Please feel free to do so! In case you like to touch base regarding this topic with me, then simply click this link. I look forward!