<?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>Mindstab.net &#187; Guide Archives  &#8211; Mindstab.net</title>
	<atom:link href="http://www.mindstab.net/tag/guide/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mindstab.net</link>
	<description>Various projects and musings</description>
	<lastBuildDate>Tue, 27 Mar 2012 16:53:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Finding &#8220;lost&#8221; computers on the web the homebrew way</title>
		<link>http://www.mindstab.net/finding-lost-computers-web/</link>
		<comments>http://www.mindstab.net/finding-lost-computers-web/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 06:39:55 +0000</pubDate>
		<dc:creator>Dan Ballard</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Guide]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.mindstab.net/?p=1043</guid>
		<description><![CDATA[During the course of updating my home computer I rebooted it because of a kernel update. Later that week at work I went to connect to my home computer and discovered that it&#8217;s dynamic IP had changed and it&#8217;s DNS name was invalid. So following common advice to &#8220;fix a problem two ways to prevent [...]]]></description>
			<content:encoded><![CDATA[<p>During the course of updating my home computer I rebooted it because of a kernel update.  Later that week at work I went to connect to my home computer and discovered that it&#8217;s dynamic IP had changed and it&#8217;s DNS name was invalid.</p>
<p>So following common advice to &#8220;fix a problem two ways to prevent it in the future&#8221; I fixed the DNS, but I also wanted an automated way to track my computers when and if their IPs changed.</p>
<p>So the first thing I needed was shared place to store the IP information.  Thinking about it I realized that Dropbox would work well for that.  So all I needed was a simple script.</p>
<p>So the solution was to put a script that determined the IP of the computer in Dropbox and have cron on all the computers run it.  Each user can call cron with</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ crontab <span style="color: #660033;">-e</span></pre></div></div>

<p>And I created a crontab directory that I could add more scripts to later if need be with and run them hourly with the following entry</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000;">0</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>dan <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">run-parts</span> Dropbox<span style="color: #000000; font-weight: bold;">/</span>cron</pre></div></div>

<p>The script itself was a file called <i>getip</i> and it used whatsmyip.com&#8217;s automation detection script.</p>
<p><strong>getip</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh </span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-O</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/`</span><span style="color: #c20cb9; font-weight: bold;">hostname</span><span style="color: #000000; font-weight: bold;">`</span>.ip http:<span style="color: #000000; font-weight: bold;">//</span>automation.whatismyip.com<span style="color: #000000; font-weight: bold;">/</span>n09230945.asp
<span style="color: #007800;">tmp_file</span>=<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/`</span><span style="color: #c20cb9; font-weight: bold;">hostname</span><span style="color: #000000; font-weight: bold;">`</span>.ip
<span style="color: #007800;">dst_file</span>=Dropbox<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/`</span><span style="color: #c20cb9; font-weight: bold;">hostname</span><span style="color: #000000; font-weight: bold;">`</span>.ip
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #c20cb9; font-weight: bold;">diff</span> <span style="color: #660033;">-q</span> <span style="color: #800000;">${tmp_file}</span> <span style="color: #800000;">${dst_file}</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null  ; <span style="color: #000000; font-weight: bold;">then</span>
  <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #800000;">${tmp_file}</span>  <span style="color: #800000;">${dst_file}</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre></div></div>

<p>Then I just created <i>Dropbox/var/log</i> and installed the crontab on all my computers, and volia, homebrew IP tracking for all my compters accessible to me from anywhere.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mindstab.net/finding-lost-computers-web/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Drupal + Google Search Appliance + Multiple languages and collections</title>
		<link>http://www.mindstab.net/drupal-google-search-appliance-multiple-languages-collections/</link>
		<comments>http://www.mindstab.net/drupal-google-search-appliance-multiple-languages-collections/#comments</comments>
		<pubDate>Thu, 07 Jul 2011 04:29:10 +0000</pubDate>
		<dc:creator>Dan Ballard</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Drupal]]></category>
		<category><![CDATA[Guide]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://www.mindstab.net/?p=977</guid>
		<description><![CDATA[So at work we use Drupal a lot. And one of our clients has a Google Search Appliance (mini google in a box installed in their datacenter for their personal use) and runs sites that operate in multiple languages. So we installed the Drupal GSA module, flicked it on, and had Google searches. Of course [...]]]></description>
			<content:encoded><![CDATA[<p>So at work we use Drupal a lot.  And one of our clients has a Google Search Appliance (mini google in a box installed in their datacenter for their personal use) and runs sites that operate in multiple languages.  So we installed the Drupal GSA module, flicked it on, and had Google searches.  Of course since we had multiple languages, we set up GSA collections, one collection for each language.  Easy enough.  But by default the Drupal GSA module only takes one collection in it&#8217;s admin page.  So we did what we always do in this situation, we made the collection a <i>multilingual</i> variable, a kind of Drupal hack that enables that variable to have different values transparently depending on the site&#8217;s language.  Then we input each GSA collection into each language/site&#8217;s GSA config.  Done and good to go?  Nope.  All the searches were still in English for all the sites.  So on the French site we cleared the cache and then the searches were in French! &#8230; for all the sites. The Drupal GSA module was deeply not designed to work with multiple languages/collections it turned out.  </p>
<p>After about 2 hours debugging we figured it all out.  When the module is initialized, it pulls out all the config data, puts it in a hash, and hands it off to Drupal in the menu hook. Drupal stores it forever, and hands it off to the search function whenever it is called and so what ever language is active when the module is initialized determines what colleciton is used forever for all languages. Not cunning.  The fix however was straight forward and one line: in the search function, just disregard the passed in settings value for the collection and re-pull it.</p>
<p>For what it&#8217;s worth I filed a bug and patch (against 6.x-2.0-beta1, though it should work fine for all versions) with the module at <a href="http://drupal.org/node/1208892">http://drupal.org/node/1208892</a> but it seems it&#8217;s suffering from low maintainership.</p>
<p>Here it is as well, though it&#8217;s probably just as easy to copy/paste the line in directly.</p>

<div class="wp_syntax"><div class="code"><pre class="diff" style="font-family:monospace;">Index: google_appliance.module
===================================================================
<span style="color: #888822;">--- google_appliance.module	<span style="">&#40;</span>revision 14982<span style="">&#41;</span></span>
<span style="color: #888822;">+++ google_appliance.module	<span style="">&#40;</span>working copy<span style="">&#41;</span></span>
<span style="color: #440088;">@@ -1055,6 +1055,9 @@</span>
  *   Themed search results.
  */
 function google_appliance_search_view<span style="">&#40;</span>$search_base, $client, $collection, $keys = NULL, $title = NULL<span style="">&#41;</span> <span style="">&#123;</span>
<span style="color: #00b000;">+  </span>
<span style="color: #00b000;">+  $collection =  trim<span style="">&#40;</span>variable_get<span style="">&#40;</span>'google_appliance_default_collection', 'default_collection'<span style="">&#41;</span><span style="">&#41;</span>;</span>
<span style="color: #00b000;">+  </span>
   $form = drupal_get_form<span style="">&#40;</span>'google_appliance_search_form', NULL, $search_base, $client, $collection, $keys<span style="">&#41;</span>;
   // When POSTing back to an existing search-results page, the original
   // URL is accessed <span style="">&#40;</span>which re-runs that search<span style="">&#41;</span> and then the redirect for</pre></div></div>

<p>Now it works just fine and all our different language sites have searches and results in just their language. Splendid!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mindstab.net/drupal-google-search-appliance-multiple-languages-collections/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Liberating Flash Video From an RTMP Server</title>
		<link>http://www.mindstab.net/liberating-flash-video-from-an-rtmp-server/</link>
		<comments>http://www.mindstab.net/liberating-flash-video-from-an-rtmp-server/#comments</comments>
		<pubDate>Tue, 18 Jan 2011 06:38:23 +0000</pubDate>
		<dc:creator>Dan Ballard</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[Cortex]]></category>
		<category><![CDATA[Guide]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[Life]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.mindstab.net/wordpress/?p=879</guid>
		<description><![CDATA[Let&#8217;s say you did a presentation that was recorded and you&#8217;d like to post it to your website. Sadly, let&#8217;s now say there are some problems, like that your 5 minute presentation is part of a nearly 2 hour video only available in a flash player that doesn&#8217;t even have a time display so you [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s say you did a presentation that was recorded and you&#8217;d like to post it to your website.  Sadly, let&#8217;s now say there are some problems, like that your 5 minute presentation is part of a nearly 2 hour video only available in a flash player that doesn&#8217;t even have a time display so you couldn&#8217;t even point people to the video and say jump to 1 hour and 15 minutes to see me.  It sucks.  Technically your presentation is available online, but it&#8217;s not really accessible. So here is how you might rescue it!</p>
<p>It turns out there are two ways flash players server videos these days.  The first and easiest is that a simple flash player loads in your browser, and uses your browser to make a GET request to the server to load a .flv file (FLash Video).  This is relatively easy to intercept, there are lots of tools and plugins for Firefox that do this automatically for you.  Even better, on Linux for example, these videos are usually stored in /tmp so your browser does the whole job and gives them to you.  No work required.</p>
<p>The other more complicated but more secure option is that the flash player connects to a dedicated rtmp server that streams flash video.  The flash plugin does the networking and there is no file to save, it&#8217;s a stream.</p>
<p>If you are lucky enough to have a player using the first option, you are done.  Assuming you have the second option, then your fun has just begun.</p>
<p>First we need to try and figure out where the server that your flash video is.</p>
<p>My first approach was to use wireshark to sniff the traffic.  Through this I discovered the basics, like the address the server and the port, 1935.</p>
<p>Next I installed <a href="http://rtmpdump.mplayerhq.hu/">rtmpdump</a>.  RTMP is the Real Time Messaging Protocol and rtmpdump is a program that can connect to an RTMP server, get a stream and save it to a file.  Sadly the data I got from wireshark didn&#8217;t have all the parameters I needed to get the file.  Or I couldn&#8217;t read it properly.  So while I knew where the server was and could now connect to it, I still didn&#8217;t know how to ask for the video I wanted.</p>
<p>Thankfully rtmpdump comes with several other utilities.  After reading its README I went the rtmpsuck route.  I set local redirecting of all port 1935 requests to localhost with iptables and ran the rtmpsuck proxy server.  In theory it was supposed to intercept all calls from the flash player to the rtmp server, decode and spit them out, and then forward them along.  Even better, it would try to save the stream on the way back as it passed through it.</p>
<pre>
# iptables -t nat -A OUTPUT -p tcp --dport 1935 -m owner --uid-owner OWNER_UID  -j REDIRECT
$ ./rtmpsuck
</pre>
<p>Where OWNER_UID is the uid of the user running rtmpsuck.  With this running I just reloaded the page with the player (twice, it&#8217;s a bit glitchy) and then tried to skip to where my part was so it would save the stream from there.  </p>
<p>It was partially successful.  It spit out on the console all the pertinent path parameters about the video on the server, but it kept chocking on bad packets of data and stopped recording.  Also for some reason the video it did store was very large, space-consuming wise.</p>
<p>Armed with the right parameters though I was able to use rtmpdump to suck down the whole video from the server surprisingly quickly and in a reasonably sized format.</p>
<pre>
$ ./rtmpdump  -r rtmp://server.net/app_name/blah/event/date/date-1 -o video.flv
</pre>
<p>Now the video was liberated from its flash interface and in my possession, I just had to cut out my small part and then convert it to a more common format.</p>
<pre>
$ mencoder -ss 1:15:50  -endpos 0:05:57  -ovc copy -oac copy video.flv -o result.flv
$ ffmpeg -i result.flv result.avi
</pre>
<p>And volia.  I now have just my part of the video and in a common format.  I mean you hypothetically do!  Yes&#8230;</p>
<p>Completely unrelatedly, you can expect to see my presentation on my project Cortex from the BCNet Broadband Innovation Challenge (where I got second place) online soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mindstab.net/liberating-flash-video-from-an-rtmp-server/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Merry Christmas! To: My Phone, From: The Internet</title>
		<link>http://www.mindstab.net/merry-christmas-to-my-phone-from-the-internet/</link>
		<comments>http://www.mindstab.net/merry-christmas-to-my-phone-from-the-internet/#comments</comments>
		<pubDate>Mon, 27 Dec 2010 18:29:35 +0000</pubDate>
		<dc:creator>Dan Ballard</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Guide]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.mindstab.net/wordpress/?p=845</guid>
		<description><![CDATA[So early this year I bought my first Android phone, an LG Eve, from Rogers Mobile. It turns out it came with Android 1.5 which was a year old at the time, the current version was 2.1 and 2.2 was released that spring. Rogers has been promising an update to 1.6 for the phone pretty [...]]]></description>
			<content:encoded><![CDATA[<p>So early this year I bought my first Android phone, an LG Eve, from Rogers Mobile.  It turns out it came with Android 1.5 which was a year old at the time, the current version was 2.1 and 2.2 was released that spring.  Rogers has been promising an update to 1.6 for the phone pretty much since I bought it and still no release.  It was pushed back twice and has since gone silent.  This could be the end and a sad story at that, with just over 2 more years left on my contract.</p>
<p>However, this is Android!  And so heroically the <a href="http://www.cyanogenmod.com/">CyanogenMod</a> people have been following the Android code base and releaseing an free up to date version that works on some more common phones.  The good folks of <a href="http://openetna.com/">Open Etna</a> have taken that work and customized it and made sure it works on the LG Eve specifically.  So following the instructions on their and other sites, I have been able to upgrade my phone to Android 2.2, and it&#8217;s awesome.  There is a lot more software available, voice commands, live wallpapers, and a JIT compiler so software should run faster, and more that I&#8217;m just discovering (ships with a good terminal app).  And just generally newer default apps.  So thank you very much to those communities of volunteers for doing vastly more than what my Phone company was incapable of.</p>
<p>And now briefly what I did:</p>
<p>I followed the <a href="http://openetna.com/openetna/about/">Open Etna Installation Guide</a>.  It&#8217;s pretty straight forward and simple.  However there were a few other resources.  I can&#8217;t stress enough how important good backups are, so make sure your contacts are synced to your google account and make a list of your favorite apps because you are about to wipe everything clean.  Better instructions on how to run the backup procedure are at  <a href="http://www.zacpod.com/p/71">www.zacpod.com/p/71</a>.  Bellow the videos on the Open Etna guide is a important reminded to install the Google apps.  Considering how important this is I&#8217;m surprised they placed it a bit out of the way, and it&#8217;s important because it allows you to then resync all your contacts and access all the other Google goodies that help make these phones great (and who wants to reenter all their contacts when all you have to do is hit a button to restore them).</p>
<p>So that&#8217;s about it.  Now my phone is to date and has a whole lot more life to it.  Thanks Android community!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mindstab.net/merry-christmas-to-my-phone-from-the-internet/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Lisp (SBCL + emacs + slime) on Hardened-ish Gentoo on Xen (take 2)</title>
		<link>http://www.mindstab.net/lisp-sbcl-emacs-slime-on-hardened-ish-gentoo-on-xen-take-2/</link>
		<comments>http://www.mindstab.net/lisp-sbcl-emacs-slime-on-hardened-ish-gentoo-on-xen-take-2/#comments</comments>
		<pubDate>Thu, 16 Sep 2010 17:27:58 +0000</pubDate>
		<dc:creator>Dan Ballard</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Guide]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Lisp]]></category>
		<category><![CDATA[Server]]></category>

		<guid isPermaLink="false">http://www.mindstab.net/wordpress/?p=806</guid>
		<description><![CDATA[A while ago I tried with mixed success to get Lisp onto my Gentoo Hardened server. I had to go a binary only route and kind of stopped there not taking it any farther. Now, 2 years later, I need the full meal deal, lisp + emacs + slime, on my server, which is now [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.mindstab.net/wordpress/archives/297">A while ago</a> I tried with mixed success to get Lisp onto my Gentoo Hardened server.  I had to go a binary only route and kind of stopped there not taking it any farther.  Now, 2 years later, I need the full meal deal, lisp + emacs + slime, on my server, which is now a Xen VPS with as much hardening as I could get (much less kernel based hardening since it&#8217;s the VPS&#8217;s kernel).  It was still too much for SBCL to compile in portage so here&#8217;s what I did to get it all working.</p>
<p>So you need an out of tree binary copy of SBCL.  Live with it.  It works.  The problem with going with out of tree software, especially for a language, is that what ever binary you get isn&#8217;t supported and hasn&#8217;t been tested against all the software in-tree.  For instance I initially tried the newest version of SBCL (1.0.42) but ran into problems with portage&#8217;s stable slime.<br />
Ultimately I went with the closest I could get to portage&#8217;s stable version.  Portage has 1.0.19 marked as the most recent stable version so I went out and downloaded the binary of that version</p>
<pre>
$ wget  http://sourceforge.net/projects/sbcl/files/sbcl/1.0.19/sbcl-1.0.19-x86-linux-binary.tar.bz2/download
$ tar -xjf sbcl-1.0.19-x86-linux-binary.tar.bz2
</pre>
<p>So change into the directory and check out INSTALL.  Basically installation is easy.  Binary SBCL is configured around installing into /usr/local but that can be gotten around.  So we&#8217;ll go with a more traditional install into /usr</p>
<p><i>Note</i>: My test box is a VPS with a Xen kernel not a hardened kernel so I didn&#8217;t have any PaX problems, but my notes for the last time I tired this on a full hardened install mention that you need do disable some PaX features before SBCL will work:</p>
<pre>
$ paxctl -p -e -m -r -x -s " on src/runtime/sbcl
</pre>
<p>Install to /usr</p>
<pre>
# INSTALL_ROOT=/usr sh install.sh
</pre>
<p>Now SBCL is installed but it won&#8217;t work because the binary is preconfigured to look for the core in /usr/local.  So we&#8217;ll borrow the gentoo SBCL config files to get that setup properly.</p>
<p><strong>/etc/env.d/50sbcl</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">SBCL_HOME</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>sbcl
<span style="color: #007800;">SBCL_SOURCE_ROOT</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>sbcl<span style="color: #000000; font-weight: bold;">/</span>src</pre></div></div>

<pre>
# env-update
</pre>
<p>The above file and command set up the system environment variables to tell SBCL where it&#8217;s really installed.  Now is as good a time as and to &#8216;<i>source /etc/profile</i>&#8216; to get those changes.</p>
<p>Now SBCL is installed and working, we need to let portage know that.  There used to be a &#8216;emerge &#8211;inject&#8217; method, but that&#8217;s been deprecated in place of a new provides file</p>
<p><strong>/etc/portage/profile/package.provided</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dev-lisp<span style="color: #000000; font-weight: bold;">/</span>sbcl-1.0.19</pre></div></div>

<p>Now portage knows about our SBCL so we can start installing things that depend on it like the rest of our tool chain</p>
<pre>
# emerge cl-asdf emacs slime -va
</pre>
<p>So now we have all the pieces, all they need is some gluing together.  Again we&#8217;ll borrow from the Gentoo SBCL files.</p>
<p><strong>/etc/sbclrc</strong></p>

<div class="wp_syntax"><div class="code"><pre class="lisp" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">;;; The following is required if you want source location functions to</span>
<span style="color: #808080; font-style: italic;">;;; work in SLIME, for example.</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setf</span> <span style="color: #66cc66;">&#40;</span>logical-pathname-translations <span style="color: #ff0000;">&quot;SYS&quot;</span><span style="color: #66cc66;">&#41;</span>
    '<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;SYS:SRC;**;*.*.*&quot;</span> #p<span style="color: #ff0000;">&quot;/usr/$(get_libdir)/sbcl/src/**/*.*&quot;</span><span style="color: #66cc66;">&#41;</span>
          <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;SYS:CONTRIB;**;*.*.*&quot;</span> #p<span style="color: #ff0000;">&quot;/usr/$(get_libdir)/sbcl/**/*.*&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">;;; Setup ASDF</span>
<span style="color: #66cc66;">&#40;</span>load <span style="color: #ff0000;">&quot;/etc/gentoo-init.lisp&quot;</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

<p><strong>/etc/gentoo-init.lisp</strong></p>

<div class="wp_syntax"><div class="code"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span>in-package #<span style="color: #66cc66;">:</span><span style="color: #555;">cl-user</span><span style="color: #66cc66;">&#41;</span>
#+<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">or</span> sbcl ecl<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span>require <span style="color: #66cc66;">:</span><span style="color: #555;">asdf</span><span style="color: #66cc66;">&#41;</span>
#-<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">or</span> sbcl ecl<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span>load #p<span style="color: #ff0000;">&quot;/usr/share/common-lisp/source/asdf/asdf.lisp&quot;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>push #p<span style="color: #ff0000;">&quot;/usr/share/common-lisp/systems/&quot;</span> asdf<span style="color: #66cc66;">:</span>*central-registry*<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>asdf<span style="color: #66cc66;">:</span><span style="color: #555;">oos</span> 'asdf<span style="color: #66cc66;">:</span><span style="color: #555;">load-op</span> <span style="color: #66cc66;">:</span><span style="color: #555;">asdf-binary-locations</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setf</span> asdf<span style="color: #66cc66;">:</span>*centralize-lisp-binaries* t<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setf</span> asdf<span style="color: #66cc66;">:</span>*source-to-target-mappings* '<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>#p<span style="color: #ff0000;">&quot;/usr/lib/sbcl/&quot;</span> <span style="color: #b1b100;">nil</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span>#p<span style="color: #ff0000;">&quot;/usr/lib64/sbcl/&quot;</span> <span style="color: #b1b100;">nil</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>Now everything should work.  You just need to set up your emacs and slime</p>
<p><strong>~/.emacs</strong></p>

<div class="wp_syntax"><div class="code"><pre class="lisp" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">; your SLIME directory</span>
<span style="color: #66cc66;">&#40;</span>add-to-<span style="color: #b1b100;">list</span> 'load-path <span style="color: #ff0000;">&quot;/usr/share/emacs/site-lisp/slime/&quot;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #808080; font-style: italic;">; your Lisp system</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> inferior-lisp-program <span style="color: #ff0000;">&quot;/usr/bin/sbcl&quot;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>require 'slime<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>slime-setup<span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span>global-set-key <span style="color: #66cc66;">&#40;</span>kbd <span style="color: #ff0000;">&quot;C-c C-q&quot;</span><span style="color: #66cc66;">&#41;</span> 'slime-close-all-parens-in-sexp<span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>Now It&#8217;s all glued together, give it a go</p>
<pre>
$ emacs
M-x slime
</pre>
<p>If you don&#8217;t get any compilation errors you should be in emacs + slime.</p>
<p>And there you have it, SBCL emacs and slime on Gentoo Hardened.</p>
<h3>Cavets</h3>
<p><b>1)</b> For some reason this approach adds some annoying extra text to vanilla SBCL start up that I can&#8217;t seem to get rid of</p>
<pre>

$ sbcl
This is SBCL 1.0.19, an implementation of ANSI Common Lisp.
More information about SBCL is available at &lt;http: //www.sbcl.org/&gt;.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
; loading system definition from
; /usr/share/common-lisp/systems/asdf-binary-locations.asd into
; #&lt;package "ASDF0"&gt;
; registering #&lt;system ASDF-BINARY-LOCATIONS {AAF8F51}&gt; as ASDF-BINARY-LOCATIONS
* </pre>
<p><b>2)</b> The system  I tested this on is a VPS so the kernel is a Xen kernel, not a hardened kernel, so there may be additional complications on a full hardened install.  Please let me know if you have any, and especially any working solutions.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mindstab.net/lisp-sbcl-emacs-slime-on-hardened-ish-gentoo-on-xen-take-2/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Install Lisp ASDF packages as a user with CLC</title>
		<link>http://www.mindstab.net/install-lisp-asdf-packages-as-a-user-with-clc/</link>
		<comments>http://www.mindstab.net/install-lisp-asdf-packages-as-a-user-with-clc/#comments</comments>
		<pubDate>Sun, 16 Aug 2009 03:38:27 +0000</pubDate>
		<dc:creator>Dan Ballard</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[Guide]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Lisp]]></category>

		<guid isPermaLink="false">http://www.mindstab.net/wordpress/?p=609</guid>
		<description><![CDATA[CLC or Common Lisp Controller is a system that other Lisp systems user to keep track of ASDF systems (a mouthful I know). By default, system packages are installed to /usr/share/common-lisp/ but what happens if you don&#8217;t have root access but still want to leverage the ease of use CLC installed ASDF packages provide? clc-register-user-package [...]]]></description>
			<content:encoded><![CDATA[<p>CLC or Common Lisp Controller is a system that other Lisp systems user to keep track of ASDF systems (a mouthful I know).  By default, system packages are installed to /usr/share/common-lisp/ but what happens if you don&#8217;t have root access but still want to leverage the ease of use CLC installed ASDF packages provide?</p>
<p> clc-register-user-package to the rescue!  Create ~/.clc/source and put your ASDF package there, then simply run</p>
<pre>
$ clc-register-user-package ~/.clc/source/package/package.asd
</pre>
<p>and volia, you can <i>(require :package)</i> from any of your Lisp systems there after.</p>
<p>It&#8217;s pretty awesome. :)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mindstab.net/install-lisp-asdf-packages-as-a-user-with-clc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Backup around firewalls with ssh and rsync to encrypted destinations</title>
		<link>http://www.mindstab.net/backup-around-firewalls-with-ssh-and-rsync-to-encrypted-destinations/</link>
		<comments>http://www.mindstab.net/backup-around-firewalls-with-ssh-and-rsync-to-encrypted-destinations/#comments</comments>
		<pubDate>Fri, 14 Aug 2009 20:09:08 +0000</pubDate>
		<dc:creator>Dan Ballard</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Guide]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.mindstab.net/wordpress/?p=589</guid>
		<description><![CDATA[I decided I really needed to work on a server backup system, so here are my notes on the system I have now. First things first, the files I want to backup are owned by all different users, so the only user who can run the backup process is root. Therefore I can&#8217;t just run [...]]]></description>
			<content:encoded><![CDATA[<p>I decided I really needed to work on a server backup system, so here are my notes on the system I have now.</p>
<p>First things first, the files I want to backup are owned by all different users, so the only user who can run the backup process is root.  Therefore I can&#8217;t just run rsync from my local machine and grab the files from the server, the backup process has to be run on the server and backup to the backup machine.  Now in my case this was a bit of a trick because the backup machine was behind a firewall, so the server had no direct line of communication to it.  So I wrote a script to turn on a reverse ssh port forward.</p>
<p><strong>recv-serv-backup.sh</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #660033;">-R</span> <span style="color: #000000;">8000</span>:127.0.0.1:<span style="color: #000000;">22</span> <span style="color: #660033;">-N</span> user<span style="color: #000000; font-weight: bold;">@</span>kvasir.mindstab.net</pre></div></div>

<p>When run on the backup machine behind a firewall, it connects to the server (kvasir) and listens on port 8000.  When ssh on kvasir connects to port 8000 it redirects that traffic to local port 22, the ssh port of the backup machine.  This is how the firewall is gotten around.  Reverse port mapping is a cool trick to master.</p>
<p>Next as root on kvasir I generated a public ssh key and put it on the backup machine so root could automatically log on repeatedly to the back up machine (think lots of rsync calls) once the key was loaded once.  Then I hooked up the key to keychain.  That is all better outlined at:<br />
<a href="http://www.gentoo.org/doc/en/articles/openssh-key-management-p1.xml">Gentoo Linux Documentation: OpenSSH key management, Part 1</a> and<br />
<a href="http://www.gentoo.org/doc/en/articles/openssh-key-management-p2.xml">Gentoo Linux Documentation: OpenSSH key management, Part 2</a>.</p>
<p>The all I needed to do was poke the rsync syntax to use the nonstandard ssh port for backup.  The best method I found was </p>
<pre>
rsync -e "ssh -p 8000" -av
</pre>
<p>rsync for those of you who don&#8217;t know is a great little backup tools.  It&#8217;s like a smart (in that it only copies files that have been modified since the last backup) network aware (since it can use ssh) copy tool.  Simple but really useful.</p>
<p>So with that I wrote a backup script on the server</p>
<p><strong>server-backup.sh</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
&nbsp;
backup <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;$1...&quot;</span>
        <span style="color: #007800;">DST</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{split($0,a,&quot;/&quot;);  result = &quot;/&quot;; for (i=2 ; i &lt; length(a)  ; i++)   result = result &quot;/&quot; a[i];  print result;  };'</span><span style="color: #000000; font-weight: bold;">`</span>
        rsync <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;ssh -p 8000&quot;</span> <span style="color: #660033;">-acv</span> <span style="color: #007800;">$1</span> dan<span style="color: #000000; font-weight: bold;">@</span>127.0.0.1:~<span style="color: #000000; font-weight: bold;">/</span>kvasir<span style="color: #007800;">$DST</span> ;
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
backup <span style="color: #ff0000;">&quot;/svn&quot;</span>
backup <span style="color: #ff0000;">&quot;/git&quot;</span>
...</pre></div></div>

<p>There is one caveat, rsync won&#8217;t create subdirectories on the other side specified in the path so you need to create the basic directory structure.</p>
</pre>
<pre>
 rsync -e "ssh -p 8000" -av /git user@127.0.0.1:~/kvasir/git
</pre>
<p>is fine because it will create /git just fine, but</p>
<pre>
 rsync -e "ssh -p 8000" -av /home/user user@127.0.0.1:~/kvasir/home/user
</pre>
<p>will fail if ~/kvasir/<b>home</b> doesn't exist.  So you'll need to create the basic directory structure or enhance the backup function to strip out extra directories in the target path.</p>
<p>Finally, I didn't want anyone and everyone to potentially be able to gain access to private data on the backup machine, so the target directory needed to be encrypted.  There are a lot of options, but I opted for the easy encFS route and just installed "cryptkeeper" and had it setup the directory.</p>
<p>Now all I have to do is mount the encrypted backup directory, run the script to turn on the reverse ssh tunnel, and run the backup script, and I have an encrypted backup solution for my server that gets around firewalls.</p>
<p>Not bad.</p>
<p><b>References</b></p>
<ul>
<li><a href="http://pthree.org/2008/06/05/what-goes-out-can-come-back-in/">What Goes Out Can Come Back In -- SSH tricks</a></li>
<li><a href="http://www.google.com">Google</a>
</li>
</ul>
<ul></ul>
]]></content:encoded>
			<wfw:commentRss>http://www.mindstab.net/backup-around-firewalls-with-ssh-and-rsync-to-encrypted-destinations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Firefox and the new Hotmail</title>
		<link>http://www.mindstab.net/firefox-and-the-new-hotmail/</link>
		<comments>http://www.mindstab.net/firefox-and-the-new-hotmail/#comments</comments>
		<pubDate>Sat, 08 Nov 2008 04:42:42 +0000</pubDate>
		<dc:creator>Dan Ballard</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[Guide]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.mindstab.net/wordpress/?p=426</guid>
		<description><![CDATA[I don&#8217;t know who to be annoyed at actually. Microsoft just upgrade their hotmail interface, and hotmail is about the last MS product I use (that and the MSN server though I obviously don&#8217;t use their client). Anyways, suddenly hotmail wasn&#8217;t working for me which was a rather large pain. I searched around and found [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t know who to be annoyed at actually.  Microsoft just upgrade their hotmail interface, and hotmail is about the last MS product I use (that and the MSN server though I obviously don&#8217;t use their client).  Anyways, suddenly hotmail wasn&#8217;t working for me which was a rather large pain.  I searched around and found the solution.</p>
<p>In Firefox, goto &#8220;about:config&#8221; and put a filter of &#8220;vendor&#8221; in and hit enter.  Change general.useragent.vendor from &#8220;Ubuntu&#8221; to &#8220;Firefox&#8221;.  </p>
<p>Then it works fine.  It&#8217;s annoying MS is still doing such browser specific tweeking and it breaks on something so small, but then again, it does seem that they at least support vanilla Firefox.  I don&#8217;t know how important the vendor string is but if it&#8217;s breaking compatibility maybe Canoncial should leave it alone?  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.mindstab.net/firefox-and-the-new-hotmail/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Lisp (SBCL) on Hardened Gentoo</title>
		<link>http://www.mindstab.net/lisp-sbcl-on-hardened-gentoo/</link>
		<comments>http://www.mindstab.net/lisp-sbcl-on-hardened-gentoo/#comments</comments>
		<pubDate>Sat, 21 Jun 2008 07:07:16 +0000</pubDate>
		<dc:creator>Dan Ballard</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[Emacs]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Guide]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Lisp]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.mindstab.net/wordpress/?p=297</guid>
		<description><![CDATA[Edit (2010-09-16): I tried again with much better success. Read the new version of this guide at: http://www.mindstab.net/wordpress/archives/806 My server, mindstab.net, runs Hardened Gentoo. I like it. It provides nice features from grsecurity and PaX like memory randomization, non executable writable memory, etc. However, it really doesn&#8217;t get along so well with Lisp. Lisp in [...]]]></description>
			<content:encoded><![CDATA[<p><b>Edit <small>(2010-09-16)</small></b>:  I tried again with much better success.  Read the new version of this guide at:<br />
<a href="http://www.mindstab.net/wordpress/archives/806">http://www.mindstab.net/wordpress/archives/806</a></p>
<hr />
<p>My server, mindstab.net, runs Hardened Gentoo.  I like it.  It provides nice features from grsecurity and PaX like memory randomization, non executable writable memory, etc. However, it really doesn&#8217;t get along so well with Lisp.  Lisp in general seems to like executable and writable memory, and SBCL at least also doesn&#8217;t like randomized memory.  So it took a bit of work to get Lisp onto my server.</p>
<p><b>Approach 1: Failure</b><br />
I spent a bunch of time trying to patch the build process in portage to coax SBCL into building.  First, of course, I used gcc-config to disable the hardened gcc profile, and just use the vanilla one.  Then I created a suid root shell script to call &#8220;<i>paxctl -m -p -r -e $1</i>&#8221; so that the sandboxed build process could disable PaX features on the SBCL binaries.  I added the command to the ebuild, and created a patch to insert the command into SBCL&#8217;s build process.  The process goes like this, portage download&#8217;s the SBCL source and a pre-compiled SBCL binary.  The patched ebuild then calls my suid root script which disables PaX on the pre-compiled binary so it actually runs (as opposed to crashing under PaX) and then a new SBCL binary is built from the source and the pre-compiled binary builds a core file from the SBCL lisp source.  The patched SBCL make.sh then again calls the suid root script on the new binary, so it will run.  Then it should load the new core and recompile the system for itself.  Sadly, while it runs at least, it chokes on the core file and hangs while using 100% cpu.  I couldn&#8217;t get past this so I eventually gave up.  If anyone has any suggestions that&#8217;d be great.</p>
<p><b>Approach 2: Success</b><br />
So the actually solution was as follows:  Download the most recent precompiled SBCL binary from the website (1.0.15 for x86), run &#8220;<i>paxctl -p -e -m -r -x -s </i>&#8221; on src/runtime/sbcl (to cover all the bases). Then run  &#8220;<i>sh install.sh</i>&#8221; to install SBCL to /usr/local.  That&#8217;s it. </p>
<p>The problem with this is you can&#8217;t emerge lisp packages in portage, you have to install them by hand (unless maybe you want to fake inject the package into the portage database).</p>
<p>I downloaded a copy of slime, untarred it and popped it in my .emacs and I had a full lisp environment ready to go, and on my hardened machine no less.  Not so bad.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mindstab.net/lisp-sbcl-on-hardened-gentoo/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Turning your laptop into a wired to wireless router for your wirelessly challenged friends</title>
		<link>http://www.mindstab.net/turning-your-laptop-into-a-wired-to-wireless-router-for-your-wirelessly-challenged-friends/</link>
		<comments>http://www.mindstab.net/turning-your-laptop-into-a-wired-to-wireless-router-for-your-wirelessly-challenged-friends/#comments</comments>
		<pubDate>Sun, 25 May 2008 20:23:29 +0000</pubDate>
		<dc:creator>Dan Ballard</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Guide]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.mindstab.net/wordpress/archives/294</guid>
		<description><![CDATA[Say you&#8217;re at a party and the only internet is a wireless router and for whatever reason, no one can plug into it. Wireless internet only. You with your fancy laptop are sitting pretty and this is just fine. They your friend shows up lugging his clunky old desktop that only has an ethernet port [...]]]></description>
			<content:encoded><![CDATA[<p>Say you&#8217;re at a party and the only internet is a wireless router and for whatever reason, no one can plug into it.  Wireless internet only.  You with your fancy laptop are sitting pretty and this is just fine.  They your friend shows up lugging his clunky old desktop that only has an ethernet port for internet connectivity.  Is he out of luck?  Turns out not, because you an come to the rescue!</p>
<p>It&#8217;s really easy, especially with Ubuntu.  </p>
<p>To start with, you need to be a router, so you need firewall software that can do NAT (network address translation).  This is part kernel side (NAT and iptables options enabled and modules loaded) and part user space side, in the form of the program &#8216;iptables&#8217;, so make sure it is installed, which it is by default on Ubuntu (I think).</p>
<p>Now all you really need to do is add two routing rules, one says anything coming on the ethernet port should go through the NAT procedure, which basically means it&#8217;s IP headers are tweaked to make it look like they originated from your computer and then you send them along to the internet.  The second rule helps facilitate this (I&#8217;m a  little less sure what it does, but it&#8217;s needed).</p>
<p>In this case we are assuming the interface eth0 is the wired network and eth1 is the wireless.  Change as required.</p>
<pre>
iptables --table nat --append POSTROUTING --out-interface eth1 -j MASQUERADE
iptables --append FORWARD --in-interface eth0 -j ACCEPT
</pre>
<p>Next you just need to tell the kernel port forwarding should be turned on, and you can do this through the wonderful /proc filesystem.</p>
<pre>
echo 1  > /proc/sys/net/ipv4/ip_forward
</pre>
<p>Now you&#8217;re pretty much ready to go.  Connect to the wireless, presumably though NetworkManager or your wireless toll of choice.  Then enable the wired network manually.</p>
<pre>
ifconfig eth0 up 192.168.1.1
</pre>
<p>This turns on eth0 with a local network address of 192.168.1.1.  Now plug your friend&#8217;s computer into the ehternet port with a <b>crossover</b> ethernet cable or into a hub and then the hub into you with regular ethernet cable and have them manually pick an address on 192.168.1.* (or whatever local network you chose, it doesn&#8217;t matter) and set you (192.168.1.1) as the gateway router.</p>
<p>If this is a little much for them or they are running an OS that makes this non trivial, than its really another easy step for you to set up a DHCP server and do all the configuration for them :).</p>
<p>So install dhcpd, on Ubuntu it&#8217;s &#8216;dhcp3-server&#8217;, on Gentoo I think it&#8217;s just &#8216;dhcpd&#8217;.  </p>
<p>Now we have to configure it.  We have to tell it the gateway router, which is us (192.168.1.1), the nameservers (the servers in /etc/resolv.conf) and the pool of IPs to use and what interface/network to listen on.</p>
<p>Open the config file, on Ubuntu &#8216;<i>/etc/dhcp3dhcpd.conf</i>&#8216;.</p>
<p>The relevant parts are as follows</p>
<pre>
...
# servers in /etc/resolv.conf
option domain-name-servers 192.168.0.1;

...

# the local network you created
subnet 192.168.1.0 netmask 255.255.255.0 {
        #IPs free to assign
        range 192.168.1.100 192.168.1.200;
        #your computer, the router
        option routers 192.168.1.1;
}
</pre>
<p>And that&#8217;s it. (Re)Start the server</p>
<pre>
/etc/init.d/dhcp3-server restart
</pre>
<p>And you are now serving all the information your friend&#8217;s computer will need to automatically connect properly.  </p>
<p>They should now be online once they restart their internet connection.</p>
<p>One annoying thing about Ubuntu vs Gentoo is that on Ubuntu, the init system is a bit more kludgy and old fashioned.  Any server software installed is automatically configured to start at boot time, forever, which in this case isn&#8217;t what you want. You only want the dhcpd server to run very rarely, at parties, the rest of the time it&#8217;s a waste.  So we need to turn it&#8217;s auto starting off.  Apparently the /ubuntu init system barely supports this, we have to force it.</p>
<pre>
update-rc.d -f dhcp3-server remove
</pre>
<p>Now just turn it on when you need with its init.d file.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mindstab.net/turning-your-laptop-into-a-wired-to-wireless-router-for-your-wirelessly-challenged-friends/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

