WIDE Technical-Report in 2006

Configuring IPsec for SHISA/MIPL
wide-tr-nautilus6-configuring-ipsec-for-shisa-mipl-00.pdf

WIDE Project : http://www.wide.ad.jp/

If you have any comments on this document, please contact to ad@wide.ad.jp

Conﬁguring IPsec for SHISA/MIPL
Keiichi Shima <keiichi@iijlab.net>
June 1, 2006
Abstract
In this memo, we describe the step-by-step conﬁguration of IPsec
database for SHISA Mobility Stack.

TODO• From Guillaume: Conﬁguration sample to protect all traﬃc.
• From Guillaume: You should also mention HAAD messages and how
it is possible to protect them or not.
• From Guillaume: For a deployment point of view, it is better todisable HAAD and MPS/ MPA messages. Do you think it is possible
why SHISA ? I think that it is especially useful for what will beachieved with the website.

1Introduction

It is always said that IPsec is awful. Regardless of the fact, we use IPsec
in various places to provide security and privacy. Mobile IPv6 [?] is oneof such protocols. To conﬁgure the IPsec parameters when using Mobile
IPv6, you need to understand what traﬃc should be protected and how
to set necessary parameters on your operating system. In this document,
we will explain the procedure in the step-by-step manner. The target
implementation is SHISA [?] that is built on top of the KAME IPv6 stack
and works on FreeBSD and NetBSD.

2Sample Network Conﬁguration

Figure 1 is the sample network we assume in this document.
The home network preﬁx is 2001:db8:0:1000::/64, the address of thehome agent (HA) is 2001:db8:0:1000::1 and the home address (HoA) ofthe mobile node (MN) is 2001:db8:0:1000::4649.

3

Protection Level

We can have several protection levels when using IPsec with Mobile IPv6.
The following traﬃc can be protected.
1. Binding Update/Binding Acknowledgment messages

1InternetHome Agent
2001:db8:0:1000::1

Home Network
2001:db8:0:1000::/64

Mobile Node
HoA: 2001:db8:0:1000::4649

Figure 1: The sample network
2. Mobile Preﬁx Solicitation (MPS)/Mobile Preﬁx Advertisement messages (MPA)
3. Normal traﬃc between MN and HA
4. Home Test Init (HoTI)/Home Test messages (HoT)
5. All tunneled normal traﬃc between MN and a correspondent node (CN)In this memo, we will show the sample conﬁguration to protect 1, 2and 4.

4

Implementation Assumption

In this document we use the following implementation:• FreeBSD5.4-RELEASE or NetBSD2.0• The KAME snap kit that matches the above OSes
Although we use the above systems, the general description of how weshould conﬁgure IPsec may be applied to other operating systems.

5

Security Parameters

In this memo, we use the following conﬁguration.

IPsec protection mode We use the transport mode IPsec between
MN and HA to protect Binding Update/Binding Acknowledgment messages and Mobile Preﬁx Solicitation/Advertisement messages.
We use the tunnel mode IPsec between MN and HA to protect Home
Test Init/Home Test messages.

2Security Association Security Association (SA) represents a securedata path from one node to the other node. In this example, we use 4SAs, 2 for transport mode communication and 2 for tunnel mode communication. Table 1 shows the parameters for transport mode SAs andTable 2 shows those of tunnel mode SAs. The unique identiﬁer deﬁnedin the tunnel mode SA is used to bind to the security policy to protect
HoTI and HoT.
Transport mode: MN to HA
Source2001:db8:0:1000::4649 (HoA)
Destination
2001:db8:0:1000::1 (HA)
IPsec protocolesp (Encapsulating Security Payload)
SPI
1000
Encryption Algorithm
des-cbc
Encryption Key
MNHAtran
Authentication Algorithm hmac-sha1
Authentication Key
MNHAtransportMNHAtra
Transport mode: HA to MN
Source2001:db8:0:1000::1 (HA)
Destination
2001:db8:0:1000::4649 (HoA)
IPsec protocolesp (Encapsulating Security Payload)
SPI1001
Encryption Algorithm
des-cbc
Encryption Key
HAMNtran
Authentication Algorithm hmac-sha1
Authentication Key
HAMNtransportHAMNtra
Table 1: Parameters of transport mode SAs
The encryption algorithms and the authentication algorithms can bechosen from all available algorithms which kernel supports (see the setkey(8)manual page). Each algorithm has a restriction in its key length. In
des-cbc case, the key length is 64 bits. The key length of hmac-sha1 is160 bits. When using other algorithms, you have to take care the restriction of the key length.
In theory, we can use diﬀerent algorithms for each SA. However, in
this example we use the same encryption and authentication algorithms
for all SAs.
SPI value is a 32 bits integer which is bound to a particular SA. The
value must be unique in a node. Note that the value from 0 to 254 isreserved by IANA for future use. We cannot use the reserved range.

