Stunnel + OpenVPN Client on Ubuntu
Connect your OpenVPN through Stunnel on Ubuntu
Pre-requisites
This article assumes already have Stunnel and OpenVPN server installed somewhere. If not, you can read how I setup my Stunnel and OpenVPN on Ubuntu 16.04 or if you are looking to setup OpenVPN on Ubuntu 18.04.
Install OpenVPN and Stunnel
Install both the openvpn and stunnel clients on Ubuntu. I tried this and it works for both 16.04 and 18.04, but for 18.04, I’ve made some slight tweaks, have a look at the different version of the config file.
$ sudo apt-get install openvpn
$ sudo apt-get install stunnel
Configure Stunnel
Once stunnel is installed, lets start to configure the stunnel client.
First, before we start, make sure you have your pem key file that you generated from the Server. If not, please generate the PEM file. Copy the PEM file to /etc/stunnel/your-key.pem
.
Open /etc/stunnel/stunnel.conf
edit the file such that it looks like the following. Change the bolded text accordingly to what you have. Important things are the accept
, connect
and cert
parameters. Details o
accept
: Port number at which your openvpn will communicate through.