Red Hat Fedora Linux 3 Bible

Sometimes the people and offices that have to work closely together are not physically close together. For example, you may have:

Rather than purchase expensive leased lines from a phone company, you want to use an inexpensive network medium, like the Internet, to let the two sides communicate. The problem is that you don’t want to open up access to file sharing, print sharing, and other private services to the Internet. You also don’t want communication between these sites to be exposed to anyone who is watching Internet traffic. One solution is to set up a virtual private network.

A virtual private network (VPN) provides a way to set up secure communications over an otherwise insecure network. With a VPN connection in place, the two sides of a connection can communicate as safely as they do on the same corporate LAN. To do this, a VPN usually offers the following features:

There are several ways of going about setting up VPN connections in Linux:

In this chapter, I provide an overview of the features and tools in IPsec in Fedora Core 3.

Understanding IPsec

To provide more secure transmission of TCP/IP data in the new Internet Protocol version 6 (IPv6) standard, developers of that standard created the Internet Protocol Security (IP) architecture. With IPsec, encrypted communication is possible right at the Internet Protocol (IP) level and methods for providing access control, data integrity, authentication and traffic flow confidentiality are standardized as well.

In practical terms, organizations that have computers that need to communicate on public networks in ways that are secure and private can create virtual private networks (VPNs) with IPsec. Unlike other VPN implementations (such as CIPE), which require a manual exchange of keys to work, IPsec offers an automated way of creating security associations between communications endpoints and managing keys.

With slow adoption of IPv6 in the United States and other places, IPsec has been included (backported) into the IPv4 protocol, which is still the most common IP version used on the Internet. That backport was added into the IP protocol included with the Linux 2.6 kernel that comes with Fedora Core 2. The Internet standard RFC2401 document describes the IPsec architecture.

Using IPsec protocols

IPsec consists of two primary protocols: Authentication Header (AH) and Encapsulating Security Payload (ESP). Look in the /etc/protocols file and you'll see that AH is assigned to protocol number 50 and ESP is assigned to protocol number 51.

To authenticate peer computers and exchange symmetric keys, IPsec uses the Internet Key Exchange (IKE) protocol. At the beginning of communication between two host computers using IPsec, IKE does the following:

The security associations established by IKE are stored in a security association database (SAD). A security association holds information about the communications endpoints (possibly public Internet IP addresses), whether Authentication Header (AH) or Encapsulating Security Payload (ESP) protocols are being used with IPsec, and the secret key/algorithm being used.

IPsec itself has two possible modes of operation: tunnel mode and transport mode.

Included in the protocol header of each packet transmitted is information referred to as Hash Message Authentication Codes (HMAC). Including these codes with transmitted data in IPsec offers the following advantages:

By recording a sequence of packets during data communications, an intruder can attempt denial-of-service attacks by replaying that sequence of packets. IPsec combats that type of attack by accepting packets that are within a “sliding window” of sequence numbers or higher. Packets using older sequence numbers are dropped.

Using IPsec in Fedora

Using IPsec in Fedora Core 3, you can configure virtual private networks (VPN) between Fedora and other systems that support IPsec. It is important that hosts at both ends of the IPsec VPN are configured in the same way. In fact, you may have the best results by using the same operating system version and IPsec software (in the case of Fedora, ipsec-tools package and IP protocol drivers that come with the 2.6 kernel).

By default, the necessary modules to use IPsec are already available in Fedora 3. The tools you use to configure IPsec are contained in the ipsec-tools packages. You set up IPsec in the kernel in much the same way that you set up firewalls with iptables: you run commands that load settings into the kernel, either from command line options (standard input) or from a file containing your preconfigured options.

The commands you use to set up a VPN with IPsec include the following:

Sample configuration files to use with setkey are available from the IPsec-HOWTO (www.ipsec-howto.org). A sample racoon.conf file is included with the ipsec-tools package (in the /usr/share/doc/ipsec-tools-* directory). For an in-depth description of the tools used with IPsec, refer to the Kame Project Web site (www.kame.net).

Категории