SECURITY ENGINEERING · PART 2 · NETWORKING FOR SECURITY · DEFENSE · 32 OF 229

VPN vs ZTNA: IPsec, WireGuard, Zero Trust Access

How people and offices reach private systems safely: what a VPN tunnel is, IPsec, OpenVPN and WireGuard, site-to-site and remote-access VPNs, why a VPN that grants the whole network is a gift to attackers, and zero-trust network access, which checks the user and device on every request and grants one application at a time.

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 9
  9. 10
  10. 11
  11. 12
  12. 13
  13. 14
  14. 15
  15. 16
  16. 17
  17. 18
  18. 19
  19. 20
  20. 21
  21. 22
  22. 23
  23. 24
  24. 25
  25. 26
  26. 27
  27. 28
  28. 29
  29. 30
  30. 31
  31. 32
  32. 33
  33. 34
  34. 35
  35. 36
  36. 37
  37. 38
  38. 39
  39. 40
  40. 41
  41. 42
  42. 43
  43. 44
  44. 45
  45. 46
  46. 47
  47. 48
  48. 49
  49. 50
  50. 51
  51. 52
  52. 53
  53. 54
  54. 55
  55. 56
  56. 57
  57. 58
  58. 59
  59. 60
  60. 61
  61. 62
  62. 63
  63. 64
  64. 106
  65. 107
  66. 108
  67. 109
  68. 110
  69. 111
  70. 112
  71. 113
  72. 114
  73. 115
  74. 116
  75. 117
  76. 118
  77. 119
  78. 120
  79. 121
  80. 122
  81. 123
  82. 124
  83. 125
  84. 126
  85. 127
  86. 128
  87. 129
  88. 130
  89. 131
  90. 132
  91. 133
  92. 134
  93. 135
  94. 136
  95. 137
  96. 138
  97. 139
  98. 140
  99. 141
  100. 142
  101. 143
  102. 144
1 / 12

Press play to hear the narration, or step through at your own pace.

Key takeaways

  • Tunnels: IPsec, OpenVPN, WireGuard
  • a VPN trusts once and grants a network
  • ZTNA checks every request and grants one app

Notes

What a VPN is

A virtual private network builds an encrypted tunnel between a device and a gateway at the edge of the private network. Once the device has authenticated, its traffic for internal systems travels inside that tunnel, and it receives an internal address as if it were plugged in at the office. Anyone on the local Wi-Fi sees only encrypted packets going to one address. That is the protection against the sniffing and man in the middle attacks from earlier episodes.

Virtual private network
  • the device authenticates to a gateway
  • they build an encrypted tunnel
  • packets for the private network travel inside it
  • the device gets an internal address
  • the local Wi-Fi sees only encrypted traffic to one address

The protocols

You will meet three protocols. IPsec is the long-standing standard, used for links between sites and built into every operating system, but famously complicated. OpenVPN is built on TLS, flexible, and runs anywhere. WireGuard is the modern one: a very small codebase, fast, with fixed modern cryptography and simple key pairs, which leaves little room to misconfigure it. Old protocols like PPTP are broken and should be gone.

IPsec, OpenVPN, WireGuard
  • IPsec (with IKEv2): the old standard. Site-to-site links, built into every OS, complex to configure
  • OpenVPN: TLS-based, flexible, runs anywhere, slower
  • WireGuard: small, fast, modern crypto, simple keys
  • avoid PPTP and L2TP without IPsec: broken

Two shapes

VPNs come in two shapes. Remote access connects one device, an employee's laptop, to the network. Site-to-site joins two whole networks through their gateways, such as an office and a cloud environment. There is also a choice about what goes through the tunnel. In a full tunnel all the device's traffic does, which lets the company inspect it. In a split tunnel only company traffic does, which is faster but leaves the rest unprotected and unseen.

Remote access vs site-to-site
  • remote access: one device joins the network (employees, contractors)
  • site-to-site: two networks joined by gateways (office to cloud, office to office)
  • split tunnel: only company traffic uses the VPN
  • full tunnel: all traffic does

The flaw

Here is the flaw. A traditional VPN checks you once at the door and then places your device on the internal network, often with reach to everything. So a phished password with no second factor is a seat inside the company. An infected laptop brings its infection in with it. And the gateway itself sits on the internet, where unpatched VPN appliances have been one of the most common entry points for ransomware groups in recent years.

Why attackers love VPNs
  • one login = a place on the internal network
  • a phished password without MFA is enough
  • a malware-infected laptop brings the malware inside
  • the gateway itself is exposed to the internet and must be patched fast
  • VPN flaws are a top way in for ransomware groups

A safer VPN

If you run a VPN, some settings are not optional. Multi-factor login for every connection. Patching the gateway within days of a fix, because attackers scan for vulnerable ones within hours. Allowing only managed devices, proven with a device certificate. Limiting what the VPN zone can reach to the applications each group needs, using the segmentation from the last episode. And logging every connection, with alerts on new countries and odd hours.

