Tutorial 4.11: IPsec Architecture and Security Services

πŸ“‘ Table of Contents

🎯 Learning Objectives

After completing this tutorial, you should be able to:


πŸ“– Overview

In Tutorial 4.10, we introduced internet security protocols and the architectural choices for securing communications. Among these, IPsec (Internet Protocol Security) stands out as the most comprehensive protocol suite for securing IP communications at the network layer. IPsec provides authentication, confidentiality, integrity, and anti-replay protection for IP packets, making it an essential technology for virtual private networks (VPNs), secure site-to-site connections, and host-to-host communications.

This tutorial provides a deep dive into the architecture of IPsec. We begin by introducing the IPsec protocol suite and its components. We then examine the core concept of the Security Association (SA)β€”the contract that defines the security parameters for a communication. We explore the two critical databases that drive IPsec processing: the Security Policy Database (SPD), which determines what traffic to protect, and the Security Association Database (SAD), which stores the active SAs.

We discuss the two operational modes of IPsecβ€”transport and tunnelβ€”and when each is used. We provide an overview of the two main IPsec protocols: Authentication Header (AH) and Encapsulating Security Payload (ESP), covering their services and packet formats (with detailed coverage in the next tutorial). We also introduce the Internet Key Exchange (IKE) protocol, which manages key exchange and SA negotiation, describing its phases and key establishment.

We then examine the security services provided by IPsec, including confidentiality, integrity, authentication, and anti-replay. We discuss the role of IPsec in VPNs, both site-to-site and remote access, and the challenges of deployment, such as NAT traversal, performance, and interoperability. Finally, real-world case studies illustrate the successful deployment and common pitfalls of IPsec.

This tutorial sets the foundation for Tutorials 4.12 and 4.13, which will cover AH and ESP in detail and then focus on VPNs and secure remote access. The content aligns with Stallings & Brown (2024), Chapter 16 and IETF RFCs 4301–4309 (IPsec architecture and protocols).

1. Introduction to IPsec

1.1 What is IPsec?

Internet Protocol Security (IPsec) is a suite of open standard protocols developed by the IETF to provide security at the IP layer. It enables authentication, integrity, and confidentiality for IP packets, ensuring that communications remain private and trustworthy even over untrusted networks like the Internet.

1.2 IPsec Components

The IPsec suite consists of several components:

1.3 IPsec in the OSI Model

IPsec operates at the network layer (Layer 3), providing security for all IP traffic without requiring changes to applications or upper-layer protocols. This makes it transparent to the end-user and capable of protecting any IP-based communication, including TCP, UDP, ICMP, and routing protocols.

Key Takeaway: IPsec is a network-layer security suite that protects IP traffic by providing authentication, integrity, and confidentiality, transparent to applications.

2. IPsec Architecture and Components

The IPsec architecture is defined in RFC 4301 and includes several key components that work together to secure communications. Below is a high-level diagram of the IPsec architecture.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ IPsec Architecture β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Security Policy Database (SPD) β”‚ β”‚ β”‚ β”‚ - Determines which traffic to protect β”‚ β”‚ β”‚ β”‚ - Maps traffic to Security Associations (SAs) β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”‚ β–Ό β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ IPsec Processing Engine β”‚ β”‚ β”‚ β”‚ - Inbound/outbound packet processing β”‚ β”‚ β”‚ β”‚ - Uses SAD for active SAs β”‚ β”‚ β”‚ β”‚ - Applies AH or ESP headers β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”‚ β–Ό β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Security Association Database (SAD) β”‚ β”‚ β”‚ β”‚ - Stores active SAs β”‚ β”‚ β”‚ β”‚ - Keyed by (SPI, dest IP, protocol) β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”‚ β–Ό β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ IKE (Key Management) β”‚ β”‚ β”‚ β”‚ - Establishes SAs β”‚ β”‚ β”‚ β”‚ - Authenticates peers β”‚ β”‚ β”‚ β”‚ - Exchanges keys β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Figure 1: IPsec Architecture Overview

2.1 Key Components

Key Takeaway: The IPsec architecture is built around policies (SPD) and active security associations (SAD), with IKE managing the establishment of those associations.

3. Security Associations (SA)

3.1 Definition

