pk.org: Computer Security/Lecture Notes

Secure Communication -- VPNs

Study Guide

Paul Krzyzanowski – 2026-11-15

The protocols that move data across the Internet do not authenticate the sender, check the data, or hide its contents. Cryptography lets the endpoints protect the data themselves: assume the network is hostile and encrypt and authenticate everything that crosses it. TLS applies this to a single application’s connection. A VPN applies it to all traffic between networks.

What TLS Provides

TLS creates a secure channel between two applications. It provides authentication, confidentiality, and integrity. The handshake proves that the server holds the private key for its certificate. The data is protected with authenticated encryption, which encrypts and authenticates in one operation.

Client certificates are rarely used. Services instead authenticate the user after the channel is up, with a password or a one-time code, and TLS protects those credentials from eavesdropping.

TLS stops at the application boundary. Each application must choose to use it, and it protects only the one connection between two programs. A valid certificate proves the server’s identity but does not make the server trustworthy.

Tunneling

Tunneling carries the packets of one network inside the packets of another, so two networks behave as if a direct link joined them. The mechanism is encapsulation: an entire IP datagram, with its private source and destination addresses, becomes the payload of an outer packet addressed from one gateway to the other. The communicating computers do not see the encapsulation. A plain tunnel provides connectivity but not security: the inner packet travels in cleartext, the endpoints are not authenticated, and the contents can be modified.

What Makes a Tunnel a VPN

A VPN adds three protections to a tunnel: encryption of the inner packet, integrity protection so modified packets are detected and discarded, and authentication of the endpoints. Encryption covers the inner packet, its addresses included, but the outer header stays readable because routers need it. An observer between the gateways still sees the gateways’ addresses, when packets flow, and how large they are.

Deployment Models

The three arrangements differ in what sits at each end of the tunnel:

Full and Split Tunneling

With full tunneling, all of a device’s traffic goes through the VPN, so the organization can apply its policies to everything, at the price of slower browsing. With split tunneling, only corporate traffic uses the tunnel, and other traffic bypasses the corporate gateway’s controls. The device is then on two networks at once, and a device compromised through its local connection can be used to reach corporate resources over its tunnel. Many organizations disable split tunneling for this reason.

IPsec

IPsec protects IP traffic at the network layer and is implemented in the operating system kernel. An IPsec header sits where a TCP or UDP header would, directly above IP, so IPsec can protect any higher-layer protocol without the applications knowing.

IPsec defines two protocols. The Authentication Header (AH) provides integrity and authentication without encryption and survives only for historical reasons. The Encapsulating Security Payload (ESP) authenticates and encrypts the payload, and it is the standard choice.

Tunnel mode encapsulates the entire original packet between two gateways. This is how site-to-site and remote access VPNs work. Transport mode keeps the original IP header and protects the payload between two hosts. Transport mode resembles TLS but differs from it: it protects all traffic between the machines, whatever the protocol, and the applications do not have to do anything.

IKE sets up an IPsec connection. It authenticates the peers with certificates or a pre-shared key, negotiates algorithms, and establishes session keys with a Diffie-Hellman exchange, which provides forward secrecy. IPsec’s strengths are broad support, kernel efficiency, and transparency to applications. Its weaknesses are the complexity of the standard and the fact that ESP is neither TCP nor UDP, so address translation devices and restrictive firewalls can block it.

OpenVPN

OpenVPN runs in user space and builds its security on TLS. The operating system hands it traffic through a virtual network interface, and the OpenVPN process encrypts that traffic and sends it to the peer. The control channel uses TLS for authentication and key exchange, which reuses certificates, certificate authorities, and mature TLS libraries. The data channel carries the tunneled traffic under symmetric encryption with keys from the handshake. Users authenticate with certificates or with a password over the encrypted channel.

OpenVPN prefers UDP as its outer transport: the tunnel already carries TCP connections, and TCP inside TCP can retransmit at both layers when packets are lost. TCP on the HTTPS port is the fallback for restrictive networks. OpenVPN is portable and auditable, but running in user space makes it slower than kernel implementations.

TLS-Based Enterprise VPNs

The dominant corporate remote access products also tunnel traffic inside TLS, using proprietary protocols with the same design as OpenVPN. Their appeal is manageability: the gateway ties into corporate authentication with a password, a second factor, and checks on the connecting device. The Rutgers VPN is one of these products.

WireGuard

WireGuard was designed for simplicity, modern cryptography, and speed. The implementation is small, the protocol has been formally analyzed, and it runs in the kernel. It supports exactly one set of cryptographic algorithms. With nothing to negotiate, an attacker cannot force a downgrade to weaker cryptography. A broken algorithm would be replaced by versioning the protocol.

A peer’s identity is its public key, and there are no certificates. Keys must be distributed outside the protocol, which is simple for a few machines but needs infrastructure at scale. Commercial mesh services provide that infrastructure. WireGuard’s handshake is a fresh key exchange, which provides forward secrecy, and frequent rekeying limits what a captured key exposes. It runs over UDP and does not keep connection state, so a device that changes networks resumes its tunnel without reconnecting.

What a VPN Does Not Protect

A VPN secures the path between its endpoints, and the guarantee stops there:

What You Don’t Need to Study

The following are not required for the exam:


Terms we covered