Example: dental hygienist

IPsec HOWTO

IPsec HOWTORalf Spennebergralf (at) HistoryRevision 2007-02-26 Revised by: RSOpenSSL needs file: crlnumberRevision 2005-09-03 Revised by: RSAdded iptables rule setting the MSS and one minor correctionRevision 2005-07-19 Revised by: RSAdded some remarks about routingRevision 2005-03-3 Revised by: RSfwd-policy corrected, p12 addedRevision 2005-02-1 Revised by: RSfwd-policy addedRevision 2005-01-31 Revised by: RS/ replaced by / Revised by: RSNat-Traversal added Changed Document structureRevision Revised by: RSCorrection modp768 Revision Revised by: RSAdded Compilation of certpatch and keyconvRevision Revised by: RSCorrectionsRevision Revised by: RSFixed a typoRevision Revised by: RSFixed a typoRevision Revised by: RSMinor correctionsRevision Revised by: RSAdded: Using the OpenBSD isakmpdRevision Revised by: RSFurther typos corrected.

IPsec HOWTO Ralf Spenneberg ralf (at) spenneberg.net 2003-08-18 Revision History Revision 0.9.96 2007-02-26 Revised by: RS OpenSSL needs file: crlnumber

Tags:

  Spices

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of IPsec HOWTO

1 IPsec HOWTORalf Spennebergralf (at) HistoryRevision 2007-02-26 Revised by: RSOpenSSL needs file: crlnumberRevision 2005-09-03 Revised by: RSAdded iptables rule setting the MSS and one minor correctionRevision 2005-07-19 Revised by: RSAdded some remarks about routingRevision 2005-03-3 Revised by: RSfwd-policy corrected, p12 addedRevision 2005-02-1 Revised by: RSfwd-policy addedRevision 2005-01-31 Revised by: RS/ replaced by / Revised by: RSNat-Traversal added Changed Document structureRevision Revised by: RSCorrection modp768 Revision Revised by: RSAdded Compilation of certpatch and keyconvRevision Revised by: RSCorrectionsRevision Revised by: RSFixed a typoRevision Revised by: RSFixed a typoRevision Revised by: RSMinor correctionsRevision Revised by: RSAdded: Using the OpenBSD isakmpdRevision Revised by: RSFurther typos corrected.

2 Some sentences Revised by: RSBugfixesRevision Revised by: RSadded chapter covering certificatesRevision Revised by: RSfirst draftThis HOWTO will cover the basic and advanced steps setting upa VPN using IPsec basedon the Linux Kernels Since there is a vast amount of documentation available for theLinux Kernel , this HOWTO will concentrate on the new IPsec Features in the of running on Linux Kernel using Kernel using OpenBSD s latest version of this document can always be found at TheLinux DocumentationProject1and at the official homepage to write this HowToI have used numeruos HowTos in the past. Most were very valuable to me. When thenew IPsec features in the Linux Kernel were implemented I started to play aroundusing them. Soon I found out that only very little documentation exists.

3 That startedme writing this of this documentThis document is broken down into 7 1: IntroductionThis sectionSection 2: TheoryIPsec theory. Essentially the IPsec 3: OpenswanThis section will describe how to setup Openswan on the Kernel 4: Racoon running on Linux Kernel section describes how to setup an IPsec VPN using the KAME toolssetkeyandracoon. This now includes 5: Isakmpd running on Linux Kernel section describes how to setup an IPsec VPN using OpenBSD isakmpd 6: Generating CertificatesThis section describes how to generate Certificates using 7: Advanced ConfigurationThis section gives some hints on XAUTH and on to this document Matija Nalis Fridtjof Busse Uwe Beck Juanjo Ciarlante Ervin Hegedus Barabara Kane Alois Schmid3 IPsec HOWTOL egal InformationCopyrightCopyright (c) 2003 Ralf SpennebergPlease freely copy and distribute (sell or give away) this document in any s requested that corrections and/or comments be fowarded to the document main-tainer.

4 You may create a derivative work and distribute it provided that you: Send your derivative work (in the most suitable format such as sgml) to the LDP(Linux Documentation Project) or the like for posting on theInternet. If not theLDP, then let the LDP know where it is available. License the derivative work with this same license or use GPL. Include a copyrightnotice and at least a pointer to the license used. Give due credit to previous authors and major you re considering making a derived work other than a translation, it s requestedthat you discuss your plans with the current author assumes no responsibility for anything done withthis document, nordoes he make any warranty, implied or explicit. If your dog dies, the author may notbe made responsible!Related Documents Networking Overview HOWTO3 Networking HOWTO4 VPN-Masquerade HOWTO5 VPN HOWTO6 Advanced Routing & Traffic Control HOWTO7 TheoryWhat is IPsec ?