A Security Association (SA) is a simplex (one-way) logical connection between two IPsec peers that provides security services for the traffic flowing in one direction. For two-way communication, two SAs are required (one for each direction). An SA is uniquely identified by a tuple: (Security Parameters Index – SPI, Destination IP Address, Protocol – AH or ESP).

3.2 SA Parameters

Each SA contains the following parameters:

3.3 SA Establishment

SAs are established either manually (by configuration) or dynamically via IKE. Manual configuration is rarely used in practice due to scalability and security challenges. IKE automates the process and provides secure key exchange.

3.4 SA Bundles

An SA bundle is a set of SAs that provide protection for a packet. For example, a packet may be protected by an ESP SA for confidentiality and an AH SA for authentication. More commonly, ESP with authentication (combined mode) provides both services in a single SA.

Key Takeaway: SAs are the fundamental building blocks of IPsec, defining the security parameters for a single direction of communication.

4. Security Policy Database (SPD)

4.1 Purpose

The Security Policy Database (SPD) is used to determine what security services are to be applied to outgoing packets and what policies are enforced on incoming packets. It contains entries that map traffic selectors (such as source/destination IP, ports, and protocols) to a specific action: PROTECT (apply IPsec), BYPASS (no IPsec), or DISCARD (drop the packet).

4.2 SPD Entries

Each SPD entry includes:

4.3 SPD Processing (Outbound)

When an outgoing packet is processed:

  1. The SPD is consulted to find a matching policy.
  2. If the policy is PROTECT, the packet is processed by IPsec (using the specified SA).
  3. If BYPASS, the packet is sent without IPsec.
  4. If DISCARD, the packet is dropped.

4.4 SPD Example

SPD Entry 1: Selector: src=10.0.0.0/24, dest=192.168.1.0/24, proto=TCP, ports=any Action: PROTECT SA: ESP with AES-256, SHA-256 SPD Entry 2: Selector: any, any, any Action: BYPASS (allow all other traffic)
Key Takeaway: The SPD defines the security policy, specifying which traffic is protected by IPsec and which is not.

5. Security Association Database (SAD)

5.1 Purpose

The Security Association Database (SAD) stores the active SAs. Each entry is keyed by the tuple (SPI, Destination IP, Protocol). The SAD is consulted during packet processing to retrieve the parameters needed to apply IPsec (encryption, integrity, etc.).

5.2 SAD Entry Contents

5.3 SAD Processing

Key Takeaway: The SAD stores the cryptographic parameters and state for each active SA, enabling efficient processing of IPsec traffic.

6. IPsec Modes: Transport vs. Tunnel

IPsec can operate in two modes, each with different use cases and packet formats.

6.1 Transport Mode

In transport mode, the IPsec header is inserted after the original IP header. This mode protects the payload (upper-layer data) but not the original IP header. It is used for host-to-host communications where the endpoints are the actual communicating hosts.

Transport Mode Packet Structure: Original IP Header | IPsec Header (AH/ESP) | Transport Header (TCP/UDP) | Payload

6.2 Tunnel Mode

In tunnel mode, a new IP header is prepended to the packet, and the entire original IP packet (including the original header) is encrypted and/or authenticated. This mode is used for gateway-to-gateway VPNs, where the IPsec peers are security gateways (e.g., firewalls) and the original packet's header is hidden from the Internet.

Tunnel Mode Packet Structure: New IP Header | IPsec Header (AH/ESP) | Original IP Header | Transport Header | Payload

6.3 Comparison

Feature Transport Mode Tunnel Mode
Original IP header protected? No Yes
Use case Host-to-host (e.g., secure management) Gateway-to-gateway, site-to-site VPN, remote access
Overhead Lower Higher (new IP header)
NAT Traversal Problematic (header protected) Better (new header can be NATed)

Table 1: Transport vs. Tunnel Mode

Key Takeaway: Transport mode protects only the payload and is used for host-to-host communications; tunnel mode protects the entire packet and is used for VPN gateways.

7. Authentication Header (AH) and Encapsulating Security Payload (ESP)

IPsec provides two protocols to deliver security services:

7.1 Authentication Header (AH)

7.2 Encapsulating Security Payload (ESP)

7.3 AH vs. ESP Comparison