Security Policy Security Policy (SP) speciﬁes the packet template
to decide whether the incoming/outgoing packet should be processed bythe IPsec stack. In this example, we protect all Mobility Header (MH)messages exchanged, MPS/MPA messages, and tunneled HoTI and HoT
messages between MN and HA.
Table 3 shows the parameters of SP entries to protect MH messages
on MN.
Table 4 shows the parameters of SP entries to protect MPS/MPA
messages on MN.

3

Tunnel mode: MN to HA
Source2001:db8:0:1000::4649 (HoA)
Destination
2001:db8:0:1000::1 (HA)
IPsec protocolesp (Encapsulating Security Payload)
SPI
1002
Unique Identiﬁer
1002
Encryption Algorithm
des-cbcEncryption Key
MNHAtunnAuthentication Algorithm hmac-sha1
Authentication Key
MNHAtunnelMNHAtunnel
Tunnel mode: HA to MN
Source2001:db8:0:1000::1 (HA)
Destination
2001:db8:0:1000::4649 (HoA)
IPsec protocolesp (Encapsulating Security Payload)
SPI
1003
Unique Identiﬁer
1003
Encryption Algorithm
des-cbc
Encryption Key
HAMNtunnAuthentication Algorithm hmac-sha1
Authentication Key
HAMNtunnelHAMNtunnel
Table 2: Parameters of tunnel mode SAs
Table 5 shows the parameters of SP entries to protect HoTI/HoTmessages on MN.
The similar policies should be installed on HA. We omit the descriptionof these SP entries for HA, since it is easy to understand by looking at
the actual conﬁguration ﬁle provided in Section 6

6Conﬁguration Files

In this section, we show the actual conﬁguration ﬁle for the setkey(8)command based on the parameters discussed in previous sections.
The conﬁguration ﬁle described in Figure2 installs SAs. These SAs
must be installed on both MN and HA.
The conﬁguration ﬁle described in Figure3 installs SPs on MN.
The conﬁguration ﬁle described in Figure4 installs SPs on HA.

4

Protection of outgoing MH messages
Source2001:db8:0:1000::4649 (HoA)
Destination
2001:db8:0:1000::1 (HA)
Upper Layer Protocol 135 (MH)Directionout (Outbound)
IPsec protocol
esp
IPsec modetransport
IPsec processing level require (Must be protected)
Protection of incoming MH messages
Source2001:db8:0:1000::1 (HA)
Destination
2001:db8:0:1000::4649 (HoA)
Upper Layer Protocol 135 (MH)Directionin (Inbound)
IPsec protocol
esp
IPsec modetransport
IPsec processing level require (Must be protected)
Table 3: SP parameters to protect MH messages for MN

Protection of outgoing MPS messages
Source2001:db8:0:1000::4649 (HoA)
Destination
2001:db8:0:1000::1 (HA)
Upper Layer Protocol ipv6-icmp or 58 (ICMPv6)
ICMPv6 type
146 (MPS)
Directionout (Outbound)
IPsec protocol
esp
IPsec modetransport
IPsec processing level require (Must be protected)
Protection of incoming MPA messages
Source2001:db8:0:1000::1 (HA)
Destination
2001:db8:0:1000::4649 (HoA)
Upper Layer Protocol ipv6-icmp or 58 (ICMPv6)
ICMPv6 type
147 (MPA)
Directionin (Inbound)
IPsec protocol
esp
IPsec modetransport
IPsec processing level require (Must be protected)
Table 4: SP parameters to protect MPS/MPA messages for MN