Hardening a VPN
  • MFA on every login
  • patch the gateway within days of a fix
  • managed devices only: check a device certificate
  • the VPN zone reaches only the apps each group needs
  • log connections; alert on new countries and odd hours
  • remove accounts when people leave

Zero-trust access

Zero-trust network access removes the flaw by removing the network access. The user never joins the internal network. An access proxy sits in front of each application and checks every request: who is the user, is their multi-factor login recent, is the device managed and healthy, and are they allowed this particular application? Access is granted to one application at a time. Applications are invisible until you authenticate, so there is nothing to scan.

ZTNA
  • the user never joins the network
  • an access proxy sits in front of each application
  • every request is checked: who is the user, is MFA fresh, is the device healthy, is this app allowed?
  • grants one app, not a network
  • apps are invisible until you authenticate

Side by side

Put them side by side. A VPN trusts once at the door; zero trust checks on every request. A VPN grants a network; zero trust grants one application. A VPN rarely looks at the device again; zero trust makes device health part of every decision. So a stolen login is worth the whole network in one model, and one application in the other, and only if the attacker also has a healthy managed device. The logs are richer too: per request, not per connection.

VPN vs ZTNA
  • trust: once at the door / on every request
  • access: a network / one app
  • device health: rarely checked / part of every decision
  • stolen login: the network / one app, if the device also passes
  • visibility: connection logs / per-request logs

In practice

In practice this is delivered by products such as Cloudflare Access, Zscaler Private Access, Tailscale and others, following a model Google published as BeyondCorp. It depends on two foundations: single sign-on with multi-factor login, and managed devices, both covered in Part twelve. Teams usually move web applications first, then SSH and databases, and keep a small, tightly restricted VPN for the few legacy systems that cannot be put behind a proxy.

Getting there
  • products: Cloudflare Access, Zscaler Private Access, Google BeyondCorp, Tailscale, Twingate, Entra Private Access
  • needs: SSO with MFA and managed devices first
  • move web apps first; SSH and databases next
  • the VPN often stays for a few legacy systems

Common mistakes

Mistakes. A VPN without multi-factor login. A VPN appliance left unpatched for months while exploits circulate. VPN users able to reach the entire internal network. Personal, unmanaged devices allowed in. Shared VPN accounts, so nobody knows who connected. Relabelling an ordinary VPN as zero trust in a slide deck. And the accounts of former employees and contractors that still work.

Avoid these
  • VPN without MFA
  • unpatched VPN appliance
  • VPN users can reach the whole network
  • personal devices allowed in
  • shared VPN accounts
  • calling a VPN "zero trust"
  • accounts of former staff still active

Say it like this

In the interview: a VPN authenticates once and places the device on the internal network, so a stolen credential or an infected laptop gets broad reach, and the gateway itself is an exposed target. Zero-trust network access checks the user, their multi-factor login and the device's health on every request, and grants access to a single application. Where a VPN has to remain, I require MFA and managed devices, patch the gateway quickly and segment what it can reach.

In the interview
  • "A VPN authenticates once and puts the device on the network, so a stolen login or infected laptop gets broad
  • reach. ZTNA checks user, MFA and device health on every request and grants a single
  • app. Where a VPN remains, I
  • add MFA, patching and segmentation."

Interview questions

Q1What is a VPN?

A virtual private network creates an encrypted tunnel between a device (or a network) and a gateway, so traffic to private systems is protected in transit and the device is treated as part of the private network.

Q2What are the differences between IPsec, OpenVPN and WireGuard?

IPsec is the long-standing standard, common for site-to-site links and built into operating systems, but complex. OpenVPN is TLS-based, flexible and portable. WireGuard is newer, with a small codebase, fixed modern cryptography and simple key-based configuration, and is generally faster.

Q3What is the difference between a remote-access and a site-to-site VPN?

A remote-access VPN connects an individual device to a network. A site-to-site VPN connects two networks through their gateways, for example an office to a cloud VPC, so hosts on each side communicate without their own VPN clients.

Q4What is split tunneling and what is the risk?

Only traffic for company networks goes through the VPN while other traffic goes directly to the internet. It improves performance, but internet traffic bypasses company inspection and a compromised device is connected to both the internet and the internal network at once.

Q5Why are traditional VPNs a security risk?

They authenticate once and then grant network-level access, often to far more than the user needs, so stolen credentials or an infected device gain broad reach. The internet-facing gateway is also a frequent target when left unpatched.

Q6What is zero-trust network access (ZTNA)?

An access model in which users never join the internal network. An identity-aware proxy evaluates each request for user identity, MFA, device posture and policy, and grants access to a specific application only, keeping applications hidden from unauthenticated users.

Q7How would you harden an existing VPN?

Require MFA, allow only managed devices using certificates, patch the gateway promptly, restrict VPN users to the applications they need through segmentation, log and alert on unusual connections, and remove accounts promptly when people leave.

Q8What does zero-trust access depend on?

A strong identity provider with single sign-on and MFA, device management that reports posture, and an access proxy or broker in front of applications. Without reliable identity and device signals the per-request decisions have nothing to rely on.