<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE zprava SYSTEM "techrep.dtd">

<zprava cislo="2/2002" jazyk="en">
<nazev>IPsec interoperability tests with respect to deployment as <uv>Last Mile</uv> security solution</nazev>
<autor>Petr Holub</autor>
<datum>2002-02-28</datum>

<h1>Abstract</h1>

<p>This report summarizes interoperability tests between KAME based
FreeBSD, Windows~2000 and FreeS/WAN Linux IPsec
implementation. Furthermore I am developing concept of securing
wireless last mile solution which is by its nature usually most
susceptible to security vulnerabilities like eavesdropping.</p>

<h1>Introduction</h1>

<p>I have targeted my effort at IPsec<cite href="2"/>
interoperability testing because this technology can be deployed in
last mile connectivity as security solution. Most likely this is
convenient for wireless networks 802.11b that are quite insecure even
when using WEP encryption<cite href="7"/><cite href="8"/>.</p>

<p>I have picked up the topic studied by other CESNET group<cite
href="10"/> two years ago.  Since that work addressed Linux IPsec
implementation and its interoperability issues I haven't included
these issues in my report. I have done similar tests for KAME
based implementation and I have developed several models for last
mile security solution based on results of these tests.</p>

<p>IPsec can be run in two basic modes:
<ul>
   <li>transport</li>
   <li>tunnel</li>
</ul>
Transport mode can be used for end-to-end security while tunnel mode
means secure tunneling over insecure part of the network.
</p>

<p>IPsec can use keys as follows:
<ul>
   <li>manually set keys</li>
   <li>automatically negotiated keys using Internet Key Exchange 
       (IKE) protocol
   <ul>
      <li>using pre-shared key (shared secret)</li>
      <li>X.509 certificates sent either by client or stored
          in DNS (Secure DNS)</li>
   </ul></li>
</ul>
</p>


<h1>Possible scenarios</h1>

<h2>End-to-end security</h2>

<p>
End-to-end scenario uses transport mode for securing the whole path
between two communicating machines. For my purposes this is not very
useful solution.
</p>

<p>
<obr src="scenario01">End-to-end security scenario</obr>
</p>

<h2>Road-Warrior scenario for client security</h2>

<p>
Let's have a client that's connected to wireless network. Wireless
network can be protected by WEP encryption but this doesn't provide
reasonable protection against an attack led from one computer already
participating in such a network. In this scenario I want to have all
the traffic from client over insecure part of network (in my case the
wireless part) encrypted using IPsec. After passing gateway traffic
gets decrypted. On it way back traffic gets encrypted on the gateway
and travels back to the client. Furthermore each client has it own
unique pre-shared key or certificate and clients don't process any
unencrypted traffic.
</p>

<p>
<obr src="scenario02" id="obr:scenario02">Road-Warrior scenario for client security scenario (1)</obr>
<obr src="scenario03" id="obr:scenario03">Road-Warrior scenario for client security scenario (2)</obr>
</p>

<p>
This scenario can be created either using gateway located behind the
access-point (<a href="#obr:scenario02">picture</a>) or creating IPsec
capable access-point (<a href="#obr:scenario03">picture</a>)
e.g. using wireless card inserted in computer capable of forwarding
packets between interfaces (e.g. using router software).
</p>

<h2>Road-Warrior scenario for bridging networks (VPN)</h2>

<p>
This is usual Virtual Private Network (VPN) scenario for
interconnecting two secure networks over insecure network.  There is
one gateway in each network that performs encryption and decryption of
traffic flowing to and from the other network.
</p>

<p>
<obr src="scenario04">Road-Warrior scenario for bridging networks (VPN) scenario</obr>
</p>


<h1>Notes on implementations used</h1>

<p>KAME<cite href="2"/> IPsec implementation used in FreeBSD and NetBSD
<footnote>OpenBSD relies on its own IPsec development.</footnote> is
based on two main components:
<ul>
   <li>IPsec protocol implementation in kernel of the operating
   system</li>
   <li><soubor>racoon</soubor> daemon ensuring key
   exchanges (IKE)</li>
</ul>
When no re-keying is required kernel IPsec implementation can be used on its own.
</p>

<p>FreeS/WAN<cite href="3"/> implementation was thoroughly tested by
other CESNET working group<cite href="10"/>. This implementation shows
no interoperability problems.</p>

<p>In Windows~2000 I have tested both native IPsec support and PGPnet product.</p>

<h1>Tests and measurements</h1>

<h2>End-to-end security</h2>

<h3>Setup</h3>

