<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Paulo Nobre &#187; Openswan</title>
	<atom:link href="http://www.paulonobre.net/categories/openswan/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.paulonobre.net</link>
	<description></description>
	<lastBuildDate>Mon, 08 Feb 2010 23:42:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Setting up IPSEC/L2TP with NAT-T (Windows Client)</title>
		<link>http://www.paulonobre.net/2010/01/19/setting-up-ipsec-l2tp-vpn-windows-client-with-nat-t/</link>
		<comments>http://www.paulonobre.net/2010/01/19/setting-up-ipsec-l2tp-vpn-windows-client-with-nat-t/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 10:17:39 +0000</pubDate>
		<dc:creator>Paulo Nobre</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Openswan]]></category>
		<category><![CDATA[linux openswan vpn]]></category>

		<guid isPermaLink="false">http://www.paulonobre.net/2010/01/19/setting-up-ipsec-l2tp-vpn-windows-client-with-nat-t/</guid>
		<description><![CDATA[After setting up openswan on linux server, it’s time to configure a Windows Client to connect using x.509 certificates. This is a short article describing only the high level steps, going into further detail only where it has been more dificult. 
The steps described apply to Windows 7. I haven’t tried on any other versions [...]]]></description>
			<content:encoded><![CDATA[<p>After setting up openswan on linux server, it’s time to configure a Windows Client to connect using x.509 certificates. This is a short article describing only the high level steps, going into further detail only where it has been more dificult. </p>
<p>The steps described apply to Windows 7. I haven’t tried on any other versions of windows, but at least the registry keys probably changed from older versions.</p>
<p>First we have to import the Client certificate, which was signed by a CA trusted by the server (might even be our own CA, but in that case we must either export the CA certificate together with the client certificate itself or export only the CA certificate and import it into the client). Importing the certificate by double click won’t work. Windows will import your certificate into a “User store” and that won’t work.</p>
<p>Instead open management console (start, run, mmc) and choose File-&gt; Add/Remove snap-in… from the list presented, choose Certificates, and then “Computer Account”, so we can manage certificates globally for this computer and IP Security Policy Management. Now, expand Certificates (Local Computer), right click on Personal and choose All Tasks –&gt; Import. If the CA root certificate was imported together with the Client certificate, move it to Trusted Root Certification Authorities-&gt;Certificates.</p>
<p>Now right click on IP Security Policies on Local Computer, and choose Create IP Security Policy. Give it a name and continue to the end, leaving the “Edit Properties” checkbox checked. On the rules tab, select the default IP security rule and click edit. Go to the Authentication Methods tab, remove the kerberos method and click add. Choose “Use a certificate from this certification authority (CA) and browse to your root CA certificate. Press ok a couple of times to close all of the open windows. Right click the policy created and choose assign.</p>
<p>Now, both the server and the client are behind NAT, and that isn’t supported in windows since Windows XP SP2. Microsoft claim’s it’s not secure (LOL). Ok, we believe that, but we need our vpn to be accessible Fire up regedit and go to <strong>HLKM\System\CurrentControlSet\services\PolicyAgent</strong> and create a 32-bit dword key named <strong>AssumeUDPEncapsulationContextOnSendRule</strong>. Give it the value 2 (both client and server are behind nat). Google for other values. This same key, with the same value should also be created under <strong>HKLM\System\CurrentControlSet\services\IPSec</strong>. Reboot. Restarting the policy agent service,&#160; as I’ve seen in some pages, won’t work. Now, hopefully everything works as expected and Windows 7 client behind NAT can connect to openswan, also behind NAT, using certificates.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.paulonobre.net/2010/01/19/setting-up-ipsec-l2tp-vpn-windows-client-with-nat-t/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up IPSEC/L2TP with NAT-T (Server)</title>
		<link>http://www.paulonobre.net/2010/01/18/setting-up-ipsec-l2tp-vpn-server-with-nat-t/</link>
		<comments>http://www.paulonobre.net/2010/01/18/setting-up-ipsec-l2tp-vpn-server-with-nat-t/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 00:38:37 +0000</pubDate>
		<dc:creator>Paulo Nobre</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Openswan]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[vpn]]></category>

		<guid isPermaLink="false">http://www.paulonobre.net/2010/01/18/setting-up-ipsec-l2tp-vpn-server-with-nat-t/</guid>
		<description><![CDATA[Since my last post, I’ve been a little busy with some projects. In my spare time, I was getting gentoo installed and configured in a spare mac mini I have at home. Yes, I’m a geek and gentoo is my favorite Linux distro.
I don’t think of my self as a security paranoid guy (if someone [...]]]></description>
			<content:encoded><![CDATA[<p align="justify">Since my last post, I’ve been a little busy with some projects. In my spare time, I was getting <a href="http://www.gentoo.org" target="_blank">gentoo</a> installed and configured in a spare mac mini I have at home. Yes, I’m a geek and <a href="http://www.gentoo.org" target="_blank">gentoo</a> is my favorite Linux distro.</p>
<p>I don’t think of my self as a security paranoid guy (if someone possesses the knowledge and wants to hack you, he/she will hack you anyway, unless you aren’t connected to the net) , however, whenever i see my apache logs and find out some guys where scanning it for phpmyadmin (DISCLAIMER: I DON’T FUCKING USE PHPMYADMIN !!!!! I USE mysql –u someuser –p somedatabasename !!!!) I freak out. Anyway, I decided to access my home network using a vpn. First I’ve tried OpenVPN, but I just found out it’s too slow (beside having to install some client on windows). </p>
<p>After a week tweaking ipsec.conf settings, you’ll laugh at the the end of this article, but (at least for future reference) I’ll describe the (hopefully less) painful steps to get this configuration working in <a href="http://www.gentoo.org" target="_blank">gentoo</a>.</p>
<p>Before start I definitely recommend you get your hands on <a href="http://www.packtpub.com/openswan/book" target="_blank">this book</a>. It’s very helpful and&#160; you’ll get to understart the nitty-gritty details of openswan and the ipsec protocol (among others).</p>
<p><strong>Configuring your kernel: </strong></p>
<p>If you don’t have it done already compile your kernel with ipsec, ah and esp transformation, netfilter and ppp. Also, on cryptographic options, turn on Cryptographic APICompile it and install. Reboot and verify everything works as expected. These were the specific options I selected (among with other I had already selected) on my kernel’s configuration: </p>
<p>Networking support&#160; &#8212;&gt;    <br />&#160;&#160; Networking options&#160; &#8212;&gt;     <br />&#160;&#160;&#160;&#160;&#160; &lt;*&gt; PF_KEY socket&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160; [*] TCP/IP networking     <br />&#160;&#160;&#160;&#160;&#160; &lt;*&gt;&#160;&#160; IP: AH transformation     <br />&#160;&#160;&#160;&#160;&#160; &lt;*&gt;&#160;&#160; IP: ESP transformation     <br />&#160;&#160;&#160;&#160;&#160; &lt;*&gt;&#160;&#160; IP: IPComp transformation     <br />&#160;&#160;&#160;&#160;&#160; &lt;*&gt;&#160;&#160; IP: IPsec transport mode     <br />&#160;&#160;&#160;&#160;&#160; &lt;*&gt;&#160;&#160; IP: IPsec tunnel mode </p>
<p>&#160;&#160; Device Drivers &#8212;&gt;    <br />&#160;&#160;&#160;&#160;&#160; [*] Network device support&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;*&gt; PPP (point-to-point protocol) support     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;*&gt;&#160;&#160; PPP support for async serial ports     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;*&gt;&#160;&#160; PPP support for sync tty ports     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;*&gt;&#160;&#160; PPP Deflate compression&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;*&gt;&#160;&#160; PPP BSD-Compress compression     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;*&gt;&#160;&#160; PPP over Ethernet (EXPERIMENTAL)     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;*&gt;&#160;&#160; PPP over L2TP (EXPERIMENTAL)     <br />&#160;&#160;&#160;&#160;&#160; Character devices&#160; &#8212;&gt;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; -*- Unix98 PTY support </p>
<p>&#160;&#160; Cryptographic API &#8212;&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;*&gt; Null Algorithms     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; -*- HMAC support     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; -*- MD5 digest algorithm     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; -*- SHA1 digest algorithm     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; -*- AES chiper algorithms     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; -*- DES and Triple DES EDE cipher algorithms     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; -*- Deflate compression algorithm     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;*&gt; Zlib compression algorithm     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;*&gt; LZO compression algorithm&#160;&#160;&#160; </p>
<p>After reboot, everything was working, so I emerged openswan, ppp, xl2tp and ipsec-tools packages. I had to unmask ipsec-tools.</p>
<p>echo &quot;net-firewall/ipsec-tools ~x86&quot; &gt;&gt; /etc/portage/package.keywords</p>
<p>Also, during emerge ipsec-tools, I got some error about swab.h not being found on my system (I’m running 2.6.31 kernel, and don’t know why, but portage only had 2.6.27 linux headers. I solved this problem creating a symlink from /usr/src/linux/arch/x86/include/asm/swab.h to /usr/include/asm/swab.h</p>
<p># ln -s /usr/src/linux/arch/x86/include/asm/swab.h /usr/include/asm/swab.h    <br /># emerge -av net-firewall/ipsec-tools     <br /># rm /usr/include/asm/swab.h </p>
<p>After emerge completed successfully, I removed the symlink.</p>
<p>As stated on <a href="http://www.packtpub.com/openswan/book" target="_blank">openswan book</a> I turned on ip forward, and turned off send redirects and accept redirects. On gentoo you can edit /etc/sysctl.conf and set the default options there.</p>
<p>All my certificate stuff was generated as explained on the book and my configuration was almost verbatim the book’s examples (leftnexthop on ipsec.conf is the nat gateway’s ip address): </p>
<p><strong>/etc/ipsec/ipsec.conf</strong>:</p>
<p>version 2.0</p>
<p>config setup    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; nat_traversal=yes     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; nhelpers=0     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; plutodebug=&quot;control parsing&quot;</p>
<p>conn L2TP-X509    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; authby=rsasig     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; pfs=no     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; rekey=no     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; keyingtries=3     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; left=%defaultroute     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; leftprotoport=17/1701     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; leftrsasigkey=%cert     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; leftcert=servercert.pem     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; leftnexthop=192.168.112.1     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; right=%any     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; rightprotoport=17/%any     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; rightrsasigkey=%cert     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; auto=add     </p>
<p><strong>/etc/xl2tpd/xl2tpd.conf:</strong></p>
<p>[global]    <br />listen-addr = 192.168.112.128</p>
<p>[lns default]    <br />ip range = 192.168.112.241-192.168.112.254     <br />local ip = 192.168.112.240     <br />require chap = yes     <br />refuse pap = yes     <br />require authentication = yes     <br />name = test     <br />ppp debug = yes     <br />pppoptfile = /etc/ppp/options.l2tpd     <br />length bit = yes</p>
<p><strong>/etc/ppp/options.l2tpd:</strong></p>
<p>ipcp-accept-local    <br />ipcp-accept-remote     <br />ms-dns 192.168.112.1     <br />noccp     <br />auth     <br />crtscts     <br />idle 1800     <br />mtu 1200     <br />mru 1200     <br />nodefaultroute     <br />debug     <br />lock     <br />proxyarp     <br />connect-delay 5000     </p>
<p><strong>/etc/ppp/chap-secrets</strong></p>
<p>vpnuser&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; *&#160;&#160;&#160;&#160;&#160; vPnP@ssVVd1234&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 192.168.112.241/28</p>
<p>(it’s obvious this username and password doesn’t work on my real vpn setup, it’s just an example).</p>
<p>And that was the openswan setup. After that I started openswan, and added it to the default runlevel. On my next article (hopefully shorter than this one, I’ll describe the windows client setup).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.paulonobre.net/2010/01/18/setting-up-ipsec-l2tp-vpn-server-with-nat-t/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