Feature AH ESP
Confidentiality No Yes (encryption)
Integrity Yes Yes
Authentication Yes Yes
Anti-Replay Yes Yes
Protection of IP header Yes (selected fields) No (unless tunnel mode)

Table 2: AH vs. ESP

7.4 Combined Mode (ESP with Authentication)

In modern deployments, ESP is often used in a combined mode that includes authentication (using an AEAD algorithm like AES-GCM or a separate integrity algorithm like HMAC-SHA). This eliminates the need for a separate AH, simplifying configuration and reducing overhead.

Key Takeaway: AH provides integrity and authentication but no encryption; ESP provides confidentiality and can also provide integrity and authentication, making it the preferred choice in most deployments.

8. Internet Key Exchange (IKE) Overview

8.1 What is IKE?

Internet Key Exchange (IKE) is a protocol used to establish and manage Security Associations (SAs) in IPsec. It performs mutual authentication between peers and negotiates cryptographic keys and algorithms. IKE is defined in RFC 7296 (IKEv2) and is the standard key management protocol for IPsec.

8.2 IKE Phases (IKEv1 vs. IKEv2)

IKEv1 has two phases: Phase 1 (main mode or aggressive mode) establishes a secure channel and authenticates the peers, and Phase 2 (quick mode) negotiates IPsec SAs. IKEv2 simplifies the exchange into a single 2-request/2-response exchange (IKE_SA_INIT and IKE_AUTH) and supports additional features like EAP authentication.

8.3 IKEv2 Exchange

IKEv2 Initial Exchange (simplified): Initiator β†’ Responder: IKE_SA_INIT (offers cryptographic suites, DH keys) Responder β†’ Initiator: IKE_SA_INIT (accepts, sends DH public key) Initiator β†’ Responder: IKE_AUTH (authenticates, includes ID, certificate, and IPSec SA proposal) Responder β†’ Initiator: IKE_AUTH (authenticates, confirms IPSec SA)

Figure 2: IKEv2 Exchange Flow

8.4 Authentication Methods

8.5 IKE Security

Key Takeaway: IKE is the essential key management protocol for IPsec, enabling secure and automated SA establishment and key exchange.

9. Security Services Provided by IPsec

9.1 Confidentiality

Provided by ESP through encryption (e.g., AES-256). Ensures that the payload (and optionally the original IP header in tunnel mode) is not readable by unauthorized parties.

9.2 Integrity and Authentication

Provided by both AH and ESP (when authentication is enabled). Uses cryptographic hash functions (e.g., SHA-256) to compute a MAC (Message Authentication Code) to verify that the packet has not been altered and originates from a legitimate source.

9.3 Anti-Replay

IPsec uses sequence numbers and a sliding window to protect against replay attacks. Each packet gets a unique sequence number, and the receiver checks that the sequence number is within a window and has not been seen before.

9.4 Traffic Flow Confidentiality

In tunnel mode, IPsec can hide the original IP header, including source/destination addresses and ports, providing traffic flow confidentiality. This prevents attackers from analyzing traffic patterns.

9.5 Limitations

Key Takeaway: IPsec provides a comprehensive set of security services at the network layer, including confidentiality, integrity, authentication, and anti-replay, making it ideal for VPNs and secure communications.

10. IPsec VPNs: Site-to-Site and Remote Access

10.1 Site-to-Site VPN

A site-to-site VPN connects entire networks (e.g., branch office to headquarters) over the Internet. IPsec is deployed between two security gateways (firewalls or routers) that tunnel traffic on behalf of the internal hosts. Typically uses tunnel mode with ESP.

10.2 Remote Access VPN

A remote access VPN allows individual users (mobile workers) to connect securely to the corporate network. This can be implemented using IPsec with client software (IPsec client) or using SSL/TLS VPNs. IPsec remote access often uses IKEv2 with EAP authentication (username/password) and is supported natively on many operating systems.

10.3 Architecture Example

Site-to-Site IPsec VPN: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” IPsec Tunnel β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Branch β”‚ ◄══════════════════► β”‚ HQ β”‚ β”‚ Network β”‚ β”‚ Network β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ Gateway1 (IPsec) Gateway2 (IPsec) Remote Access VPN: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” IPsec Tunnel β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Remote β”‚ ◄══════════════════► β”‚ HQ β”‚ β”‚ User β”‚ β”‚ Network β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ (IPsec client) Gateway (IPsec)