<p>IPsec configuration (<soubor>/etc/ipsec.conf</soubor>):
<pre>
spdadd 192.168.3.38 192.168.3.44 any -P out ipsec
esp/transport//use;
spdadd 192.168.3.44 192.168.3.38  any -P in ipsec
esp/transport//use;
spdadd 192.168.3.38 192.168.3.20 any -P out ipsec
esp/transport//use;
spdadd 192.168.3.20 192.168.38  any -P in ipsec
esp/transport//use;
</pre>
This configuration can be loaded using following command:
<prikaz>
setkey -f /etc/ipsec.conf
</prikaz>
Similar configurations are used on remaining two machines.
</p>

<p>
<obr src="testbed02" id="obr:eetestbed">End-to-end security testbed setup</obr>
</p>

<p>Racoon configuration (<soubor>/usr/local/etc/racoon/racoon.conf</soubor>):
<pre>
path include "/usr/local/etc/racoon" ;
path pre_shared_key "/usr/local/etc/racoon/psk.txt" ;
path certificate "/usr/local/etc/cert" ;

padding
{
        maximum_length 20;      # maximum padding length.
        randomize off;          # enable randomize length.
        strict_check off;       # enable strict check.
        exclusive_tail off;     # extract last one octet.
}

listen
{
        #isakmp ::1 [7000];
        #isakmp 202.249.11.124 [500];
        #admin [7002];          # administrative's port by kmpstat.
        #strict_address;        # required all addresses must be bound.
}
timer
{
        # These value can be changed per remote node.
        counter 5;              # maximum trying count to send.
        interval 20 sec;        # maximum interval to resend.
        persend 1;              # the number of packets per a send.

        # timer for waiting to complete each phase.
        phase1 30 sec;
        phase2 15 sec;
}

remote anonymous
{
        exchange_mode aggressive,main;
        doi ipsec_doi;
        situation identity_only;

        #my_identifier address;
        #my_identifier user_fqdn "sakane@kame.net";
        #peers_identifier user_fqdn "sakane@kame.net";
        #certificate_type x509 "mycert" "mypriv";

        nonce_size 16;
        lifetime time 10 min;   # sec,min,hour
        initial_contact on;
        support_mip6 on;
        proposal_check obey;    # obey, strict or claim

        proposal {
                encryption_algorithm 3des;
                hash_algorithm md5;
                authentication_method pre_shared_key ;
                dh_group 2 ;
        }
}

sainfo anonymous
{
        pfs_group 1;
        lifetime time 600 sec;
        encryption_algorithm 3des,des,cast128,blowfish ;
        authentication_algorithm hmac_sha1,hmac_md5;
        compression_algorithm deflate ;
}
</pre>
The same <tt>racoon</tt> configuration will be used in subsequent
tests and setups. The only difference is change in file containing
pre-shared key.
</p>

<h3>Performance</h3>

<p><a href="#tab:perf_meas">Table</a> summarizes results of
performance measurements of KAME IPsec stack on differently powerful
machines. Measurements have been done using <prikaz>netperf</prikaz>
tool which runs tests between pair of machines. In this pair one
machine acts as traffic generator and the other one as replying
server.
</p>

<p>
<tab sloupce="lcc" id="tab:perf_meas">
      <tr><th></th><th><b>arwen</b></th><th><b>evenstar</b></th></tr>
      <tr><td>intial delay:</td><td>0.2-0.6 ms</td><td>0.2 ms</td></tr>
      <tr><td><i>netperf</i></td><td></td><td></td></tr>
      <tr><td><tt>TCP_STREAM</tt></td><td>3,514.35 kbps</td><td>21,382.09 kbps</td></tr>
      <tr><td></td><td></td><td>(16,864.51 kbps)</td></tr>
      <tr><td><tt>TCP_STREAM</tt> (n-e)</td><td>57,358.72 kbps</td><td>94124.03 kbps</td></tr>
      <tr><td><tt>UDP_STREAM</tt> (to kouboucek)</td><td>3,886.98 kbps</td><td>33,092.48 kbps</td></tr>
      <tr><td><tt>UDP_STREAM</tt> (from kloboucek)</td><td>24,587.70 kbps</td><td>24,474.49 kbps</td></tr>
      <tr><td></td><td></td><td>(19,456.85 kbps)</td></tr>
      <tr><td><tt>UDP_STREAM</tt> (to kloboucek, n-e)</td><td>59,639.57 kBps</td><td>95,636.25 kbps</td></tr>
      <tr><td><tt>UDP_STREAM</tt> (from kloboucek, n-e)</td><td>95,742.14 kbps</td><td>95,726.72 kbps</td></tr>
      <nazev>IPsec performance overview on FreeBSD.</nazev>
