Use Stunnel as an HTTPS-proxy for your OpenVPN connection

Last Updated: 2025-01-02

How to install your OpenVPN server and set everything up to connect with a client I already explained. But if you want to tunnel your vpn-connection through an SSL-tunnel to make it look like you are connecting to an HTTPS-Server, follow these instructions - this might help if the described setup with obfsproxy does not work, because blocking all HTTPS-traffic would cripple the internet quite severely.

Installing stunnel4

The easiest way is to just install it via apt-get

$sudo apt-get install stunnel4

This creates a new user/group called stunnel4 so the stunnel-instance is able to run in its own user context. To be able to actually start stunnel, you have to enable it by setting the option in /etc/default/stunnel4 to:

ENABLED = 1

Configuring your stunnel server

The /etc/stunnel/stunnel.conf file should contain these lines:

chroot = /var/lib/stunnel4/
setuid = stunnel4
setgid = stunnel4
pid = /stunnel4.pid
debug = 7
output = /stunnel.log
cert = /etc/stunnel/server.crt
key = /etc/stunnel/server.key
verify = 3
CAfile = /etc/stunnel/ca.crt
options = NO_SSLv2
options = SINGLE_ECDH_USE
options = SINGLE_DH_USE
#your client connects to port 443 and your OpenVPN server is listening on port 1194
[OpenVPN]
accept = 443
connect = 127.0.0.1:1194

Start stunnel via sudo service stunnel4 start - now your server is ready for incoming connections.

Configure stunnel on your client

To configure your client to connect to your server, add the following lines to your /etc/stunnel/stunnel.conf file

chroot = /var/lib/stunnel4/
setuid = stunnel4
setgid = stunnel4
pid = /stunnel4.pid
debug = 7
output = /stunnel.log
cert = /etc/stunnel/client.crt
key = /etc/stunnel/client.key
verify = 3
CAfile = /etc/stunnel/ca.crt
options = NO_SSLv2
options = SINGLE_ECDH_USE
options = SINGLE_DH_USE
#your client connects to port 443 and your OpenVPN server is listening on port 1194
[OpenVPN]
client = yes
accept = 127.0.0.1:1994
connect = your.vpn.server:443

Configure your OpenVPN client

This is the easiest part, you have to change just one line in your /etc/openvpn/client.conf file to actually use stunnel

remote 127.0.0.1 1194

Now everything is set up, you should be able to connect to your OpenVPN server over an HTTPS-tunnel using stunnel4.

The route your traffic goes looks like this: Client --> OpenVPN-Client --> Stunnel4-Client --> Stunnel4-Server --> OpenVPN-Server --> Internet/LAN.

Rating 0.8 (28 votes)

94 Comments

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1
1

-1 OR 2+211-211-1=0+0+0+1: on 2025-02-10

1

mGZaLUfS'": on 2025-02-10

1
1

@@i3h9N: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

1

mGZaLUfS: on 2025-02-10

-1 OR 2+873-873-1=0+0+0+1 --

mGZaLUfS: on 2025-02-10

-1 OR 2+721-721-1=0+0+0+1

mGZaLUfS: on 2025-02-10

-1' OR 2+55-55-1=0+0+0+1 --

mGZaLUfS: on 2025-02-10

-1' OR 2+178-178-1=0+0+0+1 or 'eGgxIHza'='

mGZaLUfS: on 2025-02-10

-1" OR 2+674-674-1=0+0+0+1 --

mGZaLUfS: on 2025-02-10

1*if(now()=sysdate(),sleep(15),0)

mGZaLUfS: on 2025-02-10

10'XOR(1*if(now()=sysdate(),sleep(15),0))XOR'Z

mGZaLUfS: on 2025-02-10

10"XOR(1*if(now()=sysdate(),sleep(15),0))XOR"Z

mGZaLUfS: on 2025-02-10

(select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/

mGZaLUfS: on 2025-02-10

1-1; waitfor delay '0:0:15' --

mGZaLUfS: on 2025-02-10

1-1); waitfor delay '0:0:15' --

mGZaLUfS: on 2025-02-10

1-1 waitfor delay '0:0:15' --

mGZaLUfS: on 2025-02-10

1fzTxMyFj'; waitfor delay '0:0:15' --

mGZaLUfS: on 2025-02-10

1-1 OR 754=(SELECT 754 FROM PG_SLEEP(15))--

mGZaLUfS: on 2025-02-10

1-1) OR 699=(SELECT 699 FROM PG_SLEEP(15))--

mGZaLUfS: on 2025-02-10

1-1)) OR 100=(SELECT 100 FROM PG_SLEEP(15))--

mGZaLUfS: on 2025-02-10

1gVmMehtY' OR 373=(SELECT 373 FROM PG_SLEEP(15))--

mGZaLUfS: on 2025-02-10

1lGZBDxqZ') OR 203=(SELECT 203 FROM PG_SLEEP(15))--

mGZaLUfS: on 2025-02-10

106lfkcuK')) OR 994=(SELECT 994 FROM PG_SLEEP(15))--

mGZaLUfS: on 2025-02-10

1*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)

mGZaLUfS: on 2025-02-10

1'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'

mGZaLUfS: on 2025-02-10

1'"

mGZaLUfS: on 2025-02-10

1????%2527%2522'"

mGZaLUfS: on 2025-02-10

@@AbEDm

Add a comment:

*Required fields