Figure 3: IPsec VPN Deployments

10.4 IPsec VPN Best Practices

Key Takeaway: IPsec is the backbone of most enterprise VPNs, providing secure connectivity for site-to-site and remote access scenarios.

11. Challenges and Limitations of IPsec

11.1 NAT Traversal

IPsec, especially AH, has issues with Network Address Translation (NAT) because the IP header is protected. ESP in tunnel mode can work with NAT using NAT-T (NAT Traversal), which encapsulates IPsec packets in UDP port 4500. However, this adds overhead and complexity.

11.2 Performance Overhead

Encryption and integrity processing consume CPU resources, especially with heavy algorithms. Hardware acceleration (e.g., AES-NI) can mitigate this, but it remains a concern for high-throughput environments.

11.3 Complexity

IPsec configuration is notoriously complex, with many options for algorithms, modes, and authentication methods. Interoperability between different vendors can be challenging, especially when using IKEv1. IKEv2 improves interoperability but still requires careful configuration.

11.4 Key Management Scalability

Managing keys and certificates for a large number of IPsec peers (e.g., thousands of remote users) can be difficult. Using a PKI and automated certificate management can help but adds infrastructure.

11.5 Limitations with Multicast and Broadcast

IPsec does not natively support multicast or broadcast traffic. Special solutions (e.g., multicast VPN) are needed, but are not standard.

Key Takeaway: While powerful, IPsec has challenges with NAT, performance, configuration complexity, and scalability that must be addressed in deployments.

12. Real-World Case Studies

12.1 Case Study: IPsec Site-to-Site VPN Deployment

A multinational corporation deployed IPsec site-to-site VPNs to connect its headquarters and 15 branch offices using IKEv2 with certificate-based authentication. The deployment used AES-256 encryption and PFS. The company faced challenges with NAT traversal at some branch offices, which were resolved by enabling NAT-T. The VPN provided reliable, secure connectivity for internal applications and voice traffic.

12.2 Case Study: Remote Access VPN with IPsec

A financial services company implemented a remote access VPN using IPsec (IKEv2) with EAP (username/password) and certificates for device authentication. Employees could connect from personal devices using built-in OS support. The company integrated the VPN with their SIEM for monitoring and enforced multi-factor authentication (MFA) to mitigate credential theft.

12.3 Case Study: IPsec Misconfiguration Leads to Breach

A healthcare organization used IPsec VPN for remote access but used weak pre-shared keys and enabled insecure algorithms (DES, MD5). An attacker brute-forced the PSK and gained access to the internal network, leading to a data breach. The lesson: use strong keys and algorithms, and enforce certificate-based authentication where possible.

Key Takeaway: IPsec deployments require careful planning, strong security policies, and regular monitoring to be effective and secure.

πŸ“Œ Summary

This tutorial provided a comprehensive deep dive into the architecture of IPsec and its security services. We began by introducing IPsec as a network-layer security suite that provides authentication, integrity, confidentiality, and anti-replay for IP communications. We explored the key architectural components: the Security Association (SA), the Security Policy Database (SPD), and the Security Association Database (SAD). We discussed how these databases work together to enforce security policies and manage active SAs.

We explained the two modes of IPsecβ€”transport and tunnelβ€”and when each is appropriate. We provided an overview of the two main IPsec protocols: AH (integrity and authentication) and ESP (confidentiality plus optional integrity/authentication), with a comparison and the recommendation to use ESP with authentication (combined mode).

We introduced the Internet Key Exchange (IKE) protocol, covering its role in SA establishment, the phases of IKEv1 and the simplified IKEv2 exchange, and the authentication methods (PSK, certificates, EAP). We then reviewed the security services provided by IPsec, including traffic flow confidentiality in tunnel mode, and the limitations of the protocol.

We discussed the application of IPsec in VPNs, both site-to-site and remote access, and provided best practices. We also addressed the challenges of IPsec deployment, including NAT traversal, performance, and complexity. Real-world case studies illustrated successful deployments and common pitfalls.