5

Source
Destination
Upper Layer Protocol
MH typeDirection
IPsec protocol
IPsec mode
Tunnel source
Tunnel destination
IPsec processing level
SA identiﬁer

Protection of outgoing HoTI messages
2001:db8:0:1000::4649 (HoA)::/0 (any)135 (MH)1 (HoTI)
out (Outbound)esptunnel
2001:db8:0:1000::4649 (HoA, which will be updated to CoA)
2001:db8:0:1000::1 (HA)
require (Must be protected)
1002 (Unique ID)

SourceDestination
Upper Layer Protocol
MH typeDirection
IPsec protocol
IPsec mode
Tunnel source
Tunnel destination
IPsec processing level
SA identiﬁer

Protection of incoming HoT messages::/0 (any)
2001:db8:0:1000::4649 (HoA)
135 (MH)3 (HoT)in (Inbound)esptunnel
2001:db8:0:1000::1 (HA)
2001:db8:0:1000::4649 (HoA, which will be updated to CoA)require (Must be protected)
1003 (Unique ID)

Table 5: SP parameters to protect HoTI/HoT messages for MN

6

add 2001:db8:0:1000::4649 2001:db8:0:1000::1
esp 1000-m transport-E des-cbc "MNHAtran"-A hmac-sha1 "MNHAtransportMNHAtra";add 2001:db8:0:1000::1 2001:db8:0:1000::4649
esp 1001-m transport-E des-cbc "HAMNtran"-A hmac-sha1 "HAMNtransportHAMNtra";add 2001:db8:0:1000::4649 2001:db8:0:1000::1
esp 1002-m tunnel-u 1002-E des-cbc "MNHAtunn"-A hmac-sha1 "MNHAtunnelMNHAtunnel";
add 2001:db8:0:1000::1 2001:db8:0:1000::4649
esp 1003-m tunnel-u 1003-E des-cbc "HAMNtunn"-A hmac-sha1 "HAMNtunnelHAMNtunnel";Figure 2: Conﬁguration ﬁle to install SAs

spdadd 2001:db8:0:1000::4649 2001:db8:0:1000::1
135 -P out ipsec
esp/transport//require;spdadd 2001:db8:0:1000::1 2001:db8:0:1000::4649
135 -P in ipsec
esp/transport//require;spdadd 2001:db8:0:1000::4649 2001:db8:0:1000::1
ipv6-icmp 146 -P out ipsec
esp/transport//require;spdadd 2001:db8:0:1000::1 2001:db8:0:1000::4649
ipv6-icmp 147 -P in ipsec
esp/transport//require;spdadd 2001:db8:0:1000::4649 ::/0
135 1 -P out ipsec
esp/tunnel/2001:db8:0:1000::4649-2001:db8:0:1000::1/unique:1002;
spdadd ::/0 2001:db8:0:1000::4649
135 3 -P in ipsec
esp/tunnel/2001:db8:0:1000::1-2001:db8:0:1000::4649/unique:1003;
Figure 3: Conﬁguration ﬁle to install SPs on MN

7

spdadd 2001:db8:0:1000::1 2001:db8:0:1000::4649
135 -P out ipsec
esp/transport//require;spdadd 2001:db8:0:1000::4649 2001:db8:0:1000::1
135 -P in ipsecesp/transport//require;spdadd 2001:db8:0:1000::1 2001:db8:0:1000::4649
ipv6-icmp 147 -P out ipsec
esp/transport//require;spdadd 2001:db8:0:1000::4649 2001:db8:0:1000::1
ipv6-icmp 146 -P in ipsec
esp/transport//require;spdadd ::/0 2001:db8:0:1000::4649
135 3 -P out ipsec
esp/tunnel/2001:db8:0:1000::1-2001:db8:0:1000::4649/unique:1003;
spdadd 2001:db8:0:1000::4649 ::/0
135 1 -P in ipsec
esp/tunnel/2001:db8:0:1000::4649-2001:db8:0:1000::1/unique:1002;
Figure 4: Conﬁguration ﬁle to install SPs on HA8