Sub topic 2
Confidentiality, Integrity and Authentication
Assume you know basic IP addressing, routing tables, TCP, UDP, and Linux commands.
Confidentiality, integrity and authentication
A tunnel only changes how packets travel. A VPN also protects the packets.
- Confidentiality uses encryption so an observer cannot read the contents.
- Integrity uses an authentication tag to show that the packet was not changed.
- Authentication proves which peer sent the packet.
Encryption alone does not prove who created a message. A VPN normally provides all three properties.
How peers agree on keys
Peers should not send a reusable encryption key across the network. Instead, they authenticate each other with a pre-shared key, certificates, or public keys, then use a key-exchange protocol such as Diffie–Hellman to derive temporary session keys.
The exchanged public values do not reveal the resulting secret when the exchange is implemented correctly. Peers periodically replace session keys to limit the effect of a compromised key.
IPsec: ESP, IKE and the two modes
IPsec protects IP traffic. IKE negotiates peers, algorithms, and keys. ESP carries the protected packets and supplies encryption, integrity, and authentication.
- Tunnel mode wraps the complete original IP packet inside a new IP packet. It is common between gateways.
- Transport mode protects the payload of an IP packet while retaining the original IP header. It is useful between hosts.
Tunnels through NAT
Network address translation (NAT) changes addresses and often tracks UDP or TCP ports. It can disrupt protocols that carry addresses in packet headers or use a separate protocol number. IPsec commonly uses NAT traversal, wrapping ESP inside UDP, usually on port 4500. Keepalives maintain the NAT mapping.
TLS-based VPNs
A TLS-based VPN uses the same family of protocols as HTTPS to authenticate peers and protect a reliable connection, often TCP or UDP. OpenVPN is a common example. It works well through many firewalls, but TCP-over-TCP can perform poorly when the VPN carries TCP traffic.
WireGuard: a minimal modern VPN
WireGuard uses UDP, fixed modern cryptography, and a public-key identity for each peer. Its configuration is small:
[Interface]
PrivateKey = <client-private-key>
Address = 10.8.0.2/24
[Peer]
PublicKey = <server-public-key>
Endpoint = vpn.example.com:51820
AllowedIPs = 10.8.0.0/24
PersistentKeepalive = 25AllowedIPs selects traffic for the peer. Here it creates a split tunnel. PersistentKeepalive can preserve a NAT mapping for a client behind NAT.
Exercise
Does GRE by itself provide confidentiality, integrity, and peer authentication?
Show answer
No. GRE provides encapsulation. It needs a separate security protocol, such as IPsec, for those protections.