This tutorial laid the groundwork for the next tutorial, which will delve into the specifics of the AH and ESP protocols, including packet formats and detailed processing. Understanding the architecture is essential for effective configuration and troubleshooting of IPsec-based security systems.

Next: Tutorial 4.12: IPsec Protocols: AH and ESP.

πŸ“ Quiz

1. What is the primary function of a Security Association (SA) in IPsec?

Answer
B. To define the security services and parameters for a one-way communication.

2. Which IPsec database is consulted to determine what traffic should be protected?

Answer
B. SPD (Security Policy Database).

3. In which IPsec mode is the entire original IP packet encapsulated within a new IP header?

Answer
B. Tunnel mode.

4. Which IPsec protocol provides confidentiality (encryption)?

Answer
B. ESP (Encapsulating Security Payload).

5. What is the role of IKE in IPsec?

Answer
C. To establish and manage Security Associations.

6. What does SPI stand for in IPsec and what is its purpose?

Answer
B. Security Parameters Index – used to identify an SA.

7. Which IPsec mode is typically used for site-to-site VPNs?

Answer
B. Tunnel mode.

8. Which authentication method is more scalable and secure for large IPsec deployments?

Answer
B. Digital certificates (X.509).

9. What is the purpose of the anti-replay feature in IPsec?

Answer
B. To prevent an attacker from re-sending captured packets.

10. Which IKE version simplified the exchange and improved NAT traversal support?

Answer
B. IKEv2.

11. In the IPsec SAD, what key uniquely identifies an SA?

Answer
B. SPI + Destination IP + protocol.

12. What is a common limitation of IPsec regarding NAT?

Answer
B. AH does not work well with NAT because it protects the IP header.

πŸ› οΈ Exercises

Exercise 1: SPD Design Intermediate

Design a Security Policy Database for a corporate network that wants to protect all traffic between its HQ network (192.168.1.0/24) and a branch network (10.0.0.0/24) using ESP with AES-256 encryption and SHA-256 integrity. Also, allow all other traffic to bypass IPsec. Write the SPD entries with selectors and actions.

Sample Solution

SPD Entries:

  • Entry 1: Selector: src=192.168.1.0/24, dest=10.0.0.0/24, proto=any, ports=any β†’ Action: PROTECT (SA: ESP with AES-256, SHA-256).
  • Entry 2: Selector: src=10.0.0.0/24, dest=192.168.1.0/24, proto=any, ports=any β†’ Action: PROTECT (SA: ESP with AES-256, SHA-256).
  • Entry 3: Selector: any, any, any β†’ Action: BYPASS (allow without IPsec).

Order: Place the specific entries before the generic BYPASS.

Exercise 2: SA Parameters Intermediate

List the typical parameters that would be included in a Security Association for ESP using AES-GCM with a 256-bit key and SHA-256 for integrity. Include the lifetime, sequence number handling, and SPI.

Sample Solution

SA Parameters:

  • Protocol: ESP
  • Encryption Algorithm: AES-256-GCM (Authenticated Encryption)
  • Integrity Algorithm: Integrated in GCM (or SHA-256 if separate).
  • Keys: 256-bit encryption key, 128-bit integrity key (for GCM).
  • SPI: A unique 32-bit value.
  • Lifetime: e.g., 8 hours or 100 GB of data.
  • Sequence Number: 32-bit counter, starting at 1.
  • Anti-Replay Window: Size 64 or 128.
  • Authentication Method: Certificate or PSK.

Exercise 3: Transport vs. Tunnel Introductory

Explain why tunnel mode is preferred over transport mode for site-to-site VPNs. Provide two reasons.

Sample Solution

Reasons:

  • In tunnel mode, the original IP header is encrypted and encapsulated, hiding the internal network topology and protecting source/destination addresses from eavesdroppers.
  • Tunnel mode allows the VPN gateway to terminate the IPsec tunnel on behalf of internal hosts, so internal hosts do not need to be IPsec-aware.

Exercise 4: IKEv2 Flow Advanced

Describe the IKEv2 exchange, including the messages (IKE_SA_INIT and IKE_AUTH) and the cryptographic purpose of each. Explain how mutual authentication is achieved.

Sample Solution