5 IPsec is an extension to the IP protocol which provides security to the IP and theupper-layer protocols. It was first developed for the new IPv6 standard and then backported to IPv4. The IPsec architecture is described in the RFC2401. The fol-lowing few paragraphs will give you a short introduction into uses two different protocols - AH and ESP - to ensure theauthentication, in-tegrity and confidentiality of the communication. It can protect either the entire IPdatagram or only the upper-layer protocols. The appropiatemodes are called tunnelmode and transport mode. In tunnel mode the IP datagram is fully encapsulated bya new IP datagram using the IPsec protocol. In transport modeonly the payload of4 IPsec HOWTOthe IP datagram is handled by the IPsec protocol inserting the IPsec header betweenthe IP header and the upper-layer protocol header (seeFigure 1).

6 Original packettransport modenew IP headermodetunnelTCPTCPAHIPIPDataDataTCPI PAHIPDataFigure 1. IPsec tunnel and transport modeTo protect the integrity of the IP datagrams the IPsec protocols use hash messageauthentication codes (HMAC). To derive this HMAC the IPsec protocols use hashalgorithms like MD5 and SHA to calculate a hash based on a secret key and the con-tents of the IP datagram. This HMAC is then included in the IPsec protocol headerand the receiver of the packet can check the HMAC if it has access to the secret protect the confidentiality of the IP datagrams the IPsec protocols use standardsymmetric encryption algorithms. The IPsec standard requires the implementationof NULL and DES. Today usually stronger algorithms are used like 3 DES, AES protect against denial of service attacks the IPsec protocols use a sliding packet gets assigned a sequence number and is only accepted if the packet snumber is within the window or newer.

7 Older packets are immediately protects against replay attacks where the attacker records the original packetsand replays them the peers to be able to encapsulate and decapsulate the IPsec packets they need away to store the secret keys, algorithms and IP addresses involved in the communi-cation. All these parameters needed for the protection of the IP datagrams are storedin a security association (SA). The security associations are in turn stored in a securityassociation database (SAD).Each security association defines the following parameters: Source and destination IP address of the resulting IPsec header. These are the IPaddresses of the IPsec peers protecting the packets. IPsec protocol (AH or ESP), sometimes compression (IPCOMP)is supported, too. The algorithm and secret key used by the IPsec protocol.

8 Security Parameter Index (SPI). This is a 32 bit number whichidentifies the implementations of the security association databaseallow further parametersto be stored: IPsec mode (tunnel or transport) Size of the sliding window to protect against replay attacks. Lifetime of the security HOWTOS ince the security association defines the source and destination IP addresses, it canonly protect one direction of the traffic in a full duplex IPsec communication. Toprotect both directions IPsec requires two unidirectionalsecurity security assocations only specify how IPsec is supposedto protect the information is needed to define which traffic to protect when. This in-formation is stored in the security policy (SP) which in turnis stored in the securitypolicy database (SPD).A security policy usually specifies the following parameters: Source and destination address of the packets to be protected.

9 In transport modethese are the same addresses as in the SA. In tunnel mode theymay differ! The protocol (and port) to protect. Some IPsec implementations do not allow thedefinition of specific protocols to protect. In this case all traffic between the men-tioned IP addresses is protected. The security association to use for the protection of the manual setup of the security association is quite error prone and not very se-cure. The secret keys and encryption algorithms must be shared between all peers inthe virtual private network. Especially the exchange of thekeys poses critical prob-lems for the system administrator: How to exchange secret symmetric keys when noencryption is yet in place?To solve this problem the internet key exchange protocol (IKE) was developed. Thisprotocol authenticates the peers in the first phase.

10 In the second phase the securityassociations are negotiated and the secret symmetric keys are chosen using a DiffieHellmann key exchange. The IKE protocol then even takes careof periodically rekey-ing the secret keys to ensure their ProtocolsThe IPsec protocol family consists of two protocols: Authentication Header (AH) andEncapsulated Security Payload (ESP). Both are independentIP protocols. AH is theIP protocol 51 and ESP is the IP protocol 50 (see/etc/protocols). The following twosections will briefly cover their - Authentication HeaderThe AH protocol protects the integrity of the IP datagram. Toachieve this, the AHprotocol calculates a HMAC to protect the integrity. When calculating the HMAC theAH protocol bases it on the secret key, the payload of the packet and the immutableparts of the IP header like the IP addresses.


Related search queries