<?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>Nejko's randomness</title>
	<atom:link href="http://nejc.skoberne.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://nejc.skoberne.net</link>
	<description>Random thoughts with high entropy</description>
	<lastBuildDate>Fri, 30 Mar 2012 10:58:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>MikroTik SSTP with Windows SBS 2008 NPS (RADIUS)</title>
		<link>http://nejc.skoberne.net/2011/03/mikrotik-sstp-with-windows-sbs-2008-nps-radius/</link>
		<comments>http://nejc.skoberne.net/2011/03/mikrotik-sstp-with-windows-sbs-2008-nps-radius/#comments</comments>
		<pubDate>Thu, 17 Mar 2011 10:31:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[undef]]></category>

		<guid isPermaLink="false">http://nejc.skoberne.net/?p=182</guid>
		<description><![CDATA[Not many people know, that Windows Vista and Windows 7 now support another VPN type called SSTP, which is a kind of SSL VPN. This very useful because a secure L2TP can be somewhat difficult to configure since IPsec has to be configured as well. PPTP is neither secure nor does it pass NATs very [...]]]></description>
			<content:encoded><![CDATA[<p>Not many people know, that Windows Vista and Windows 7 now support another VPN type called <a class="zem_slink" title="Secure Socket Tunneling Protocol" rel="wikipedia" href="http://en.wikipedia.org/wiki/Secure_Socket_Tunneling_Protocol">SSTP</a>, which is a kind of SSL VPN. This very useful because a secure L2TP can be somewhat difficult to configure since IPsec has to be configured as well. PPTP is neither secure nor does it pass NATs very well since it leverages GRE protocol. SSTP, on ther other hand, uses HTTPS protocol, so it is easy to configure (well, you still need at least a server certificate) and it passes the NATs very well as all other &#8220;nice&#8221; TCP protocols.</p>
<p>Recent versions of <a class="zem_slink" title="MikroTik" rel="homepage" href="http://www.mikrotik.com/">RouterOS</a> (5.X) also support SSTP, so coupling it with Windows <a class="zem_slink" title="RADIUS" rel="wikipedia" href="http://en.wikipedia.org/wiki/RADIUS">RADIUS server</a>, this becomes an easy VPN solution for SMBs. In this post I will show how this can be done.</p>
<h2>MikroTik part</h2>
<p>First, you create an IP pool for SSTP IP address assignments:</p>
<pre>/ip pool add name=sstp-pool ranges=192.168.1.100-192.168.1.150</pre>
<p>Then, you add a SSTP profile:</p>
<pre>/ppp profile add dns-server=8.8.8.8 local-address=192.168.0.1 \
name=sstp remote-address=sstp-pool use-encryption=yes use-ipv6=yes</pre>
<p>Now its time to configure certificates for SSTP server. You can use <a class="zem_slink" title="StartCom" rel="homepage" href="http://www.startcom.org/">StartSSL</a> to get free browser-approved SSL certificates. You will need 4 files:</p>
<ul>
<li><strong>ca.pem</strong> (StartSSL Root CA) &#8211; you get this one at StartSSL</li>
<li><strong>sub.class1.server.ca.pem</strong> (Class 1 Server SubCA) &#8211; you get this one at StartSSL</li>
<li><strong>your.mikrotik.pem</strong> (public certificate)</li>
<li><strong>your.mikrotik.key</strong> (private key)</li>
</ul>
<p>You have to import these files by copying them to your MikroTik device (either via WinBox drag &amp; drop into &#8220;Files&#8221; window or via FTP) and then doing something like:</p>
<pre>/certificate import file-name=ca.pem
/certificate import file-name=sub.class1.server.ca.pem
/certificate import file-name=your.mikrotik.pem
/certificate import file-name=your.mikrotik.key</pre>
<p>Except for <em>your.mikrotik.key</em>, you just hit ENTER when you are asked about the &#8220;passphrase&#8221;. For <em>your.mikrotik.key</em>, you must enter your private key password, if the key is encrypted. If it is not, you can just hit ENTER as well.</p>
<p>Now you can just do some configuration on this certificates you just imported:</p>
<pre>/certificate set cert1 name="StartSSL CA"
/certificate set cert2 name="StartSSL Class 1 Server SubCA"
/certificate set cert3 ca=no
/certificate set cert3 name="your.mikrotik"</pre>
<p>Now you can configure the SSTP server interface:</p>
<pre>/interface sstp-server server set authentication=mschap1,mschap2 \
certificate=your.mikrotik default-profile=sstp enabled=yes</pre>
<p>If you are unable to use port 443 for SSTP, you can use &#8220;port=&#8221; option in the command above to define the listening port. Don&#8217;t forget to open this port on the firewall (on the INPUT chain) if you are blocking ports by default.</p>
<p>Enable RADIUS authentication for PPP:</p>
<pre>/ppp aaa set use-radius=yes</pre>
<p>And configure the RADIUS client:</p>
<pre>/radius add address=192.168.0.2 called-id="" disabled=no \
domain=YOURDOMAIN secret=yoursecret service=ppp</pre>
<p>Don&#8217;t forget to change the IP address to the IP address of your RADIUS server. The same goes for <em>YOURDOMAIN</em> and <em>yoursecret</em>.</p>
<h2>Windows part</h2>
<p>Last time I was configuring MikroTik to authenticate users I was using Windows 2003 Server and its IAS. However, in Windows 2008 this is now called Network Policy Server and it didn&#8217;t work for me until I changed some default configuration options. So this is how I did it.</p>
<p>First, make sure the Network Policy Server (NPS) role is added. If not, add it, its very <a href="http://aaronwalrath.wordpress.com/2010/06/22/install-windows-2008-r2-nps-for-radius-authentication-for-cisco-router-logins/">straightforward</a>. Then, open the NPS management console and click the root node in the left pane (it&#8217;s called &#8220;NPS (Local)&#8221; on my server). Then, just use the wizard to configure the RADIUS server for VPN:</p>
<ol>
<li>Select &#8220;RADIUS server for Dial-Up or VPN Connections&#8221; as the configuration scenario and click &#8220;Configure VPN or Dial-Up&#8221;.</li>
<li>Choose &#8220;Virtual Private Network (VPN) Connections&#8221; as &#8220;Types of connections&#8221;. (You can also change the policy name, but that&#8217;s completely optional.)</li>
<li>Now you have to add a RADIUS client. Click Add and then choose a friendly name for your MikroTik here and write in its (local) IP address. Also, put in the secret you configured it before on MikroTik (yoursecret, remember?).</li>
<li>When choosing the Authentication Methods, I chose also MS-CHAP (v1), but perhaps leaving only MS-CHAPv2 selected will also work (I haven&#8217;t tried), since MikroTik should support it as well.</li>
<li>Now add the user group, which will contain those users who can authenticate for this VPN connection.</li>
<li>You can easily leave out the IP filters.</li>
<li>You can probably disable 40 and 56-bit encryption, but I didn&#8217;t try that.</li>
<li>You don&#8217;t need to configure the realm name, just skip it.</li>
<li>That&#8217;s it!</li>
</ol>
<p><strong>Now to the tricky part:</strong></p>
<ol>
<li>In the left pane, go to Policies, Connection Request Policies. Double click the &#8220;Virtual Private Network (VPN) Connections&#8221; policy (or whatever you named your policy above). Now set the &#8220;Type of network access server&#8221; to &#8220;Unspecified&#8221;. Also, you have to go to the Conditions tab. Edit the entry (it should be a NAS Port Type condition entry) and change it from &#8220;Virtual (VPN)&#8221; to &#8220;Async (Modem)&#8221; (deselect &#8220;Virtual&#8221; and select only &#8220;Async&#8221;).</li>
<li>Do the same for the Network policy with the same name (Policies, Network Policies). I also set the order of the network policy to be the second (right after General Connection Authorization Policy), but I am not sure if this is needed.</li>
</ol>
<p><strong>WARNING: </strong>I have figured out, that configuring these options is somewhat nondeterministic. This means, that it just didn&#8217;t work some times and I had to configure the &#8220;Type of network access server&#8221; back to &#8220;Remote Access Server (VPN-Dial up) and after that back to &#8220;Unspecified&#8221;. And this time it worked. It appears to me as a bug, but maybe its just me being unfamiliar with Microsoft way of thinking. :)</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=b14565d9-fef2-483b-b970-51125dfd6c72" alt="Enhanced by Zemanta" /></a></div>
]]></content:encoded>
			<wfw:commentRss>http://nejc.skoberne.net/2011/03/mikrotik-sstp-with-windows-sbs-2008-nps-radius/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>TAYGA: Simple, no-fuss NAT64 for Linux</title>
		<link>http://nejc.skoberne.net/2011/02/tayga-simple-no-fuss-nat64-for-linux/</link>
		<comments>http://nejc.skoberne.net/2011/02/tayga-simple-no-fuss-nat64-for-linux/#comments</comments>
		<pubDate>Wed, 23 Feb 2011 10:46:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[undef]]></category>

		<guid isPermaLink="false">http://nejc.skoberne.net/?p=176</guid>
		<description><![CDATA[Yesterday, I tried TAYGA, which is a stateless NAT64 (SIIT actually) userland implementation for Linux. It works pretty well, since it can leverage any &#8220;classical&#8221; NAT44 implementation to do the stateful part, which is probably what a NAT64 deployer will want to have. So I installed TAYGA on a virtualized Debian 6.0 box where I [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday, I tried <a href="http://www.litech.org/tayga/" target="_blank">TAYGA</a>, which is a stateless NAT64 (<a class="zem_slink" title="IPv6 transition mechanisms" rel="wikipedia" href="http://en.wikipedia.org/wiki/IPv6_transition_mechanisms">SIIT</a> actually) userland implementation for Linux. It works pretty well, since it can leverage any &#8220;classical&#8221; NAT44 implementation to do the stateful part, which is probably what a NAT64 deployer will want to have.</p>
<p>So I installed TAYGA on a virtualized <a class="zem_slink" title="Debian" rel="homepage" href="http://www.debian.org/">Debian</a> 6.0 box where I also installed Ecdysis&#8217; DNS64 implementation, which is actually a patched <a class="zem_slink" title="BIND" rel="homepage" href="http://www.isc.org/software/bind">BIND</a>.</p>
<p>I just followed the instructions on TAYGA web page and everything went smoothly except for the <a class="zem_slink" title="IPv6" rel="wikipedia" href="http://en.wikipedia.org/wiki/IPv6">IPv6</a> prefix setup. TAYGA says it can use IPv6 prefixes of any length, which is allowed by <a class="zem_slink" title="Request for Comments" rel="wikipedia" href="http://en.wikipedia.org/wiki/Request_for_Comments">RFC</a> 6052. So first I tried to use my <a class="zem_slink" title="Hurricane Electric" rel="homepage" href="http://www.he.net/">Hurricane Electric</a> assigned /64 prefix (part of my /48 allocation), and it failed to work, at least with DNS64 from Ecdysis. I haven&#8217;t tried TOTD (yet), which is mentioned in the instructions, so this might be causing the troubles. However, after I changed the prefix length to /96 both in BIND and in TAYGA configuration, I was finnaly able to connect to the IPv4 world from the IPv6-only machines.</p>
<p>I think that this kind of stateless NAT64 is quite useful and very easy to deploy (especially for smaller environments). The only &#8220;quirk&#8221; is in that you have to use a special pool of IPv4 addresses, which TAYGA uses for its temporary (you can make them static as well) 1-to-1 IPv6-to-IPv4 mappings. However, since these IPv4 addresses are only &#8220;visible&#8221; to the NAT64 gateway (if you are running NAT44 on the same box), I can&#8217;t see why this would be a significant problem at all.</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=79c9f0fb-5595-49ba-8583-08d5251be06f" alt="Enhanced by Zemanta" /></a></div>
]]></content:encoded>
			<wfw:commentRss>http://nejc.skoberne.net/2011/02/tayga-simple-no-fuss-nat64-for-linux/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>phpBB: Export all posts for a user into a file</title>
		<link>http://nejc.skoberne.net/2011/02/phpbb-export-all-posts-for-a-user-into-a-file/</link>
		<comments>http://nejc.skoberne.net/2011/02/phpbb-export-all-posts-for-a-user-into-a-file/#comments</comments>
		<pubDate>Sun, 13 Feb 2011 23:58:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://nejc.skoberne.net/?p=164</guid>
		<description><![CDATA[Few days ago, one of the users of the phpBB-based forum I administer, asked if he could have all his posts (few hundreds of them) exported as text and delivered via e-mail. After a quick Google search, I could find any such script, so I created my own. I wrote it in Python and the [...]]]></description>
			<content:encoded><![CDATA[<p>Few days ago, one of the users of the phpBB-based forum I administer, asked if he could have all his posts (few hundreds of them) exported as text and delivered via e-mail. After a quick Google search, I could find any such script, so I created my own. I wrote it in Python and the only requirement is that you have MySQLdb Python module installed (python-mysqldb in Debian).</p>
<p>Here it goes (I am a Python beginner, so beware):</p>
<div class="codecolorer-container python default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="python codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #808080; font-style: italic;">#!/usr/bin/python</span><br />
<br />
<span style="color: #ff7700;font-weight:bold;">import</span> MySQLdb<br />
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">time</span><br />
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">re</span><br />
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">getopt</span><br />
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span><br />
<br />
<span style="color: #ff7700;font-weight:bold;">def</span> usage<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'Usage: PhpbbExportPosts.py [options]'</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'Obligatory arguments:'</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">' &nbsp;DBHOST: MySQL database hostname'</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">' &nbsp;DBUSER: MySQL database user<span style="color: #000099; font-weight: bold;">\'</span>s username'</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">' &nbsp;DBPASS: MySQL database user<span style="color: #000099; font-weight: bold;">\'</span>s password'</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">' &nbsp;DBNAME: MySQL database name of phpBB'</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">' &nbsp;POSTER: Username of the author of the posts to be exported'</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'Options:'</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">' &nbsp;--prefix=PREFIX<span style="color: #000099; font-weight: bold;">\t</span>Table name prefix (default: phpbb_)'</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">' &nbsp;--file=FILE<span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span>Output file name (default: none (stdout))'</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">' &nbsp;--help<span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span>Print this help'</span><br />
<br />
<span style="color: #ff7700;font-weight:bold;">def</span> main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;"># Finish at once if there are to few arguments</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: black;">&#40;</span><span style="color: #008000;">len</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#41;</span> <span style="color: #66cc66;">&lt;</span> <span style="color: #ff4500;">6</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; usage<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #dc143c;">sys</span>.<span style="color: black;">exit</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;"># (Try to) parse the options</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">try</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; opts<span style="color: #66cc66;">,</span> args <span style="color: #66cc66;">=</span> <span style="color: #dc143c;">getopt</span>.<span style="color: #dc143c;">getopt</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">6</span>:<span style="color: black;">&#93;</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'pfh'</span><span style="color: #66cc66;">,</span> <span style="color: black;">&#91;</span><span style="color: #483d8b;">'prefix='</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'file='</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'help'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">except</span> <span style="color: #dc143c;">getopt</span>.<span style="color: black;">GetoptError</span><span style="color: #66cc66;">,</span> err:<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>err<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; usage<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #dc143c;">sys</span>.<span style="color: black;">exit</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;"># Set options defaults</span><br />
&nbsp; &nbsp; <span style="color: #008000;">file</span> <span style="color: #66cc66;">=</span> <span style="color: #008000;">None</span><br />
&nbsp; &nbsp; prefix <span style="color: #66cc66;">=</span> <span style="color: #483d8b;">'phpbb_'</span><br />
<br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;"># Set the variables regarding to the options</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">for</span> o<span style="color: #66cc66;">,</span> a <span style="color: #ff7700;font-weight:bold;">in</span> opts:<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> o <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: black;">&#40;</span><span style="color: #483d8b;">'-h'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'--help'</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; usage<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #dc143c;">sys</span>.<span style="color: black;">exit</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">elif</span> o <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: black;">&#40;</span><span style="color: #483d8b;">'-p'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'--prefix'</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prefix <span style="color: #66cc66;">=</span> a<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">elif</span> o <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: black;">&#40;</span><span style="color: #483d8b;">'-f'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'--file'</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">file</span> <span style="color: #66cc66;">=</span> a<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">else</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">assert</span> <span style="color: #008000;">False</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">&quot;Unhandled option&quot;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;"># Establish connection to MySQL</span><br />
&nbsp; &nbsp; conn<span style="color: #66cc66;">=</span>MySQLdb.<span style="color: black;">connect</span><span style="color: black;">&#40;</span>host<span style="color: #66cc66;">=</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span><span style="color: #66cc66;">,</span><span style="color: #dc143c;">user</span><span style="color: #66cc66;">=</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span><span style="color: #66cc66;">,</span> \<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;passwd<span style="color: #66cc66;">=</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">3</span><span style="color: black;">&#93;</span><span style="color: #66cc66;">,</span>db<span style="color: #66cc66;">=</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">4</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;"># Set character set to UTF-8, which should be correct for phpBB</span><br />
&nbsp; &nbsp; conn.<span style="color: black;">set_character_set</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'utf8'</span><span style="color: black;">&#41;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;"># Get a database cursor and set UTF-8 everywhere where possible</span><br />
&nbsp; &nbsp; cursor <span style="color: #66cc66;">=</span> conn.<span style="color: black;">cursor</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; cursor.<span style="color: black;">execute</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;SET NAMES utf8;&quot;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; cursor.<span style="color: black;">execute</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;SET CHARACTER SET utf8;&quot;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; cursor.<span style="color: black;">execute</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;SET character_set_connection=utf8;&quot;</span><span style="color: black;">&#41;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;"># Run the MySQL query to get all the posts of the selected poster</span><br />
&nbsp; &nbsp; cursor.<span style="color: black;">execute</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;SELECT a.post_time, a.post_subject, a.post_text <span style="color: #000099; font-weight: bold;">\</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FROM &quot;</span> + prefix + <span style="color: #483d8b;">&quot;posts a, &quot;</span> + prefix + <span style="color: #483d8b;">&quot;users b <span style="color: #000099; font-weight: bold;">\</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WHERE a.poster_id=b.user_id <span style="color: #000099; font-weight: bold;">\</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AND b.username='&quot;</span> + <span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">5</span><span style="color: black;">&#93;</span> + <span style="color: #483d8b;">&quot;'&quot;</span><span style="color: black;">&#41;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;"># Open file for writing or use standard output</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">file</span> <span style="color: #ff7700;font-weight:bold;">is</span> <span style="color: #ff7700;font-weight:bold;">not</span> <span style="color: #008000;">None</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; output<span style="color: #66cc66;">=</span><span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #008000;">file</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'w'</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">else</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; output<span style="color: #66cc66;">=</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">stdout</span><br />
<br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;"># Print the formatted posts into a file one by one</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">while</span> <span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;"># Get the next post</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; row <span style="color: #66cc66;">=</span> cursor.<span style="color: black;">fetchone</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;"># Exit when there are no more posts</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> row <span style="color: #66cc66;">==</span> <span style="color: #008000;">None</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">break</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;"># Inter-post delimiter line</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; output.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'================================================================================<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: black;">&#41;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;"># Also remove all HTML tags with a regular expression</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; output.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Post date: %s<span style="color: #000099; font-weight: bold;">\n</span>Post subject: %s<span style="color: #000099; font-weight: bold;">\n</span>Post content:<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>%s<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>'</span> % <span style="color: black;">&#40;</span><span style="color: #dc143c;">time</span>.<span style="color: black;">ctime</span><span style="color: black;">&#40;</span>row<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">,</span> row<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span><span style="color: #66cc66;">,</span> <span style="color: #dc143c;">re</span>.<span style="color: black;">sub</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'&lt;.*&gt;'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">''</span><span style="color: #66cc66;">,</span> row<span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Number of posts exported: %d&quot;</span> % cursor.<span style="color: black;">rowcount</span><br />
<br />
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ <span style="color: #66cc66;">==</span> <span style="color: #483d8b;">&quot;__main__&quot;</span>:<br />
&nbsp; &nbsp; main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></div>
<p>Alternatively, you can download it from <a href="http://nejc.skoberne.net/transfer/PhpbbExportPosts.py" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nejc.skoberne.net/2011/02/phpbb-export-all-posts-for-a-user-into-a-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Two thirds of traffic is IPv6 traffic? I doubt it.</title>
		<link>http://nejc.skoberne.net/2011/02/two-thirds-of-traffic-is-ipv6-traffic-i-doubt-it/</link>
		<comments>http://nejc.skoberne.net/2011/02/two-thirds-of-traffic-is-ipv6-traffic-i-doubt-it/#comments</comments>
		<pubDate>Sun, 13 Feb 2011 00:17:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[undef]]></category>

		<guid isPermaLink="false">http://nejc.skoberne.net/?p=161</guid>
		<description><![CDATA[Yesterday I came back home from Paris, where I attended the V6 World Congress 2011. Since I am interested in IPv4-IPv6 transitioning mechanisms, I was looking forward to hear Jordi Palet Marinez&#8217;s talk on the tutorial day about them. During the talk, Jordi mentioned some interesting statistics &#8211; the percentage of IPv6 traffic on the [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I came back home from Paris, where I attended the V6 World Congress 2011. Since I am interested in IPv4-IPv6 transitioning mechanisms, I was looking forward to hear Jordi Palet Marinez&#8217;s talk on the tutorial day about them. During the talk, Jordi mentioned some interesting statistics &#8211; the percentage of IPv6 traffic on the Internet and the shares that Teredo and 6to4 have in this percentage. I can not recall the exact numbers, but it is interesting to me because I was planning to do exactly the same for my PhD research. I had this idea of trying to persuade various ISPs or Internet exchange points to let me plug my statistic-gathering equipment into their switches and gather information about which transitioning mechanisms are most used today and what are their respective shares of packets flowing through.</p>
<p>I talked to Jordi and he suggested to Google a bit about <strong>6meter</strong> &#8211; this is the software they used to measure traffic at various ISPs. One of them can be found <a href="http://www.afrinic.net/meeting/afrinic-8/presentations/6meter_v0_5.pdf" target="_blank">here</a>. Because the ISPs don&#8217;t like to give out their actual statistics, he has provide overall statistics only. However, I find the numbers very odd. Two thirds of the packets are IPv6 packets? Almost a half of the bytes are IPv6 bytes? I was talking to a few other people at the conference and they said that this is impossible or at least, that this is a very non-representative sample which can not be used to prove that the findings hold true for the whole Internet. The actual IPv6 packet/byte percentages should be a lot smaller than Jordi&#8217;s.</p>
<p>Anyway, I am very interested in this topic, so I am still trying to find any other similar published research. If you know of any, please let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://nejc.skoberne.net/2011/02/two-thirds-of-traffic-is-ipv6-traffic-i-doubt-it/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>IPv6 address database: ipv6list.com</title>
		<link>http://nejc.skoberne.net/2011/02/ipv6-address-database-ipv6list-com/</link>
		<comments>http://nejc.skoberne.net/2011/02/ipv6-address-database-ipv6list-com/#comments</comments>
		<pubDate>Fri, 11 Feb 2011 23:10:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://nejc.skoberne.net/?p=150</guid>
		<description><![CDATA[A few weeks ago I saw a presentation from van Hauser titled Recent advances in IPv6 insecurities. He merges three different sources of IPv6 addresses to obtain a database of IPv6 addresses: search engines and databases (directories), DNS (bruteforcing), common addresses. He shows that this method is quite successful for those who are interested in [...]]]></description>
			<content:encoded><![CDATA[<p>A few weeks ago I saw a <a title="Recent advances in IPv6 insecurities" href="http://vimeo.com/18318798" target="_blank">presentation</a> from van Hauser titled <em>Recent advances in IPv6 insecurities</em>. He merges three different sources of IPv6 addresses to obtain a database of IPv6 addresses:</p>
<ul>
<li>search engines and databases (directories),</li>
<li>DNS (bruteforcing),</li>
<li>common addresses.</li>
</ul>
<p>He shows that this method is quite successful for those who are interested in getting as many IPv6 addresses as possible. So I was thinking &#8211; why not put up a public databases of such addresses and provide a way for anybody to contribute them.</p>
<p>The main purpose of such database is to make IPv6 Internet a bit more &#8220;enumeratable&#8221; for those who would like doing any kind of research on the nature and behaviour of IPv6 Internet. Also, it may convince those who would like to not be listed (I guess for security through obscurity reasons) to actually renumber from &lt;prefix&gt;::1 to something else.</p>
<p>Of course, any ideas about other possible techniques for harvesting IPv6 addresses, are welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://nejc.skoberne.net/2011/02/ipv6-address-database-ipv6list-com/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>netfilter&#8217;s way of tracking ICMPv6 connections</title>
		<link>http://nejc.skoberne.net/2011/02/netfilters-way-of-tracking-icmpv6-connections/</link>
		<comments>http://nejc.skoberne.net/2011/02/netfilters-way-of-tracking-icmpv6-connections/#comments</comments>
		<pubDate>Fri, 11 Feb 2011 02:06:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://nejc.skoberne.net/?p=145</guid>
		<description><![CDATA[These days I am configuring a Debian-based firewall, whose iptables policy is being managed by Firewall Builder tool. Check it out, it&#8217;s a really cool, object-based firewall policy management tool. However, I was quite stumped when I realized that if I make an &#8220;allow all&#8221; mixed (IPv4/IPv6) policy, the ICMPv6 packets are not let through [...]]]></description>
			<content:encoded><![CDATA[<p>These days I am configuring a Debian-based firewall, whose iptables policy is being managed by Firewall Builder tool. Check it out, it&#8217;s a really cool, object-based firewall policy management tool.</p>
<p>However, I was quite stumped when I realized that if I make an &#8220;allow all&#8221; mixed (IPv4/IPv6) policy, the ICMPv6 packets are not let through the bridge (I am doing filtering on a bridge interface). This is not really intuitive, so I thought it must be some kind of bug. I still recall, that some time ago, netfilter had serious problems tracking IPv6 connections (it would match improperly match valid connections, which made it impossible to drop the packets, which matched INVALID state).</p>
<p>My rationale was: I should pass all IPv6 packets, which match NEW, RELATED or ESTABLISHED state in both directions and I should be fine. This is also what Firewall Builder generates. However, I found out that ICMPv6 packets other than PING (echo/reply) don&#8217;t match netfilter states at all! So that was why Firewall Builder&#8217;s policy wouldn&#8217;t let my ICMPv6 packets (e.g. neighbor discovery) through.</p>
<p>The solution is straightforward: make an additional &#8220;allow any&#8221; rule only for ICMPv6 packets and make it stateless. Firewall Builder nicely supports that, you can double click the Options column and check the &#8220;Stateless&#8221; check box.</p>
]]></content:encoded>
			<wfw:commentRss>http://nejc.skoberne.net/2011/02/netfilters-way-of-tracking-icmpv6-connections/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SharePoint Services 3.0 dead after applying KB983444</title>
		<link>http://nejc.skoberne.net/2010/10/sharepoint-services-3-0-dead-after-applying-kb983444/</link>
		<comments>http://nejc.skoberne.net/2010/10/sharepoint-services-3-0-dead-after-applying-kb983444/#comments</comments>
		<pubDate>Wed, 13 Oct 2010 12:01:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://nejc.skoberne.net/?p=140</guid>
		<description><![CDATA[I am not a Windows administrator, really. But I do take care of one Windows 2008 SBS machine and we have Exchange 2007 and SharePoint Services 3.0 installed. Recently, I installed a security update for Windows SharePoint Services 3.0 (KB983444). After rebooting, all my SharePoint sites were down (404 error). It took me quite a [...]]]></description>
			<content:encoded><![CDATA[<p>I am not a Windows administrator, really. But I do take care of one Windows 2008 SBS machine and we have Exchange 2007 and SharePoint Services 3.0 installed. Recently, I installed a security update for Windows SharePoint Services 3.0 (KB983444). After rebooting, all my SharePoint sites were down (404 error). It took me quite a few hours to put them back online. I did tried many things, among them:</p>
<ul>
<li>running SharePoint Products and Technologies Configuration Wizard, which failed at step 9/10,</li>
<li>running &#8220;<em>psconfig -cmd upgrade -inplace b2b -wait -force</em>&#8220;, which failed with various errors.</li>
</ul>
<p>Finally, I did this to solve the problem: I connected to Central Administration and then went to &#8220;Operations&#8221; tab. Then, I chose &#8220;Services on Server&#8221; and clicked &#8220;Windows SharePoint Services Search&#8221;. There, I entered my administrator account as the &#8220;Service Account&#8221;. I saved the changes and then rerun SharePoint Products and Technologies Configuration Wizard, which worked this time (although it took it very long time to do everything it had to do).</p>
]]></content:encoded>
			<wfw:commentRss>http://nejc.skoberne.net/2010/10/sharepoint-services-3-0-dead-after-applying-kb983444/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RCPFA 1.0.5 available</title>
		<link>http://nejc.skoberne.net/2009/02/rcpfa-105-available/</link>
		<comments>http://nejc.skoberne.net/2009/02/rcpfa-105-available/#comments</comments>
		<pubDate>Sat, 31 Jan 2009 23:05:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://nejc.skoberne.net/?p=123</guid>
		<description><![CDATA[The 1.0.5 version is out. It makes RCPFA compatible with RoundCube 0.2-stable. Thanks to Andrey Sharandakov!]]></description>
			<content:encoded><![CDATA[<p>The 1.0.5 version is <a href="http://nejc.skoberne.net/projects/rcpfa/" target="_self">out</a>. It makes RCPFA compatible with RoundCube 0.2-stable. Thanks to Andrey Sharandakov!</p>
]]></content:encoded>
			<wfw:commentRss>http://nejc.skoberne.net/2009/02/rcpfa-105-available/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>gmirror and gvinum on the same drives</title>
		<link>http://nejc.skoberne.net/2008/11/gmirror-and-gvinum-on-the-same-drives/</link>
		<comments>http://nejc.skoberne.net/2008/11/gmirror-and-gvinum-on-the-same-drives/#comments</comments>
		<pubDate>Sun, 30 Nov 2008 21:05:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[gmirror]]></category>
		<category><![CDATA[gvinum]]></category>
		<category><![CDATA[RAID]]></category>

		<guid isPermaLink="false">http://nejc.skoberne.net/?p=99</guid>
		<description><![CDATA[In 2006, when I was installing a FreeBSD server for our client, one of the requests was also a RAID-5 array of some kind. I checked out and discovered GEOM vinum (or gvinum), which provided what I needed at that time. It is a file server, but throughput is not a critical issue, so I [...]]]></description>
			<content:encoded><![CDATA[<p>In 2006, when I was installing a <a class="zem_slink" title="FreeBSD" rel="homepage" href="http://www.freebsd.org">FreeBSD</a> server for our client, one of the requests was also a <a class="zem_slink" title="RAID" rel="wikipedia" href="http://en.wikipedia.org/wiki/RAID">RAID</a>-5 array of some kind. I checked out and discovered <a href="http://www.freebsdwiki.net/index.php/Gvinum" target="_blank">GEOM vinum</a> (or gvinum), which provided what I needed at that time. It is a <a class="zem_slink" title="File server" rel="wikipedia" href="http://en.wikipedia.org/wiki/File_server">file server</a>, but throughput is not a critical issue, so I tried it (at that time, <a href="http://en.wikipedia.org/wiki/Geom_raid5" target="_blank">graid5</a> was not yet available, AFAIK). I am writing this because this weekend I had to rebuild the array (and copy the data) with new, larger drives, which took me many hours to do it, because there is not so many documentation on how to make different <a href="http://en.wikipedia.org/wiki/GEOM" target="_blank">GEOM</a> RAID subsystems share the same three drives.</p>
<p>This is what I wanted to achieve: have three drives, which would contain two <a href="http://www.freebsd.org/doc/en/books/handbook/geom-mirror.html" target="_blank">gmirror</a> (RAID-1) arrays (one for root partition, the other for swap) and three gvinum (RAID-5) volumes &#8211; for <a class="zem_slink" title="Filesystem Hierarchy Standard" rel="wikipedia" href="http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard"></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/var</div></div>
<p></a>,</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/tmp</div></div>
<p>and</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/usr</div></div>
<p>. For the latter, it is best to use volume management capabilities of gvinum, which allows you to join only three physical devices (or slices or partitions) with it, so that the logical volumes are created &#8220;inside&#8221; the vinum manager.</p>
<p>The main problem was, that I forgot how to do this &#8220;properly&#8221;. It was 2 years since I did this (of course, I didn&#8217;t write it down how I did it, although it took me a few hours) last time and since the machine is far away, I don&#8217;t have physical access. This would have helped, because I could just put the old drives back and see how they were configured, but the remote system administrator already exchanged the drives and I didn&#8217;t want to bother him.</p>
<p>In FreeBSD terms, a partition is a logical unit, which resides on a slice (which is actually a partition from other operating systems&#8217; point of view).  Let&#8217;s have four drives on the system:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/ad0</div></div>
<p>,</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/ad1</div></div>
<p>,</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/ad2</div></div>
<p>and</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/ad3</div></div>
<p>. We&#8217;ll assume that on</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/ad0</div></div>
<p>there is the system we are booting and running FreeBSD at the moment and we wan&#8217;t to create the arrays on the other three drives, which will eventually run by themselves (we&#8217;ll pull the</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/ad0</div></div>
<p>out when we finish). When you create a slice on</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/ad1</div></div>
<p>, for example, you&#8217;ll be able to access it via</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/ad1s1</div></div>
<p>. When you create a partition on this slice, you&#8217;ll see it as</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/ad1s1a</div></div>
<p>, where the last letter &#8220;a&#8221; can also be &#8220;b&#8221;, &#8220;d&#8221;, &#8220;e&#8221;, and so on, you know the alphabet. This naming system is somewhat <a href="http://www.freebsd.org/doc/en/books/handbook/disk-organization.html" target="_blank">peculiar</a>, and I don&#8217;t like it but I can live with it. The letter &#8220;a&#8221; usually hosts the root partition, and the letter &#8220;b&#8221; provides swap space. As you can see, there is no letter &#8220;c&#8221;. This is because it specifies the whole slice and therefore it should not be used for anything else.</p>
<p>Usually, when you&#8217;re setting up the gmirror RAID-1 on FreeBSD, you make put it on the physical drive directly, i.e. you make the</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/ad0</div></div>
<p>visible as</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/mirror/gm0</div></div>
<p>(after you put the metadata on the drive, by running &#8216;</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">gmirror create</div></div>
<p>&#8216;), which also means that all existing slices and partitions will be visible at the new location. If you had</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/ad0s1a</div></div>
<p>, you&#8217;ll now have</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/mirror/gm0s1a</div></div>
<p>. Which is very nice and makes gmirror very easy to set up after the system was installed. In the end, you just add other mirrors (</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/ad1</div></div>
<p>, &#8230;) in the array and that&#8217;s it.</p>
<p>However, if you want to use gvinum on the same drives (to make RAID-5 arrays, for example), you can&#8217;t do that. You&#8217;ll need to gmirror something else: the slices or the partitions, but not the whole drives. Now FreeBSD allows you to have no slices at all &#8211; to create the FreeBSD partitions (the letters) directly on the drive (so you&#8217;ll have</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/ad1a</div></div>
<p>). So when I started to think about how I would partition the drives and which units will I merge with gvinum and gmirror, I became a bit confused. So I tried a few ideas I had and none of them really worked because I didn&#8217;t know what actually the command such as &#8221;</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">bsdlabel -w</div></div>
<p>&#8220;, &#8221;</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">boot0cfg</div></div>
<p>&#8220;, &#8221;</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">gmirror label</div></div>
<p>&#8220;, &#8221;</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">gvinum create</div></div>
<p>&#8221; and creating slices via &#8221;</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sysinstall</div></div>
<p>&#8221; actually do. Where do they write their data? At what offsets and what are the sizes of these metadata? I found it quite annoying that there isn&#8217;t much documentation about this (at least not well organized), so I had to do some homework. Here is what I discovered:</p>
<p><strong>gvinum &#8212; </strong>When you run &#8221;</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">gvinum create</div></div>
<p>&#8220;, it will rewrite the bytes from <strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">0x1000</div></div>
<p></strong> to <strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">0x21200</div></div>
<p></strong>, that is from block 8 (first 8 blocks are left untouched) to block 265 with its own configuration data, so you have to be careful not to mess with these blocks.</p>
<p><strong>gmirror &#8212; </strong>Running &#8221;</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">gmirror label</div></div>
<p>&#8221; puts gmirror&#8217;s metadata on the last block of the device. The size in blocks of the mirror is then number of block of the device &#8211; 1.</p>
<p><strong>bsdlabel &#8212; </strong>When labelling a slice (or the drive directly), bsdlabel writes label information to the second block (from address <strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">0x200</div></div>
<p></strong> on, in my tests it never passed the <strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">0x2c0</div></div>
<p></strong> limit, which still fits into the second block).</p>
<p><strong>boot0cfg &#8212; </strong>Since it rewrites the <a class="zem_slink" title="Master boot record" rel="wikipedia" href="http://en.wikipedia.org/wiki/Master_boot_record">MBR</a> with BootMgr, this means it rewrites the first block (block 0) of the drive.</p>
<p><strong>fdisk &#8212; </strong>Fdisk writes the slice information into first 16 blocks of <strong>the slice</strong>. This means, that you shouldn&#8217;t label them with bsdlabel (don&#8217;t assign them to any of the partitions), or you can have problems.</p>
<p>To sum up, the only configuration, which worked for me on FreeBSD 6.1 (yes, quite old one) was the following. First I created slices on all of the drives (one on each drive) and wrote the BootMgr onto them (you can do this easily by running <strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sysinstall</div></div>
<p></strong> and then going to <strong>Custom </strong>and then <strong>Partition</strong>. You select the first drive (of the three) and then, when in fdisk-editor, press <strong>a</strong> and then <strong>w</strong> to write the slice. When asked about MBR, just say <strong>BootMgr</strong> and that&#8217;s it. This will ensure that there is a boot manager on the drive (which means you can boot from it). You have to repeat this procedure for the other (two) drives as well.</p>
<p>Then, you have to edit the label of all three slices, running &#8220;<strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">bsdlabel -e /dev/ad1s1</div></div>
<p></strong>&#8221; (for the slice on the first drive). You have to provide the following partition set:</p>
<pre>a:  1048576       16    4.2BSD        0     0     0
b:  4194304  1048592      swap
c: 976768002       0    unused        0     0         # "raw" part, don't edit
d: 971525106 5242896     vinum</pre>
<p>In this configuration you can see that the size of &#8220;a&#8221; (root) partition is 1048576 512-byte blocks which means 512 MB. The offset of 16 blocks for the &#8220;a&#8221; partition is very important, since the slice needs the first 16 blocks for itself. The size of the &#8220;b&#8221; (swap) partition is 4 times the size of &#8220;a&#8221; (2 GB) and the &#8220;d&#8221; takes all the space left on the slice.</p>
<p>So the idea is to make two gmirror arrays, the first one will consist of the three &#8220;a&#8221; partitions (remember, we have three hard drives) and will be used as the root partition. The second one will consist of the three &#8220;b&#8221; partitions and will be used as swap space. All the &#8220;d&#8221; partitions will be used for the construction of the gvinum array.</p>
<p>First, you need to load the</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">geom_mirror module</div></div>
<p>, which enables kernel to handle the gmirror arrays. You do this by running &#8221;</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">kldload geom_mirror</div></div>
<p>&#8220;. But, it is needed to make this change permanent (so the module will load at boot) so you need to add these two lines to</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/boot/loader.conf</div></div>
<p>:</p>
<pre>geom_mirror_load="YES"
geom_vinum_load="YES"</pre>
<p>This will also enable loading gvinum at boot, which we will need later (when the system will boot from the new arrays). No it&#8217;s time to create the arrays. You&#8217;ll run something like:</p>
<pre># gmirror label -v -b round-robin root /dev/ad1s1a
# gmirror label -v -b round-robin swap /dev/ad1s1b
# gmirror insert root /dev/ad2s1a
# gmirror insert root /dev/ad3s1a
# gmirror insert swap /dev/ad2s1b
# gmirror insert swap /dev/ad3s1b</pre>
<p>This was for the gmirror arrays. Now make a file named</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">gvinum.conf</div></div>
<p>and put this in it:</p>
<pre>drive disk1 device /dev/ad1s1d
drive disk2 device /dev/ad2s1d
drive disk3 device /dev/ad3s1d
 volume var
  plex org raid5 491k
   sd length 1024m drive disk1
   sd length 1024m drive disk2
   sd length 1024m drive disk3
 volume tmp
  plex org raid5 491k
   sd length 512m drive disk1
   sd length 512m drive disk2
   sd length 512m drive disk3
 volume usr
  plex org raid5 491k
   sd length 0 drive disk1
   sd length 0 drive disk2
   sd length 0 drive disk3</pre>
<p>And then you run:</p>
<pre># gvinum create gvinum.conf</pre>
<p>This will create three gvinum RAID-5 arrays &#8211; for</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/var</div></div>
<p>,</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/usr</div></div>
<p>and</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/tmp</div></div>
<p>. They will be accessible via</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/gvinum/var</div></div>
<p>,</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/gvinum/usr</div></div>
<p>and</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/dev/gvinum/tmp</div></div>
<p>respectively. You should know, that the size of the RAID-5 array is the sum of the size of all drives &#8211; the size of one drive. This makes our</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/var</div></div>
<p>2 GB,</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/tmp</div></div>
<p>1GB and</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/usr</div></div>
<p>the rest. If you execute &#8221;</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">gvinum list</div></div>
<p>&#8221; now, you&#8217;ll see that all the arrays are marked as <strong>up</strong>. However, this will not be the case after you reboot. I don&#8217;t know exactly why, perhaps this is a bug. Also I am not sure if it is present in the newest FreeBSD releases. So it is very important now, that you <strong>reboot</strong> the system now. After it comes back online, you have to run:</p>
<pre># gvinum start var
# gvinum start usr
# gvinum start tmp</pre>
<p>Then you have to wait for the arrays to become synchronized. It may take a while. You can always check status with &#8221;</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">gvinum list</div></div>
<p>&#8220;. When the arrays are synchronized, you need to create the filesystems on all of them:</p>
<pre># newfs /dev/mirror/root
# newfs -U /dev/gvinum/var
# newfs -U /dev/gvinum/usr
# newfs -U /dev/gvinum/tmp</pre>
<p>After that, you should mount these new arrays in</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/mnt</div></div>
<p>and copy the system, you are running now onto them:</p>
<pre># mount /dev/mirror/root /mnt
# cd /mnt
# mkdir var tmp usr
# chmod 1777 tmp
# mount /dev/gvinum/var /mnt/var
# mount /dev/gvinum/usr /mnt/usr
# mount /dev/gvinum/tmp /mnt/tmp
# cd / &amp;&amp; find . -xdev | cpio -pm /mnt
# cd /var &amp;&amp; find . -xdev | cpio -pm /mnt/var
# cd /usr &amp;&amp; find . -xdev | cpio -pm /mnt/usr
# cd /tmp &amp;&amp; find . -xdev | cpio -pm /mnt/tmp</pre>
<p>Finally, you have to modify your</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">fstab</div></div>
<p>file on the root gmirror array. Edit</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/mnt/etc/fstab</div></div>
<p>as follows:</p>
<pre># Device                Mountpoint      FStype  Options         Dump    Pass#
/dev/mirror/swap        none            swap    sw              0       0
/dev/mirror/root        /               ufs     rw              1       1
/dev/gvinum/tmp         /tmp            ufs     rw              2       2
/dev/gvinum/usr         /usr            ufs     rw              2       2
/dev/gvinum/var         /var            ufs     rw              2       2
/dev/acd0               /cdrom          cd9660  ro,noauto       0       0</pre>
<p>Now you can try to boot the system from one of the three drives which hold the RAID arrays and you should be lucky. If you aren&#8217;t, you are welcome to post comments here and we&#8217;ll try to sort it out together.</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Zemified by Zemanta" href="http://reblog.zemanta.com/zemified/e81a812b-6bbf-4f2b-a7fd-73e32c29517d/"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/reblog_e.png?x-id=e81a812b-6bbf-4f2b-a7fd-73e32c29517d" alt="Reblog this post [with Zemanta]" /></a></div>
]]></content:encoded>
			<wfw:commentRss>http://nejc.skoberne.net/2008/11/gmirror-and-gvinum-on-the-same-drives/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenVPN package generator</title>
		<link>http://nejc.skoberne.net/2008/11/openvpn-package-generator/</link>
		<comments>http://nejc.skoberne.net/2008/11/openvpn-package-generator/#comments</comments>
		<pubDate>Mon, 24 Nov 2008 09:42:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[EJBCA]]></category>
		<category><![CDATA[Open source]]></category>
		<category><![CDATA[OpenVPN]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Virtual private network]]></category>

		<guid isPermaLink="false">http://nejc.skoberne.net/?p=83</guid>
		<description><![CDATA[OpenVPN is an open, secure and thoroughly tested VPN technology. Our company Infrax d.o.o. also provides OpenVPN clients for customers to be able to access their companies&#8217; networks. We don&#8217;t use password-based authentication, but certificate-based one, which means we have our own full-blown Certificate Authority (self signed, of course). We use EJBCA for that and [...]]]></description>
			<content:encoded><![CDATA[<p><a class="zem_slink" title="OpenVPN" rel="homepage" href="http://openvpn.net/">OpenVPN</a> is an open, secure and thoroughly tested <a class="zem_slink" title="Virtual private network" rel="wikipedia" href="http://en.wikipedia.org/wiki/Virtual_private_network">VPN</a> technology. Our company Infrax d.o.o. also provides OpenVPN clients for customers to be able to access their companies&#8217; networks. We don&#8217;t use password-based authentication, but certificate-based one, which means we have our own full-blown <a class="zem_slink" title="Certificate authority" rel="wikipedia" href="http://en.wikipedia.org/wiki/Certificate_authority">Certificate Authority</a> (self signed, of course). We use <a href="http://www.ejbca.org/" target="_blank">EJBCA</a> for that and it works beautifully.</p>
<p>However, our customers are expecting simple solutions: a single package with their own config file and certificate. Although EJBCA supports generating OpenVPN packages on the fly on the server, it would be a bit more complicated to make it work, because we need to generate different config files for our customers. Which means we would need a special <a class="zem_slink" title="Lookup table" rel="wikipedia" href="http://en.wikipedia.org/wiki/Lookup_table">lookup-table</a> (we could use the EJBCA&#8217;s <a class="zem_slink" title="MySQL" rel="homepage" href="http://www.mysql.com">MySQL</a> database) which would link specific fields in certificates&#8217; &#8220;distingished name&#8221; with corresponding OpenVPN config files. This would be possible, but a bit too complicated for now.</p>
<p>So I decided that we create the packages &#8220;semi-manually&#8221;, i.e. manually but in &#8220;batch&#8221; mode. First, you need <a href="http://nejc.skoberne.net/wp-content/uploads/2008/11/openvpn-generator.zip" target="_blank">my package</a> which includes OpenVPN source environment (OpenVPN 2.1 RC7) which will be compiled with <a class="zem_slink" title="Nullsoft Scriptable Install System" rel="homepage" href="http://nsis.sourceforge.net/">NSIS</a> into an <a class="zem_slink" title="Executable" rel="wikipedia" href="http://en.wikipedia.org/wiki/Executable">executable</a> together with the certificate and config files.</p>
<p>Then you need to obtain the certificates for the clients you want to create the packages for and provide the config file as well. You must also install <a href="http://nsis.sourceforge.net/" target="_blank">NSIS</a> and then you are ready. Just run &#8220;generate.cmd&#8221; file in the &#8220;openvpn-generator&#8221; directory and the executables will be created in &#8220;openvpn-generator/exes&#8221;.</p>
<p>If you have problems, questions, just let me know.</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Zemified by Zemanta" href="http://reblog.zemanta.com/zemified/cf12f832-416a-4e71-834f-83bc1bb1929d/"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/reblog_e.png?x-id=cf12f832-416a-4e71-834f-83bc1bb1929d" alt="Reblog this post [with Zemanta]" /></a></div>
]]></content:encoded>
			<wfw:commentRss>http://nejc.skoberne.net/2008/11/openvpn-package-generator/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