IKEv2 Exchange:

  • IKE_SA_INIT: Initiator sends a proposal of cryptographic suites and a Diffie-Hellman public key (key exchange). Responder replies with a selection and its own DH key. This establishes the IKE SA (secure channel) and negotiates encryption/integrity algorithms for the IKE SA.
  • IKE_AUTH: Initiator sends its identity, certificate (or PSK), and an IPSec SA proposal, all protected by the IKE SA. Responder authenticates the initiator, sends its own identity and certificate, and confirms the IPSec SA. Mutual authentication is achieved through certificates (or PSK).

The exchange results in the establishment of the IPSec SA (child SA) for protecting data traffic.

Exercise 5: IPsec Policy Analysis Intermediate

You are troubleshooting an IPsec VPN that is not working. The SPD indicates that traffic from 10.1.0.0/16 to 192.168.0.0/16 should be protected, but packets are being sent without IPsec. What could be the cause? List at least three possible reasons.

Sample Solution

Possible causes:

  • The SPD entry is not correctly configured (e.g., wrong subnet mask, protocol mismatch).
  • The SA has not been established (IKE negotiation failed due to authentication failure, algorithm mismatch, or network connectivity issues).
  • The SPD is being overridden by a more generic BYPASS policy that matches the traffic first (due to order).
  • The packet does not match the SPD selector because the source or destination IP is not as expected (e.g., NAT is changing the address).

πŸ“š Homework

Homework 1: Write a 2,000-word research paper comparing IKEv1 and IKEv2, covering the architectural differences, security improvements, and support for NAT traversal. Discuss why IKEv2 is preferred for modern IPsec deployments.

Sample Answer

Key points: IKEv1 has two phases (main/aggressive + quick), while IKEv2 has a single 2-message exchange. IKEv2 supports EAP, has better NAT traversal, built-in DoS protection, and simpler state machine. IKEv2 is more robust and is the recommended standard.

Homework 2: Set up a lab environment with two Linux VMs. Configure IPsec using strongSwan (IKEv2) with certificate-based authentication between the two hosts. Use transport mode for testing. Capture the packets with Wireshark and analyze the IKEv2 exchange and the ESP packets. Write a lab report.

Sample Answer

Practical assignment; report should include installation steps, certificate generation, configuration files, testing with ping, Wireshark capture analysis showing IKE_SA_INIT, IKE_AUTH, and ESP packets, and any troubleshooting.

Homework 3: Write a critical analysis of the security of IPsec. Discuss potential vulnerabilities (e.g., weak cipher suites, implementation bugs like Heartbleed, IKE vulnerabilities) and best practices to mitigate them. Include a discussion of post-quantum cryptography considerations.

Sample Answer

Key arguments: IPsec relies on cryptographic algorithms and IKE. Weak algorithms (DES, MD5) are insecure. Implementation bugs can compromise security. Best practices: use strong algorithms (AES-GCM, SHA-256, ECDH), disable weak options, use certificates, enforce PFS. Post-quantum: IPsec may need to migrate to quantum-resistant algorithms in the future.

Homework 4: Design an IPsec VPN architecture for a global enterprise with data centers in North America, Europe, and Asia, with multiple branch offices connecting to the nearest data center. Include redundancy, performance considerations, and key management. Provide a diagram and a detailed explanation.

Sample Answer

Design outline: Deploy IPsec gateways at each data center with active-active clustering for redundancy. Use IKEv2 with certificate-based authentication. Branch offices use site-to-site VPN to the nearest data center. Implement a hub-and-spoke with backup links. Use performance-optimized hardware with AES-NI acceleration. Use a centralized management platform for policy and certificate management.

Homework 5: Research a recent IPsec vulnerability (e.g., a CVE in IPsec implementations like OpenSwan, strongSwan, or the "Poodle" attack on TLS – but focus on IPsec). Write a case study describing the vulnerability, its impact, affected versions, and mitigation steps. Discuss how the protocol design could have prevented it.

Sample Answer

Example: The "Beast" attack is not IPsec, but for IPsec, there were vulnerabilities in IKEv1 implementations (e.g., IKEv1 aggressive mode PSK crack). Mitigations: use IKEv2, disable aggressive mode, use strong keys. Design lessons: avoid exposing pre-shared keys in plaintext.


COMP400 – Computer and Network Security (Revision 3) • Unit 4: Security Systems and Models