Stunnel
Encapsulate VPN connections with plain TLS to workaround firewall restrictions.
The problem
Error when using OpenVPN with UDP protocol
OpenVPN 2.4.4 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on Sep 5 2018
library versions: OpenSSL 1.1.0g 2 Nov 2017, LZO 2.08
Outgoing Control Channel Authentication: Using 256 bit message hash 'SHA256' for HMAC authentication
Incoming Control Channel Authentication: Using 256 bit message hash 'SHA256' for HMAC authentication
TCP/UDP: Preserving recently used remote address: [AF_INET]X.X.X.X:1194
Socket Buffers: R=[212992->212992] S=[212992->212992]
UDP link local: (not bound)
UDP link remote: [AF_INET]X.X.X.X:1194
NOTE: UID/GID downgrade will be delayed because of --client, --pull, or --up-delay
TLS Error: Unroutable control packet received from [AF_INET]X.X.X.X:1194 (si=3 op=P_ACK_V1)Error when using OpenVPN with TCP protocol
OpenVPN 2.4.4 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on Sep 5 2018
library versions: OpenSSL 1.1.0g 2 Nov 2017, LZO 2.08
Outgoing Control Channel Authentication: Using 256 bit message hash 'SHA256' for HMAC authentication
Incoming Control Channel Authentication: Using 256 bit message hash 'SHA256' for HMAC authentication
TCP/UDP: Preserving recently used remote address: [AF_INET]X.X.X.X:1294
Socket Buffers: R=[87380->87380] S=[16384->16384]
Attempting to establish TCP connection with [AF_INET]X.X.X.X:1294 [nonblock]
TCP connection established with [AF_INET]X.X.X.X:1294
TCP_CLIENT link local: (not bound)
TCP_CLIENT link remote: [AF_INET]X.X.X.X:1294
NOTE: UID/GID downgrade will be delayed because of --client, --pull, or --up-delay
TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
TLS Error: TLS handshake failed
Fatal TLS error (check_tls_errors_co), restarting
SIGUSR1[soft,tls-error] received, process restarting
Restart pause, 5 second(s)The solution
Setup server
Install Stunnel4
Create Openssl key
Config Stunnel
Redirect connections to OpenVPN
Config iptables
Enable Stunnel to start on boot by default
Restart Stunnel
Check Stunnel
Setup client
Install Stunnel
Create Openssl key
Config Stunnel
Redirect connections to Stunnel server
Enable Stunnel to start on boot by default
Restart Stunnel
Config OpenVPN
Test
Last updated