</tab>
Measurement parameters:
<ul>
   <li>neperf version: 2.1.3</li>
   <li>Confidence level: 99%</li>
   <li>Confidence interval: 2,5%</li>
   <li>Command: <prikaz>./netperf -i 2,3 -f k -H hostname -t TCP_STREAM</prikaz></li>
</ul>
<tt>TCP_STREAM</tt> test measures real TCP data throughput between two
machines. <tt>UDP_STREAM</tt> tests rather upper limit of the machine
ability to push data on the network. Therefore this test can give very
different result when running on each of the pair of testing machine
while <tt>TCP_STREAM</tt> test should give identical results.
<tab sloupce="lccc">
      <tr><th>parameter</th><th>kloboucek</th><th>evenstar</th><th>arwen</th></tr>
      <tr><td>processor</td><td>Pentium III</td><td>Athlon</td><td>Pentium MMX</td></tr>
      <tr><td></td><td>900~MHz (700~MHz)</td><td>1200~MHz</td><td>233~MHz</td></tr>
      <tr><td>RAM</td><td>256~MB</td><td>512~MB</td><td>128~MB</td></tr>
      <tr><td>NIC</td><td>RealTek~8139</td><td>SMC EtherPower II</td><td>SMC 9332DST 21140</td></tr>
      <nazev>Hardware configuration of testing machines.</nazev>
</tab>
Notebook called <tt>kloboucek</tt> was tested in two modes:
<ul>
   <li>when running on AC -- processor frequency was 900 MHz</li>
   <li>when running on battery -- processor frequency was 700 MHz</li>
</ul>
Since values for these two modes differ only when using IPsec, values for 700~MHz operation are given in brackets.
</p>

<h2>Road-Warrior scenario for client security</h2>

<h3>Setup</h3>

<p>This setup is most easily done dedicating one subnet for wireless connected clients. Gateway <tt>evenstar</tt> located behind the access-point can work as router as well. Let us summarize the setup:
<ul>
   <li>wireless network address range 192.168.1.0/24</li>
   <li>gateway address 192.168.1.1</li>
   <li>client address 192.168.1.3</li>
</ul>
</p>

<p>
<obr src="testbed01">Road-Warrior scenario for client security testbed setup</obr>
</p>

<p>
IPsec configuration on client:
<pre>
spdadd 192.168.1.3 0.0.0.0/0 any -P out ipsec
esp/tunnel/192.168.1.3-192.168.1.1/require;
spdadd 0.0.0.0/0 192.168.1.3 any -P in ipsec
esp/tunnel/192.168.1.1-192.168.1.3/require;
</pre>
IPsec configuration on gateway:
<pre>
spdadd 0.0.0.0/0 192.168.1.0/24 any -P out ipsec
esp/tunnel/192.168.1.1-192.168.1.3/require;
spdadd 192.168.1.0/24 0.0.0.0/0 any -P in ipsec
esp/tunnel/192.168.1.3-192.168.1.1/require;
</pre>
</p>

<h3>Performance</h3>

<p>According to <a href="#tab:perf_meas">table</a> on any reasonably new machine the performance is rather limited by 802.11b maximum connection speed of 11 Mbps.</p>

<h2>Road-Warrior scenario for securing of traffic out of internal network</h2>

<h3>Setup</h3>

