The IP Security Protocol, Part 2

Encapsulating security payloads, key exchange mechanisms and other components of establishing secure data transfers.
Security Associations

Up to now, we have been talking about IPSec relationships between two communicating peers, taking for granted the existence of some kind of trusted liaison between them. In IPSec jargon, this relationship is called a security association (SA). For each IPSec instance (i.e., each peer it is communicating with), a host or gateway keeps an SA that collects all the information related to the instance itself. For example, it may contain the following:

  • IPSec mode (either tunnel or transport)

  • negotiated encryption algorithms

  • SA granularity (which depends on the selector, described below)

An SA is uniquely identified by three parameters:

  • SPI (Security Parameter Index)

  • destination IP address

  • security protocol (either AH or ESP)

The SA represents a monodirectional, secure logical channel working with a single security protocol. If a bidirectional data exchange is required (normally it is), two SAs are needed. Also, if both AH and ESP are required for communication, two SAs for each direction are needed.

For each network interface enabled to "talk" IPSec, two databases are maintained: the SA database (SAD) and the security policy database (SPD). When a packet is being sent, the IPSec layer looks for its destination address in the SAD. If an entry is found, the relevant information is extracted and used to properly protect and encapsulate the packet.

On the receiving side, the arrival of a packet triggers a search by the SPD, which identifies the policies that should be applied to the packet. The key used for the look up in the SPD is called the packet selector. In IPSec terminology, this is information extracted from the packet (e.g., IP source and destination addresses, TCP or UDP ports and so on) sufficient to define the packet flow belonging to the SA. Depending on whether the selector is fine- or coarse-grained, an SA may be applied to all the packets exchanged between two peers (regardless of L4 protocols and ports) or to a specific packet flow. For example, if you wanted to define an IPSec channel for receiving HTTP data from a specific IPSec-enabled web server, the selector would be (<destination address: your IP>, <source address: web server's IP>, <L4 protocol: TCP>, <source port: 80>).

Three policies may be applied to a received packet, depending on the result of the SPD search:

  • discard the packet

  • bypass IPSec and process the packet normally (IPSec is not used for this packet flow)

  • apply IPSec according to what is specified in the SAD

According to these procedures, each packet going through an IPSec-enabled interface is subject to IPSec policies. In particular, packets that do not contain any IPSec fields are filtered. When no entry is found in the SPD for a particular packet's selector, the default behavior is to discard the packet.

Key Exchange Mechanisms

As we have seen, the whole IPSec architecture is based on the presence of some common secret keys on both peers. Before any secure communication may begin, such keys are used to establish the SA. Keys may be manually configured on the peers (e.g., a passphrase may be agreed between the security administrators), or they may be automatically distributed using the IKE procedure. The keys may range from simple two-host shared secrets to digital certificates issued by official certification authorities. Hence, IKE can scale from a simple point-to-point data exchange mechanism to a complex network of encrypting hosts.

The IKE procedure creates a secure tunnel between two peers and then uses it to negotiate the SA. Note, this tunnel has nothing to do with the data tunnel that will be used eventually to exchange IPSec packets. More specifically, the IKE procedure in split into two phases. In Phase 1, the two peers establish a secure channel over which configuration data can be safely exchanged. In Phase 2, the IPSec SA is actually negotiated.

The first operation of Phase 1 is the authentication of the remote peer. As noted above, encryption without proper authentication can be extremely dangerous. Different authentication mechanisms can be employed, ranging from shared secret keys (manually configured) to public key cryptography. In the latter case, key exchange is based on the Diffie-Hellman algorithm reinforced with the usage of public key signatures.

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Securing my LAN.

Lord Loh.'s picture

I want to secure my LAN from internal attacks. I primarily want to prevent an external notebook PC from being brought in by an employee and be configured to work on the LAN.

I have certain IP based rules for access and deny of resources. If an external device joins my LAN it could assume any IP and gain access to the otherwise denied resource.

One way I see is to put passphrase on every PC. The other is the use of IKE on the LAN. Can a unauthorized machine be prevented from getting a key via IKE?

Re: The IP Security Protocol, Part 2

Anonymous's picture

As a reference performance note, FreeS/Wan (Linux IPSec implementation) plus AES patches
can almost saturate (95%) a 100Mbps link with a P4 1GHz.

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix