OpenVPN, Split Tunnelling and VPN Hardening
OpenVPN is the third common VPN family: a user-space VPN that carries IP packets over its own protocol protected by TLS, on UDP (default port 1194) or TCP (often 443, so it passes restrictive networks). It is flexible, widely deployed and has decades of configuration options, which makes it a frequent subject of reviews. This lesson reviews an OpenVPN server configuration, then treats two questions that apply to every VPN: what traffic goes through the tunnel (split versus full tunnelling) and how to harden the remote-access service as a whole.
Reviewing an OpenVPN server
The lab company's old remote-access server (server.conf, as exported):
port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key
dh dh1024.pem
server 10.10.210.0 255.255.255.0
push "route 10.10.0.0 255.255.0.0"
push "dhcp-option DNS 10.10.2.53"
cipher BF-CBC
auth SHA1
tls-auth ta.key 0
duplicate-cn
client-to-client
keepalive 10 120
persist-key
persist-tun
verb 3The linter applies a short hardening baseline. OpenVPN 2.5 and later negotiate the data-channel cipher from data-ciphers (2.5 defaults to AES-256-GCM:AES-128-GCM; 2.6 adds CHACHA20-POLY1305 when the crypto library supports it), and in TLS mode cipher matters only for compatibility with old peers (2.6 has data-ciphers-fallback for that), but a config that still names Blowfish says a lot about its age.
CONF = """port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key
dh dh1024.pem
server 10.10.210.0 255.255.255.0
push "route 10.10.0.0 255.255.0.0"
push "dhcp-option DNS 10.10.2.53"
cipher BF-CBC
auth SHA1
tls-auth ta.key 0
duplicate-cn
client-to-client
keepalive 10 120
persist-key
persist-tun
verb 3
"""
opts = {}
for line in CONF.splitlines():
parts = line.split(None, 1)
opts.setdefault(parts[0], []).append(parts[1] if len(parts) > 1 else "")
checks = [
("data-ciphers", lambda o: "data-ciphers" in o, "set `data-ciphers AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305`"),
("cipher", lambda o: not any("BF-" in c or "DES" in c for c in o.get("cipher", [])), "Blowfish/DES: 64-bit blocks (SWEET32)"),
("auth", lambda o: not any(a.upper() in ("SHA1", "MD5") for a in o.get("auth", [])), "HMAC with SHA-1/MD5: use SHA256 or GCM"),
("dh", lambda o: not any("1024" in d for d in o.get("dh", [])), "1024-bit DH: use ECDH (`dh none`) or 2048+"),
("tls-crypt", lambda o: "tls-crypt" in o or "tls-crypt-v2" in o, "tls-auth only authenticates the control channel; tls-crypt also encrypts it"),
("tls-version-min", lambda o: "tls-version-min" in o, "set `tls-version-min 1.2`"),
("duplicate-cn", lambda o: "duplicate-cn" not in o, "one certificate shared by many users: no per-user revocation"),
("client-to-client", lambda o: "client-to-client" not in o, "VPN clients can reach each other directly"),
("crl-verify", lambda o: "crl-verify" in o, "no revocation list: lost laptops keep access"),
("user/group", lambda o: "user" in o and "group" in o, "drop privileges: `user nobody`, `group nogroup`"),
("mfa", lambda o: any("plugin" in k or "auth-user-pass-verify" in k for k in o), "certificate only: add a second factor"),
]
fails = 0
for name, ok, advice in checks:
good = ok(opts)
fails += not good
print(f"{'ok ' if good else 'FAIL'} {name:16} {'' if good else advice}")
print(f"{fails} of {len(checks)} checks failed")FAIL data-ciphers set `data-ciphers AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305`
FAIL cipher Blowfish/DES: 64-bit blocks (SWEET32)
FAIL auth HMAC with SHA-1/MD5: use SHA256 or GCM
FAIL dh 1024-bit DH: use ECDH (`dh none`) or 2048+
FAIL tls-crypt tls-auth only authenticates the control channel; tls-crypt also encrypts it
FAIL tls-version-min set `tls-version-min 1.2`
FAIL duplicate-cn one certificate shared by many users: no per-user revocation
FAIL client-to-client VPN clients can reach each other directly
FAIL crl-verify no revocation list: lost laptops keep access
FAIL user/group drop privileges: `user nobody`, `group nogroup`
FAIL mfa certificate only: add a second factor
11 of 11 checks failed
Almost every line is a finding, and two of them are about identity rather than cryptography: duplicate-cn (everyone uses the same certificate, so you can't revoke one person) and the absence of a CRL and MFA. An attacker with one stolen laptop has a permanent, unattributable way in. A modern replacement keeps dev tun and the address pool, and adds data-ciphers AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305, tls-version-min 1.2, tls-crypt-v2 per client, dh none (ECDHE), remote-cert-tls client checks, crl-verify, privilege dropping, per-user certificates and an MFA plugin or SSO integration.
Split versus full tunnelling
The push "route 10.10.0.0 255.255.0.0" line makes this a split tunnel: only traffic to the company's networks enters the VPN; everything else (web browsing, video calls) goes directly to the Internet from wherever the laptop is. A full tunnel (redirect-gateway def1 in OpenVPN, AllowedIPs = 0.0.0.0/0, ::/0 in WireGuard) sends everything through the company.
import ipaddress
def path(dst, routes):
"""Longest-prefix match between the VPN routes and the local default route."""
best = ("local Internet", ipaddress.ip_network("0.0.0.0/0"))
for r in routes:
n = ipaddress.ip_network(r)
if ipaddress.ip_address(dst) in n and n.prefixlen >= best[1].prefixlen:
best = ("VPN", n)
return best[0]
split = ["10.10.0.0/16"]
full = ["0.0.0.0/1", "128.0.0.0/1"] # how redirect-gateway def1 overrides the default route
dests = {"10.10.2.30": "internal database", "203.0.113.80": "public website",
"192.168.1.1": "home router", "198.51.100.7": "malicious site"}
print(f"{'destination':14} {'what':18} {'split tunnel':15} full tunnel")
for d, what in dests.items():
print(f"{d:14} {what:18} {path(d, split):15} {path(d, full)}")destination what split tunnel full tunnel
10.10.2.30 internal database VPN VPN
203.0.113.80 public website local Internet VPN
192.168.1.1 home router local Internet VPN
198.51.100.7 malicious site local Internet VPN
| Split tunnel | Full tunnel | |
|---|---|---|
| Company sees and filters the user's Internet traffic | no | yes (proxy, DNS filtering, IDS) |
| Load on the VPN and the company's Internet link | low | high |
| Laptop talks to the home network and the internal network at the same time | yes: the laptop bridges a home network the company doesn't control | no (local LAN routes still need care: the 192.168.1.1 row shows the home router going through the VPN, which breaks local printing) |
| DNS | must be configured so internal names go to internal resolvers and nothing leaks | all through the company |
Neither is wrong. Split tunnelling with good endpoint protection (EDR, host firewall, a DNS filtering agent) is common and practical; full tunnelling gives central visibility. What is wrong is not deciding: a split tunnel where the laptop's host firewall is off on the home network makes the laptop a bridge between an infected smart TV and the company. Zero-trust access (Zero Trust) changes the question by putting each application behind its own enforcement point.
Hardening remote access as a whole
- Patch the VPN first. VPN concentrators and SSL-VPN appliances from several major vendors have had critical, actively exploited vulnerabilities in recent years; they are Internet-facing, powerful and often patched late. Subscribe to the vendor's advisories and the CISA KEV catalog.
- MFA for every user, phishing-resistant where possible; no legacy authentication paths that skip it.
- One identity per person and device: per-user certificates or SSO, revocation on loss, device posture checks if the product supports them.
- Treat VPN users as a zone: firewall rules on the VPN interface per group (admins reach the bastion, staff reach mail and files), not "VPN = inside".
- Log connections (who, from where, which address was assigned, how long) and alert on impossible travel, concurrent sessions and logins from unusual countries (Weak and Default Authentication for spraying detection).
- Timeouts: idle and maximum session lifetimes, re-authentication daily.
Pitfalls
- TCP-over-TCP (OpenVPN on TCP carrying TCP) collapses under packet loss; use UDP where the network allows.
client-to-clientturning the VPN into a flat network of home laptops.- Pushing routes that overlap common home networks (
192.168.1.0/24): users lose either their printer or the company resource. - A "temporary" second VPN for a vendor that never gets MFA.
Practice
1. Which two lines would you remove first from the old server.conf, and why?
duplicate-cn (shared identity, no per-user revocation) and client-to-client (lateral movement between users' laptops). Then fix the ciphers, DH and add tls-crypt, CRL checking and MFA.
2. A user on a split tunnel visits a malicious site. Which company controls still apply?
Only those on the laptop itself: EDR, host firewall, browser protections, a DNS-filtering agent if installed. The company proxy and network IDS don't see that traffic. With a full tunnel they would.
3. Add "192.168.1.0/24" to the full-tunnel routes in the program as a local exception. What would you need to change in path()?
The exception should go to "local LAN", not the VPN: give each route a target ([("0.0.0.0/1", "VPN"), ("128.0.0.0/1", "VPN"), ("192.168.1.0/24", "local LAN")]) and let the longest prefix win; the /24 beats the /1. That is how clients implement "allow local LAN access", which reintroduces a little of the bridging risk.
Test yourself
What does duplicate-cn allow in OpenVPN, and why is it a finding?
- Faster connections
- Many clients with the same certificate: no per-user identity or revocation
- IPv6
- Two servers
In a split tunnel, where does traffic to a public website go?
- Through the VPN
- Directly to the Internet from the user's network
- Nowhere
- To the DMZ
What does tls-crypt add over tls-auth?
- Data compression
- It also encrypts the control channel, hiding the TLS handshake and certificates
- Faster rekeying
- IPv6 support
Why are VPN appliances a priority for patching?
- They are cheap
- They are Internet-facing, powerful and frequently targeted with known vulnerabilities
- They have no logs
- They are rarely used