<p>
Gateway configuration can look in similar way as shown in <a
href="obr:testbed03">picture</a>. Namely:
<ul>
   <li>Internal network connected behind the wireless connection is
   192.168.1.0/24</li> 
   <li>We want to have encrypted only the outbound
   traffic going through the wireless connection</li> 
   <li>Gateway A
   from internal network has address 192.168.1.3 (this gateway acts as
   one endpoint of IPsec tunnel)</li> 
   <li>Access-point has address
   192.168.1.2 (if we want to talk to access-point we don't want to use
   IPsec since access-point doesn't understand IPsec)</li> 
   <li>Gateway
   B located behind the access-point from the internal network view has
   address 192.168.1.1 (this gateway acts as the other endpoint of
   IPsec tunnel; it can perform NAT and other services for
   masquerading and routing of internal network)</li>
</ul>
</p>

<p>
<obr src="testbed03" id="obr:testbed03">Road-Warrior scenario for client security testbed setup</obr>
</p>

<p>Configuration for gateway A:
<pre>
spdadd 192.168.1.3 192.168.1.1 any -P out ipsec
esp/tunnel/192.168.1.3-192.168.1.1/require;
spdadd 192.168.1.1 192.168.1.3 any -P in ipsec
esp/tunnel/192.168.1.1-192.168.1.3/require;
spdadd 192.168.1.3 192.168.1.0/24 any -P out none;
spdadd 192.168.1.0/24 192.168.1.3 any -P in none;
spdadd 192.168.1.3 0.0.0.0/0 any -P out ipsec
esp/tunnel/192.168.1.3-192.168.1.1/require;
spdadd 0.0.0.0/0 192.168.1.3 any -P in ipsec
esp/tunnel/192.168.1.1-192.168.1.3/require;
</pre>
Configuration for gateway B:
<pre>
spdadd 0.0.0.0/0 192.168.1.3 any -P out ipsec
esp/tunnel/192.168.1.1-192.168.1.3/require;
spdadd 192.168.1.3 0.0.0.0/0 any -P in ipsec
esp/tunnel/192.168.1.3-192.168.1.1/require;
</pre>
</p>


<h1>Interoperability issues</h1>

<h2>Windows~2000</h2>

<h3>Native Windows~2000 IPsec</h3>

<p>First I have tested Windows~2000 native implementation of
IPsec. This implementation features both transport and tunnel
mode. When configuring tunnel mode I would recommend to follow
guidelines described in Microsoft Knowledge Base article<cite
href="6"/>.</p>

<p>I have tested both transport and tunnel mode successfully. The only
deficiency I have found is that it is not allowed to specify
0.0.0.0/0 as outbound traffic destination and inbound traffic source
while using tunnel mode, i.e. this implementation does not fit info
Road-Warrior for client security scenario<footnote>It is required to
specify network source/destination and its mask at least according to
A/B/C network specification, i.e. netmask for network 124.0.0.1 has to
be at least 255.0.0.0.</footnote>.</p>

<h3>PGPnet</h3>

<p>I have tested PGPnet that comes with free version of PGP 7.0.3 <cite
href="12"/>. This free version of PGPnet
doesn't fit into Road-Warrior scenario for it runs only in transport
mode. According to help information included with the free version
commercial version could solve this<footnote>According to documentation
which seems to be common for both free and commercial versions there
is some feature called gateway that should be able to run in tunnel
mode.</footnote>.</p>

<p>PGPnet also suffers from severe problems with changing network interfaces
which is quite usual situation in mobile computing. Generally I would
recommend using native Windows~2000 implementation.</p>


<h1>Conclusions</h1>

<p>I have suggested and tested several IPsec based security models for last mile
connectivity. I has been shown that for 802.11b networks the performance is limited by bandwith and not by IPsec processing demands.</p>

<seznamknih>

<kniha id="1">IP Security Protocol,<br/>
<adresa>http://www.ietf.org/ids.by.wg/ipsec.html</adresa>,<br/>
<adresa>http://www.ietf.org/html.charters/ipsec-charter.html</adresa></kniha>

<kniha id="2">Kame Project,<br/>
<adresa>http://www.kame.net/</adresa></kniha>

<kniha id="3">FreeS-WAN Project,<br/>
<adresa>http://www.freeswan.org/</adresa></kniha>

<kniha id="4">FreeBSD IPsec mini-HOWTO,<br/>
<adresa>http://www.x-itec.de/projects/tuts/ipsec-howto.txt</adresa></kniha>

<kniha id="5">Step-by-Step Guide to Internet Protocol Security (IPSec),<br/>
<adresa>http://www.microsoft.com/windows2000/techinfo/planning/security/ipsecsteps.asp</adresa></kniha>

<kniha id="6">How to Configure IPSec Tunneling in Windows 2000,<br/>
<adresa>http://support.microsoft.com/support/kb/articles/q252/7/35.asp</adresa></kniha>

<kniha id="7">Stein J., <i>Replacing WEP With IPsec</i>,<br/>
<adresa>http://rt.fm/~jcs/ipsec_wep.html</adresa></kniha>

<kniha id="8">Security of the WEP algorithm,<br/>
<adresa>http://www.isaac.cs.berkeley.edu/isaac/wep-faq.html</adresa></kniha>

<kniha id="9">DeGraw-Bertsch M., <i>IPsec Tunneling Between FreeBSD
Hosts</i>,<br/>
OnLamp, O'Reilly Network, 12/10/2001.<br/>
<adresa>http://www.onlamp.com/pub/a/bsd/2001/12/10/ipsec.html</adresa></kniha>

<kniha id="10">Rudolf V., Cizek J., <i>IPSec pro IPv4 v Linuxu</i>,<br/>
technical report 7/2000, CESNET (Czech only)<br/>
<adresa>http://www.cesnet.cz/doc/techzpravy/2000-7/</adresa></kniha>

<kniha id="11">VPN through IPSec protocol Howto,<br/>
<adresa>http://www.toxiclinux.org/vpn.html</adresa></kniha>

<kniha id="12">Pretty Good Privacy -- PGP,<br/>
<adresa>http://www.pgpi.org/</adresa></kniha>

</seznamknih>


</zprava>








