Design and Implementation to Support Multiple Key Exchange Protocols for Ipsec
Total Page:16
File Type:pdf, Size:1020Kb
Design and Implementation to Support Multiple Key Exchange Protocols for IPsec Kazunori Miyazawa Shoichi Sakane Yokogawa Electric Corporation Yokogawa Electric Corporation [email protected] [email protected] Ken-ichi Kamada Mitsuru Kanda Yokogawa Electric Corporation Toshiba Corporation [email protected] [email protected] Atsushi Fukumoto Toshiba Corporation [email protected] Abstract methods to share IPsec SAs between two enti- ties. One is manual configuration and the other is automatic key exchange. Manual configura- The racoon2 project has been developing an ap- tion is basically used for a small static system or plication, the racoon2, which simultaneously debugging because of its scalability. Automatic supports multiple key exchange protocols for key exchange is used in a practical system. IPsec [6]. The racoon2 supports IKEv2 [1] and KINK [11], and works on Linux, NetBSD, and We have used the Internet Key Ex- FreeBSD. This paper describes issues to sup- change(IKEv1) [2] protocol to support port the multiple key exchange protocols on automatic key exchange. But it does not those operating systems, and describes our ap- clearly specify the ways to re-key and delete proach. This paper also describes design and SAs and dead peer detection. The vendors implementation of the racoon2. have been extending it to support them and it caused interoperability issues. Additionally, it needs at least 6 messages to exchange IPsec SAs. According to the background IETF IPsec 1 Background working group had discussed a successor of IKEv1. The working group defines the Internet Key Exchange version 2 (IKEv2) and IETF IPsec provides security services in IP layer. To published it in 2005 as a conclusion of the use the services, we need to share IPsec SAs discussion. IKEv2 reduces the messages to between two entities. IPsec SA consists of a set exchange keys from 6 messages to 4 messages. of security parameters such as IPsec protocol, It also specifies to re-key and delete SAs and cipher algorithm, key and so on. There are two to detect the dead peer and introduces more 144 • Design and Implementation to Support Multiple Key Exchange Protocols for IPsec functionality. 2 Supporting the multiple key ex- change protocols KINK, Kerberised Internet Negotiation of We considered two kinds of architecture to im- Keys, is another key exchange protocol. It is plement the multiple key exchange protocols defined at KINK working group in IETF. It uses on Linux, NetBSD and FreeBSD operating sys- Kerberos to authenticate peers and establishes tems. One is implementing all protocols into IPsec SAs only using symmetric key cipher al- single daemon. The other is implementing dae- gorithm. Therefore it is available for low-end mons for each protocol. devices which can not calculate public key al- gorithm in a practical period. KINK reuses the We adopted the latter approach. Because sin- encoding format of IKEv1 to represent infor- gle daemon architecture consumes useless re- mation of IPsec SA so that its payloads are sim- sources when user want to use only one proto- ilar to IKEv1. col. Additionally, it tends to reduce the modu- larity so that it is possibly difficult to extend to implement new protocols. racoon is widely used as an implementation of IKEv1 on Linux, NetBSD, FreeBSD and oth- The current Linux kernel does not assume to ers. racoon was developed originally by the support multiple daemons which process each KAME project [5] as the implementation on key exchange protocol. It accordingly can not the BSDs. The IPsec-Tools project [4] did keep the relationship between an IPsec policy porting it on Linux when Linux introduced and a key exchange protocol. NetBSD and KAME compatible IPsec stack. The IPsec- FreeBSD can not keep the information either. Tools project currently maintains and extends We had had a choice to change the kernels. We it to support various functions. however decided to solve the issue within the user-land instead of changing the kernels be- cause of the advantage of deployment of the The racoon2, a successor of racoon, however racoon2. introduced different architecture and configura- It is necessary to strictly manage the relation- tion model. The configuration includes IPsec ship to get a daemon to process a key exchange policy to supports the multiple key exchange request based on a user configuration. Sepa- protocols. Because it tightly links the policy, ration of a IPsec policy and the key exchange IPsec SAs, and the key exchange protocol, a protocol configuration like racoon does causes user can specify and easily prospect the re- possibility of the application to use a different sults of the configuration. It accordingly breaks protocol against a key exchange request. backward compatibility of the configuration. Instead of separated the configuration of racoon, the racoon2 configuration unifies and In this paper, we discuss issue to support the includes IPsec policies, IPsec SAs and the key multiple key exchange protocols in section 2. exchange protocols. Using this configuration We describe data structure and architecture of model, user can clearly configure what proto- the racoon2 in section 3. We show current sta- col must be used against the IPsec policy. On tus and future works in section 4. We summa- the other hand, user can not configure them sep- rize this paper in section 5. arately like the usage of racoon. 2006 Linux Symposium, Volume Two • 145 As mentioned above, the kernel can not keep its action. selector is pointed from remote the relationship because it does not have a field when it supports road-warriors. selector of the key exchange protocol in IPsec policy represents simplex traffic so that there are data structure, which is struct xfrm_policy on two selectors for an normal bidirectional the Linux. The daemon accordingly needs traffic. The IKE daemon uses the values in to search the IPsec policy which triggers the selector as an IKEv2 Traffic selector pay- SADB_ACQUIRE message, when receiving it. load or an IKEv1 ISAKMP ID payload in phase 2. In KINK protocol, it will be used The PF_KEY [8] API of Linux, NetBSD and as a KINK_ISAKMP ID payload. FreeBSD contains extension derived from the KAME implementation. The stack has IPsec • sa contains information of an IPsec SA. policy ID. In the Linux kernel the index of the They are an IPsec protocol and candidates struct xfrm_policy corresponds it. The index is of cipher algorithm. assigned by the kernel and identifies the policy uniquely. The kernel also returns the ID against • ipsec contains parameter to create IPsec a request of installing an IPsec policy. SA bundle. The information consists of common values of bundled IPsec SAs When there is no IPsec SA corresponding the such as lifetime. The racoon2 restricts the IPsec policy in the kernel, it acquires the IPsec type of IPsec SA bundle like the table 3.1. SADB_ACQUIRE SA by sending a message to ipsec points more than one IPsec SA to the daemons which listens to PF_KEY socket. create bundle. KAME extends SADB_ACQUIRE message to contain the ID so that the daemon which re- ceives the message can search the IPsec pol- type of bundle the results packet AH_ESP [IP][AH][ESP][Payload] icy which triggers it. As mentioned above, the AH_IPCOMP [IP][AH][IPCOMP][Payload] racoon2 adopts unified configuration model. ESP_IPCOMP [IP][ESP][IPCOMP][Payload] The daemons can exactly search the original AH_ESP_IPCOMP [IP][AH][ESP][IPCOMP][Payload] configuration. Table 1: The types of IPsec SA bundle 3 The racoon2 • policy contains parameter of action against the traffic which matches the selector. The action can be “discard”, “bypass” or 3.1 The racoon2 data structure “auto_ipsec” to apply IPsec. policy also contains mode of IPsec and end point’s The data structure basically consists of selec- addresses if the mode is “tunnel”. a pol- tor, policy, ipsec, sa and remote. They are icy connects components of the racoon2 linked by their identifiers. The current racoon2 data structure. a policy points some ipsec directly uses this model as its configuration. to make a proposal when the action is “auto_ipsec”. • selector contains parameters to select traf- • remote contains parameter for the key ex- fic through the IPsec stack such as IP ad- change protocol. They are identifier of a dresses, an upper layer protocol, port num- peer, the IP addresses, the authentication bers and so on. selector points a policy as information, algorithm and so on. 146 • Design and Implementation to Support Multiple Key Exchange Protocols for IPsec A user can flexibly build configuration by link- kernel broadcasts a SADB_ACQUIRE mes- ing those components corresponding what user sage to all daemons which listens to PF_KEY. want. For example, in case of that two types iked and kinkd accordingly receive the same of traffic shares a pair of IPsec SA whose pro- SADB_ACQUIRE message. The racoon2 posal is AH and ESP bundle or single ESP, adopts the unified configuration model and all the configuration consists of the components daemons read an identical configuration file to linked like figure 1 share the parameter. The configuration file cur- rently reflects the racoon2 data structure. Figure 1: racoon2 data structure Figure 2: the racoon2 architecture An initiator can retrieve whole configuration from selector. When it is a responder, it can search a remote from peer’s identifier. If it spmd reads selector, policy and ipsec from the finds remote, it validates the peer and searches configuration files and installs IPsec policies the selector from IKEv2 Traffic Selector Pay- into the kernel via PF_KEY socket. The ker- load, ISAKMP ID Payload in IKEv1 phase 2 nel returns the message including IPsec policy or KINK_ISAKMP ID Payload. In the case of ID and spmd creates a mapping table of IPsec supporting road-warrior a responder uses link policy ID and selector identifier.