<?xml version="1.0" encoding="utf-8"?>
<!-- generator="wordpress/2.1.3" -->
<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/"
	>

<channel>
	<title>codeblog</title>
	<link>http://www.outflux.net/blog</link>
	<description>code is freedom -- patching my itch</description>
	<pubDate>Sat, 28 Jun 2008 01:21:23 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.1.3</generator>
	<language>en</language>
			<item>
		<title>another gnome easter egg</title>
		<link>http://www.outflux.net/blog/archives/2008/06/27/another-gnome-easter-egg/</link>
		<comments>http://www.outflux.net/blog/archives/2008/06/27/another-gnome-easter-egg/#comments</comments>
		<pubDate>Sat, 28 Jun 2008 00:59:58 +0000</pubDate>
		<dc:creator>kees</dc:creator>
		
		<category><![CDATA[Blogging]]></category>

		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/archives/2008/06/27/another-gnome-easter-egg/</guid>
		<description><![CDATA[While I had tried the Alt-F2 &#8220;gegls from outer space&#8221; easter egg, I&#8217;d never done the &#8220;free the fish&#8221; one.  It was fun, but while looking around for how to disable it (&#8221;killall gnome-panel&#8221; &#8212; there is no programmatic way to stop the fish), I found another egg that I don&#8217;t think any one [...]]]></description>
			<content:encoded><![CDATA[<p>While I had tried the Alt-F2 &#8220;gegls from outer space&#8221; easter egg, I&#8217;d never done the &#8220;free the fish&#8221; one.  It was fun, but while looking around for how to disable it (&#8221;killall gnome-panel&#8221; &#8212; there is no programmatic way to stop the fish), I found another egg that I don&#8217;t think any one has mentioned before.  It re-uses the goat from the gegls game:</p>
<ol>
<li>Right-click an open panel area</li>
<li>Select &#8220;properties&#8221;</li>
<li>Right-click on a notebook tab 3 times</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2008/06/27/another-gnome-easter-egg/feed/</wfw:commentRss>
		</item>
		<item>
		<title>bold fonts in libvte (gnome-terminal, terminator)</title>
		<link>http://www.outflux.net/blog/archives/2008/06/22/bold-fonts-in-libvte-gnome-terminal-terminator/</link>
		<comments>http://www.outflux.net/blog/archives/2008/06/22/bold-fonts-in-libvte-gnome-terminal-terminator/#comments</comments>
		<pubDate>Sun, 22 Jun 2008 19:22:40 +0000</pubDate>
		<dc:creator>kees</dc:creator>
		
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/archives/2008/06/22/bold-fonts-in-libvte-gnome-terminal-terminator/</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2008/06/22/bold-fonts-in-libvte-gnome-terminal-terminator/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Linux Plumbers Conference 2008</title>
		<link>http://www.outflux.net/blog/archives/2008/06/18/linux-plumbers-conference-2008/</link>
		<comments>http://www.outflux.net/blog/archives/2008/06/18/linux-plumbers-conference-2008/#comments</comments>
		<pubDate>Wed, 18 Jun 2008 18:17:09 +0000</pubDate>
		<dc:creator>kees</dc:creator>
		
		<category><![CDATA[Blogging]]></category>

		<category><![CDATA[kernel.org]]></category>

		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/archives/2008/06/18/linux-plumbers-conference-2008/</guid>
		<description><![CDATA[The Call for Speakers (and registration) for the Linux Plumbers Conference is open!  Get those proposals in, register, and come join us in sunny Portland, OR.

The Linux Plumbers Conference was created to bring together the key developers involved in Linux plumbing - the &#8220;Linux plumbers&#8221; - and give them an opportunity to discuss problems [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://linuxplumbersconf.org/cfp/">Call for Speakers</a> (and <a href="http://linuxplumbersconf.org/register/">registration</a>) for the <a href="http://linuxplumbersconf.org/">Linux Plumbers Conference</a> is open!  Get those proposals in, register, and come join us in sunny Portland, OR.</p>
<blockquote><p>
The Linux Plumbers Conference was created to bring together the key developers involved in Linux plumbing - the &#8220;Linux plumbers&#8221; - and give them an opportunity to discuss problems face-to-face, both within subsystems and across subsystems. Participants include invited attendees, speakers selected through an open, competitive review process, and students. Registration is open to the general public as well.<br />
&#8230;<br />
The goal of the Plumbers Conference is to solve problems. The conference is arranged as a series of microconferences, each on a topic that is narrow enough to identify specific problem areas and brainstorm workable solutions. Each microconference is led by an expert in the field and organized to encourage discussion and problem solving.
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2008/06/18/linux-plumbers-conference-2008/feed/</wfw:commentRss>
		</item>
		<item>
		<title>zombie meme</title>
		<link>http://www.outflux.net/blog/archives/2008/06/12/zombie-meme/</link>
		<comments>http://www.outflux.net/blog/archives/2008/06/12/zombie-meme/#comments</comments>
		<pubDate>Fri, 13 Jun 2008 06:45:20 +0000</pubDate>
		<dc:creator>kees</dc:creator>
		
		<category><![CDATA[Blogging]]></category>

		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/archives/2008/06/12/zombie-meme/</guid>
		<description><![CDATA[Tollef posted a fun (and short) Zombie mem:
You are in a mall when zombies attack. You have:

One weapon
One song blasting on the speakers
One famous person to fight along side you.


I can&#8217;t resist.

BFG9000: ranged weapon that vaporizes multiple zombies at once.  I should be out of the mall before I&#8217;m out of ammo.
&#8220;Good Vibrations&#8221; by [...]]]></description>
			<content:encoded><![CDATA[<p>Tollef posted a fun (and short) <a href="http://err.no/personal/blog/tech/memes/2008-06-12-08-39_zombies.html">Zombie mem</a>:</p>
<blockquote><p>You are in a mall when zombies attack. You have:</p>
<ol>
<li>One weapon</li>
<li>One song blasting on the speakers</li>
<li>One famous person to fight along side you.</li>
</ol>
</blockquote>
<p>I can&#8217;t resist.</p>
<ol>
<li>BFG9000: ranged weapon that vaporizes multiple zombies at once.  I should be out of the mall before I&#8217;m out of ammo.</li>
<li>&#8220;Good Vibrations&#8221; by the Beach Boys: up beat and a little silly.</li>
<li>Jet Li: he could totally handle the zombies within slicing/kicking/clubbing range.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2008/06/12/zombie-meme/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Farwell Edgy</title>
		<link>http://www.outflux.net/blog/archives/2008/04/25/farwell-edgy/</link>
		<comments>http://www.outflux.net/blog/archives/2008/04/25/farwell-edgy/#comments</comments>
		<pubDate>Sat, 26 Apr 2008 02:39:41 +0000</pubDate>
		<dc:creator>kees</dc:creator>
		
		<category><![CDATA[Blogging]]></category>

		<category><![CDATA[Security]]></category>

		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/archives/2008/04/25/farwell-edgy/</guid>
		<description><![CDATA[Edgy is now officially at end-of-life.
Looking back through my build logs, I can see that my desktop spent 55 hours, 14 minutes, and 3 seconds on 406 builds related to edgy-security updates I was involved in publishing. These times obviously don’t include patch hunting/development, failed builds, testing, stuff done on my laptop or the porting [...]]]></description>
			<content:encoded><![CDATA[<p>Edgy is now officially at <a href="https://lists.ubuntu.com/archives/ubuntu-security-announce/2008-March/000680.html">end-of-life</a>.</p>
<p>Looking back through my build logs, I can see that my desktop spent 55 hours, 14 minutes, and 3 seconds on 406 builds related to edgy-security updates I was involved in publishing. These times obviously don’t include patch hunting/development, failed builds, testing, stuff done on my laptop or the porting machines, etc.  Comparing to my <a href="http://www.outflux.net/blog/archives/2007/04/13/farewell-breezy/">prior post</a> on this topic, here are the standings for other releases:</p>
<p>dapper: 44:48:24<br />
feisty: 58:49:04<br />
gutsy: 37:06:08<br />
hardy: 86:25:58</p>
<p>Hmm&#8230; I think my hardy numbers include devel builds times&#8230;  I&#8217;ll have to sort that out.  :)</p>
<p>Thank you Edgy!  I will remember you for your wonderful default -fstack-protector.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2008/04/25/farwell-edgy/feed/</wfw:commentRss>
		</item>
		<item>
		<title>getting Xv on the projector</title>
		<link>http://www.outflux.net/blog/archives/2008/04/05/getting-xv-on-the-projector/</link>
		<comments>http://www.outflux.net/blog/archives/2008/04/05/getting-xv-on-the-projector/#comments</comments>
		<pubDate>Sun, 06 Apr 2008 00:22:29 +0000</pubDate>
		<dc:creator>kees</dc:creator>
		
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/archives/2008/04/05/getting-xv-on-the-projector/</guid>
		<description><![CDATA[Today I spent the afternoon testing various video drivers and hardware with Bryce.  My &#8220;workflow&#8221; for watching a movie from my laptop on a projector in Hardy is much simpler now.  :)  For ATI, everything Just Works, with one small exception: Xv.  By default (at least with the open ATI driver), [...]]]></description>
			<content:encoded><![CDATA[<p>Today I spent the afternoon testing various video drivers and hardware with <a href="http://www.bryceharrington.org/drupal/">Bryce</a>.  My &#8220;workflow&#8221; for watching a movie from my laptop on a projector in Hardy is much simpler now.  :)  For ATI, everything Just Works, with one small exception: Xv.  By default (at least with the open ATI driver), the Xv port displays to the LCD on the laptop instead of out an attached VGA port.  This is controlled by the &#8220;XV_CRTC&#8221; Xv attribute, which is settable with the &#8220;xvattr&#8221; utility.</p>
<p>To watch a movie:</p>
<ul>
<li>Plug in projector</li>
<li>Open System/Preferences/Screen Resolution</li>
<li>Pick nice big resolution for the attached projector</li>
<li>Run &#8220;xvattr -a XV_CRTC -v 1&#8243; (&#8221;-v 0&#8243; will push Xv back to the LCD)</li>
<li>Eat popcorn</li>
</ul>
<p><img src="http://farm3.static.flickr.com/2301/2390438437_21e34d7a17.jpg?v=0" alt="projector" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2008/04/05/getting-xv-on-the-projector/feed/</wfw:commentRss>
		</item>
		<item>
		<title>SELinux in Hardy</title>
		<link>http://www.outflux.net/blog/archives/2008/03/16/selinux-in-hardy/</link>
		<comments>http://www.outflux.net/blog/archives/2008/03/16/selinux-in-hardy/#comments</comments>
		<pubDate>Sun, 16 Mar 2008 21:32:28 +0000</pubDate>
		<dc:creator>kees</dc:creator>
		
		<category><![CDATA[Security]]></category>

		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/archives/2008/03/16/selinux-in-hardy/</guid>
		<description><![CDATA[Hardy has seen a major overhaul in the SELinux department.  Prior to the Hardy UDS, the folks at Tresys had contacted me, asking &#8220;why doesn&#8217;t SELinux work with Ubuntu?&#8221; and I basically said, &#8220;because no one has given it any attention, yet &#8212; feel free to help out.&#8221;  And so they did!  [...]]]></description>
			<content:encoded><![CDATA[<p>Hardy has seen a major overhaul in the <a href="https://wiki.ubuntu.com/HardySELinux">SELinux</a> department.  Prior to the Hardy UDS, the folks at <a href="http://tresys.com/">Tresys</a> had contacted me, asking &#8220;why doesn&#8217;t SELinux work with Ubuntu?&#8221; and I basically said, &#8220;because no one has given it any attention, yet &#8212; feel free to help out.&#8221;  And so <a href="https://launchpad.net/~ccase-tresys/+packages">they</a> <a href="https://launchpad.net/~jtang-tresys/+packages">did</a>!  :)</p>
<p>As a result, if <a href="https://help.ubuntu.com/community/AppArmor">AppArmor</a> isn&#8217;t the MAC system you want, you can now install a functional SELinux system on Ubuntu with just a simple &#8220;sudo apt-get install selinux&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2008/03/16/selinux-in-hardy/feed/</wfw:commentRss>
		</item>
		<item>
		<title>using select on a fifo</title>
		<link>http://www.outflux.net/blog/archives/2008/03/09/using-select-on-a-fifo/</link>
		<comments>http://www.outflux.net/blog/archives/2008/03/09/using-select-on-a-fifo/#comments</comments>
		<pubDate>Mon, 10 Mar 2008 01:00:20 +0000</pubDate>
		<dc:creator>kees</dc:creator>
		
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/archives/2008/03/09/using-select-on-a-fifo/</guid>
		<description><![CDATA[The right way to handle on-going input from file descriptors is to use select().  All readable events are flagged (one such event is &#8220;end of file&#8221;, which is indicated by a 0-sized read()).  For example, if we&#8217;re reading from file descriptor fd:

  fd_set rfds;
  int rc;

  FD_ZERO(&#38;rfds);
  FD_SET(fd, &#38;rfds);

 [...]]]></description>
			<content:encoded><![CDATA[<p>The right way to handle on-going input from file descriptors is to use <code>select()</code>.  All readable events are flagged (one such event is &#8220;end of file&#8221;, which is indicated by a 0-sized <code>read()</code>).  For example, if we&#8217;re reading from file descriptor <code>fd</code>:</p>
<pre>
  fd_set rfds;
  int rc;

  FD_ZERO(&amp;rfds);
  FD_SET(fd, &amp;rfds);

  tv.tv_sec = 1;
  tv.tv_usec = 0;

  rc = select(fd + 1, &amp;rfds, NULL, NULL, &amp;tv);
  if (rc &gt; 0) {
    char buf[80];
    ssize_t got = read(fd, buf, sizeof(buf));
    if (got &lt; 0) {
      perror("read");
      return 1;
    }
    else if (got == 0) {
      printf("EOF\n");
      return 1;
    }
    else {
      printf("read bytes: %d\n", got);
    }
  }
</pre>
<p>When dealing with sockets, the above loop is sane &#8212; EOF means the other end hung up and you&#8217;ll never get more data from the file descriptor.  In the case of a FIFO, however, &#8220;0 length read&#8221; means there are no more FIFO writers &#8212; but more could attach later and continue feeding in data!  The problem with this is that select misbehaves and marks the file descriptor as &#8220;EOF&#8221; forever.  Only the initial <code>select()</code> call blocks until there is something to read &#8212; once it hits EOF, select will always immediately return, defeating the purpose of <code>select()</code>.</p>
<p>One solution is to re-open the FIFO, but you might <a href="https://launchpad.net/bugs/200299">miss writers</a> between your 0-length <code>read()</code> and the next <code>open()</code>.</p>
<p>The seemingly correct <a href="http://fixunix.com/unix/350803-use-select-fifo-after-has-closed.html">solution</a> is rather simple: the FIFO reader should open the FIFO as a writer also.  In this case, <code>select()</code> never thinks all the writers have vanished, so there is never an EOF condition, and the reader never misses any writers.  So, instead of <code>O_RDONLY</code>, use:</p>
<pre>
fd = open(FIFO_PATHNAME, <b>O_RDWR</b> | O_NONBLOCK);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2008/03/09/using-select-on-a-fifo/feed/</wfw:commentRss>
		</item>
		<item>
		<title>instaELF via GNU as</title>
		<link>http://www.outflux.net/blog/archives/2008/03/08/instaelf-via-gnu-as/</link>
		<comments>http://www.outflux.net/blog/archives/2008/03/08/instaelf-via-gnu-as/#comments</comments>
		<pubDate>Sat, 08 Mar 2008 22:47:12 +0000</pubDate>
		<dc:creator>kees</dc:creator>
		
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/archives/2008/03/08/instaelf-via-gnu-as/</guid>
		<description><![CDATA[Today I needed to generate a fake ELF file with specific section contents (I was testing &#8220;modinfo&#8221;, which expects to read the &#8220;.modinfo&#8221; ELF section).  For future reference, here&#8217;s how to create an empty .ko file that claims to have a GPL license:

$ cat &#60;&#60;EOM &#124; as - -o /tmp/fake.ko
> .section .modinfo
> .string "license=GPL"
> [...]]]></description>
			<content:encoded><![CDATA[<p>Today I needed to generate a fake ELF file with specific section contents (I was testing &#8220;modinfo&#8221;, which expects to read the &#8220;.modinfo&#8221; ELF section).  For future reference, here&#8217;s how to create an empty .ko file that claims to have a GPL license:</p>
<pre>
$ cat &lt;&lt;EOM | as - -o /tmp/fake.ko
> .section .modinfo
> .string "license=GPL"
> EOM
</pre>
<pre>
$ modinfo /tmp/fake.ko
filename:       /tmp/fake.ko
license:        GPL
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2008/03/08/instaelf-via-gnu-as/feed/</wfw:commentRss>
		</item>
		<item>
		<title>swapping encryption, hurting your head</title>
		<link>http://www.outflux.net/blog/archives/2008/03/05/swapping-encryption-hurting-your-head/</link>
		<comments>http://www.outflux.net/blog/archives/2008/03/05/swapping-encryption-hurting-your-head/#comments</comments>
		<pubDate>Wed, 05 Mar 2008 19:18:15 +0000</pubDate>
		<dc:creator>kees</dc:creator>
		
		<category><![CDATA[Security]]></category>

		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/archives/2008/03/05/swapping-encryption-hurting-your-head/</guid>
		<description><![CDATA[Last week Soren helped me move my manually cryptsetup&#8217;d swap partition into the initramfs logic so that I could hibernate.  Bottom line was:

Create /etc/initramfs-tools/conf.d/cryptroot for your partition, based on the logic and defaults in /usr/share/initramfs-tools/scripts/local-top/cryptroot.
Convert the existing encrypted swap to the new configuration.
Update initrd, reboot, enjoy.

Assuming your swap partition (in encrypted form) is stored [...]]]></description>
			<content:encoded><![CDATA[<p>Last week <a href="http://warma.dk/blog/">Soren</a> helped me move my manually cryptsetup&#8217;d swap partition into the initramfs logic so that I could hibernate.  Bottom line was:</p>
<ol>
<li>Create <code>/etc/initramfs-tools/conf.d/cryptroot</code> for your partition, based on the logic and defaults in <code>/usr/share/initramfs-tools/scripts/local-top/cryptroot</code>.</li>
<li>Convert the existing encrypted swap to the new configuration.</li>
<li>Update initrd, reboot, enjoy.</li>
</ol>
<p>Assuming your swap partition (in encrypted form) is stored at /dev/laptopvg/swaprawlv, and you want your accessible swap partition as /dev/mapper/swap, here are the above steps in detail:</p>
<p>Doing step 1 is simple, we&#8217;re assuming the defaults from the cryptroot script above:</p>
<ul>
<pre>
echo source=/dev/laptopvg/swaprawlv target=swap > /etc/initramfs-tools/conf.d/cryptroot
</pre>
</ul>
<p>Step 2 hurt my head.  Make sure you&#8217;ve unmounted your swap before attempting this, or you can destroy the partition contents.  The parameters come from the cryptroot script again:</p>
<ul>
<pre>
swapoff /dev/mapper/swap
vol_id /dev/mapper/swap
cryptsetup -c aes-essiv:sha256 -h sha256 -s 256 create swap2 /dev/laptopvg/swaprawlv
dd if=/dev/mapper/swap of=/dev/mapper/swap2 bs=4k
cryptsetup remove swap
vol_id /dev/mapper/swap2
</pre>
</ul>
<p>Step 3 is simple again:</p>
<ul>
<pre>
update-initramfs -u
shutdown -r now
</pre>
</ul>
<p>Ta-da!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2008/03/05/swapping-encryption-hurting-your-head/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Ubuntu Server administration</title>
		<link>http://www.outflux.net/blog/archives/2008/02/23/ubuntu-server-administration/</link>
		<comments>http://www.outflux.net/blog/archives/2008/02/23/ubuntu-server-administration/#comments</comments>
		<pubDate>Sun, 24 Feb 2008 02:24:22 +0000</pubDate>
		<dc:creator>kees</dc:creator>
		
		<category><![CDATA[Blogging]]></category>

		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/archives/2008/02/23/ubuntu-server-administration/</guid>
		<description><![CDATA[Apress was kind enough to send me a copy of their new book &#8220;Beginning Ubuntu Server Administration: From Novice to Professional&#8221; by Sander van Vugt.  Overall, I was very impressed with this book &#8212; it was well written, filled with applicable examples, covered a wide range of topics, and provided background for people new [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://apress.com/">Apress</a> was kind enough to send me a copy of their new book &#8220;Beginning Ubuntu Server Administration: From Novice to Professional&#8221; by Sander van Vugt.  Overall, I was very impressed with this book &#8212; it was well written, filled with applicable examples, covered a wide range of topics, and provided background for people new to Ubuntu or Linux in general.  The book was written to Ubuntu 7.04, so there are a few places where 8.04 will make for an improved experience without having been changed too drastically.  All through the book I was pleased to see various slightly advanced topics covered well enough to get a reader started down the right path without getting them lost in the details.  I think this was especially true in the command line and scripting sections which were great for someone unfamiliar with what can be a daunting experience.</p>
<p>In disk management, a lot of time was spent discussing LVM, which I&#8217;m very fond of myself.  (Even LVM snapshots were covered!)  I have a hard time imagining running any computer without LVM, so it was great to see it get a solid chunk of attention.  The only thing I felt was missing from disk management was a discussion of RAID (md).  For server environments, I think this is a critical topic.  Providing redundancy against drive failure is, I think, even more important than demonstrating how to easily manage partition layouts with LVM.</p>
<p>In filesystem management, basic ACLs were covered as well as quota management.  I think quota management is an often neglected part of administration, so I was glad to see this covered.  In network management, basic iptables were outlined with good examples.  (Hardy&#8217;s &#8220;ufw&#8221; will help make this section even simpler in future revisions of the book.)  IPv6 was touched on, though I would have liked to see slightly more details.</p>
<p>Under service management I enjoyed the introduction to <a href="http://en.wikipedia.org/wiki/Public_key_infrastructure">PKI</a>, which is critical to understanding the basics of SSH and other services using SSL.  The examples for DNS, DHCP, NFS, and Samba were all very well done.  I think they make handy references for how to get a network or file-sharing server up and running in short order.</p>
<p>As another Hardy feature to call out, the addition of &#8220;virt-manager&#8221; will make the Virtualization section on <a href="http://en.wikipedia.org/wiki/Kernel-based_Virtual_Machine">KVM</a> much nicer to deal with.</p>
<p>I took some notes for ideas and corrections that may be a benefit to other readers of this book:</p>
<ul>
<li>I personally like suffixing VG and LV names with &#8220;vg&#8221; and &#8220;lv&#8221; just to be able to quickly distinguish them when looking at device names.</li>
<li>Administrators watching long-running &#8220;tail -f&#8221; output would benefit from using &#8220;tail -F&#8221; for when log files are rotated.</li>
<li>In the section on &#8220;Finding Files&#8221; I was expecting to see mention of &#8220;locate&#8221;.</li>
<li>When viewing compressed files: &#8220;zless&#8221; instead of &#8220;zcat FILE.gz | less&#8221;.</li>
<li>When discussing Job Control, I would have liked to see a mention of &#8220;screen&#8221; for managing long-running processes (kernel compiles, &#8220;top&#8221;, etc).  Not enough people know about &#8220;screen&#8221;.  :)</li>
<li>While the book was written to Feisty, it would be nice to have a short section in future versions on how to generate and use AppArmor profiles for the various running network services.</li>
<li>Instead of the manual symlink management for Apache modules and sites, administrators can use the &#8220;a2{dis,en}{site,mod}&#8221; tools.</li>
<li>Typos I saw: tailing &#8220;sudo&#8221; in mysql db creation example, &#8220;_netdec&#8221; should be &#8220;_netdev&#8221; in NFS fstab example.</li>
</ul>
<p>As I mentioned at the start &#8212; I think this is a great book for someone either new to Ubuntu server management or looking for simple service configuration references in a single place.  Thanks again to Apress for sending me a copy; I tried not to be too biased.  :)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2008/02/23/ubuntu-server-administration/feed/</wfw:commentRss>
		</item>
		<item>
		<title>OSS Security - OSU CS419 2008</title>
		<link>http://www.outflux.net/blog/archives/2008/02/20/oss-security-osu-cs419-2008/</link>
		<comments>http://www.outflux.net/blog/archives/2008/02/20/oss-security-osu-cs419-2008/#comments</comments>
		<pubDate>Thu, 21 Feb 2008 01:36:37 +0000</pubDate>
		<dc:creator>kees</dc:creator>
		
		<category><![CDATA[Security]]></category>

		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/archives/2008/02/20/oss-security-osu-cs419-2008/</guid>
		<description><![CDATA[Today I gave my presentation on Open Source Security to the Open Source class at Oregon State University.  Along with the presentation is a collection of examples of bad (and good) programs ranging from XSS, CSRF, temp races, system() and SSL misuse, stack and heap memory corruption, format strings, and all sorts of other [...]]]></description>
			<content:encoded><![CDATA[<p>Today I gave my presentation on <a href="http://outflux.net/osu/oss-security.odp">Open Source Security</a> to the <a href="https://secure.engr.oregonstate.edu/classes/eecs/winter2008/cs419/index.php/Main/Syllabus">Open Source class</a> at <a href="http://oregonstate.edu/">Oregon State University</a>.  Along with the presentation is a <a href="http://outflux.net/osu/demo/">collection of examples</a> of bad (and good) programs ranging from XSS, CSRF, temp races, system() and SSL misuse, stack and heap memory corruption, format strings, and all sorts of other things I could think of.  I gave this presentation in 2007 and was again honored to be asked back in 2008.  I think more schools need to be teaching dedicated Open Source classes, and I&#8217;m pleased to help out.  I&#8217;m hoping people will take away a few good ideas that will contribute to them producing safe code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2008/02/20/oss-security-osu-cs419-2008/feed/</wfw:commentRss>
		</item>
		<item>
		<title>firefox trick and recovery help</title>
		<link>http://www.outflux.net/blog/archives/2008/02/16/firefox-trick-and-recovery-help/</link>
		<comments>http://www.outflux.net/blog/archives/2008/02/16/firefox-trick-and-recovery-help/#comments</comments>
		<pubDate>Sat, 16 Feb 2008 18:05:00 +0000</pubDate>
		<dc:creator>kees</dc:creator>
		
		<category><![CDATA[Web]]></category>

		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/archives/2008/02/16/firefox-trick-and-recovery-help/</guid>
		<description><![CDATA[To provide myself with slightly more safety through separation, I run two firefox profiles simultaneously.  One is the &#8220;general&#8221; browser for day-to-day viewing of random (and unauthenticated) sites, and the other is the &#8220;authenticated&#8221; browser, which contains the cookies for known sites I authenticate against.  The trick for this is having a launcher [...]]]></description>
			<content:encoded><![CDATA[<p>To provide myself with slightly more safety through separation, I run two firefox profiles simultaneously.  One is the &#8220;general&#8221; browser for day-to-day viewing of random (and unauthenticated) sites, and the other is the &#8220;authenticated&#8221; browser, which contains the cookies for known sites I authenticate against.  The trick for this is having a launcher that runs firefox without attempting to request a new window from the currently running profile:</p>
<pre><code>bash -c "MOZ_NO_REMOTE=1 firefox -ProfileManager"</code></pre>
<p>And in a recent bug-hunting session, I had a firefox profile that just kind of didn&#8217;t load javascript correctly any more (&#8221;change_feedback_state is not defined&#8221; on facebook).  I have no idea what was causing the issue (something not extensions &#8212; it didn&#8217;t go away in &#8220;<code>-safe-mode</code>&#8220;), and so I just reconstructed the profile one bit at a time, eventually leaving all of <code>prefs.js</code> out.  I used the <a href="http://kb.mozillazine.org/Transferring_data_to_a_new_profile_-_Firefox">migration checklist</a> I found at mozillazine.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2008/02/16/firefox-trick-and-recovery-help/feed/</wfw:commentRss>
		</item>
		<item>
		<title>full ASLR in Hardy</title>
		<link>http://www.outflux.net/blog/archives/2008/01/15/full-aslr-in-hardy/</link>
		<comments>http://www.outflux.net/blog/archives/2008/01/15/full-aslr-in-hardy/#comments</comments>
		<pubDate>Tue, 15 Jan 2008 19:07:45 +0000</pubDate>
		<dc:creator>kees</dc:creator>
		
		<category><![CDATA[Security]]></category>

		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/archives/2008/01/15/full-aslr-in-hardy/</guid>
		<description><![CDATA[Thanks to all the people that worked on it from the coding, breaking, testing, and refactoring, Hardy is now sporting the last piece of full Address Space Layout Randomization support.  ASLR has been mostly unchanged since Dapper, when the first bits of ASLR went in: stack and mmap (library) randomization.  Those changes made [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to all the people that worked on <a href="http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-hardy.git;a=commitdiff_plain;h=fe327f26046d22c9c14739aff21bb2dfd35aa7c9;hp=244d40f1a4391809262097c4cd72a086d1b498a3">it</a> from the coding, breaking, testing, and refactoring, Hardy is now sporting the last piece of full <a href="http://en.wikipedia.org/wiki/ASLR">Address Space Layout Randomization</a> support.  ASLR has been mostly unchanged since Dapper, when the first bits of ASLR went in: stack and mmap (library) randomization.  Those changes made simple stack overflow, heap overflow, and <a href="http://en.wikipedia.org/wiki/Return-to-libc_attack">return-into-libc</a> attacks much less trivial.  Now in Hardy, with the VDSO and brk (text) randomization, things are even more difficult for attackers to exploit.</p>
<p>For binaries that have been compiled with -pie (<a href="http://en.wikipedia.org/wiki/Position-independent_code#Position-independent_executables">Position Independent Executable</a>), the kernel is finally able to take advantage of it.  As an example, openssh is already using this compile option, and the results are easy to see.  Here are the processes from two SSH connections:</p>
<pre>
$ pstree -lp | grep sshd
        |-sshd(7243)-+-sshd(<strong>9136</strong>)&#8212;sshd(9140)&#8212;bash(9142)-+-grep(15380)
        |            +-sshd(<strong>9181</strong>)&#8212;sshd(9185)&#8212;bash(9186)
</pre>
<p>If we examine the memory layout of both sshd processes (9136 and 9181), we can see no user-space memory locations are shared:</p>
<pre>
$ sudo cat /proc/9136/maps
7ff69df86000-7ff69e0c6000 rw-s 00000000 00:09 34320                      /dev/zero (deleted)
7ff69e0c6000-7ff69e0c9000 r-xp 00000000 fe:15 480495                     /lib/security/pam_limits.so
...
7ff6a1fc8000-7ff6a1fd0000 rw-p 7ff6a1fc8000 00:00 0
7ff6a1ff7000-7ff6a1ffa000 rw-p 7ff6a1ff7000 00:00 0
7ff6a1ffa000-7ff6a1ffc000 rw-p 0001d000 fe:15 1040531                    /lib/ld-2.7.so
7ff6a1ffc000-7ff6a205b000 r-xp 00000000 fe:15 98598                      /usr/sbin/sshd
7ff6a225a000-7ff6a225d000 rw-p 0005e000 fe:15 98598                      /usr/sbin/sshd
7ff6a225d000-7ff6a2289000 rw-p 7ff6a225d000 00:00 0                      [heap]
7fffaa045000-7fffaa05a000 rw-p 7ffffffea000 00:00 0                      [stack]
7fffaa1fe000-7fffaa200000 r-xp 7fffaa1fe000 00:00 0                      [vdso]
...
</pre>
<pre>
$ sudo cat /proc/9181/maps
7f05a07b8000-7f05a08f8000 rw-s 00000000 00:09 35989                      /dev/zero (deleted)
7f05a08f8000-7f05a08fb000 r-xp 00000000 fe:15 480495                     /lib/security/pam_limits.so
...
7f05a47fa000-7f05a4802000 rw-p 7f05a47fa000 00:00 0
7f05a4829000-7f05a482c000 rw-p 7f05a4829000 00:00 0
7f05a482c000-7f05a482e000 rw-p 0001d000 fe:15 1040531                    /lib/ld-2.7.so
7f05a482e000-7f05a488d000 r-xp 00000000 fe:15 98598                      /usr/sbin/sshd
7f05a4a8c000-7f05a4a8f000 rw-p 0005e000 fe:15 98598                      /usr/sbin/sshd
7f05a4a8f000-7f05a4abb000 rw-p 7f05a4a8f000 00:00 0                      [heap]
7fffac877000-7fffac88c000 rw-p 7ffffffea000 00:00 0                      [stack]
7fffac9fe000-7fffaca00000 r-xp 7fffac9fe000 00:00 0                      [vdso]
...
</pre>
<p>The larger the memory space, the more effective ASLR is, so 64bit is the way to go.  And, as always, using 64bit kernels automatically gives you the <a href="http://en.wikipedia.org/wiki/NX_bit">NX bit</a> protections too.  Running a 64bit Hardy system is going to rock.  :)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2008/01/15/full-aslr-in-hardy/feed/</wfw:commentRss>
		</item>
		<item>
		<title>best universal remote evar</title>
		<link>http://www.outflux.net/blog/archives/2007/12/21/best-universal-remote-evar/</link>
		<comments>http://www.outflux.net/blog/archives/2007/12/21/best-universal-remote-evar/#comments</comments>
		<pubDate>Sat, 22 Dec 2007 02:16:32 +0000</pubDate>
		<dc:creator>kees</dc:creator>
		
		<category><![CDATA[Blogging]]></category>

		<category><![CDATA[Security]]></category>

		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/archives/2007/12/21/best-universal-remote-evar/</guid>
		<description><![CDATA[As a quick break from software, I spent a little time this evening soldering together my TV-B-Gone Kit.  It was way fun to break out all my microelectronics gear.  Gave me an excuse to clean up my desk.  This thing is the silliest tool ever: it&#8217;s programmed with a mess of TV [...]]]></description>
			<content:encoded><![CDATA[<p>As a quick break from software, I spent a little time this evening soldering together my <a href="http://www.ladyada.net/make/tvbgone/">TV-B-Gone Kit</a>.  It was way fun to break out all my microelectronics gear.  Gave me an excuse to clean up my desk.  This thing is the silliest tool ever: it&#8217;s programmed with a mess of TV remote codes &#8212; but only those to turn <em>off</em> TVs.  So, just point at a TV near you, hit the button, and it&#8217;ll almost certainly turn off.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2007/12/21/best-universal-remote-evar/feed/</wfw:commentRss>
		</item>
		<item>
		<title>VMware on Hardy</title>
		<link>http://www.outflux.net/blog/archives/2007/12/20/vmware-on-hardy/</link>
		<comments>http://www.outflux.net/blog/archives/2007/12/20/vmware-on-hardy/#comments</comments>
		<pubDate>Fri, 21 Dec 2007 00:17:46 +0000</pubDate>
		<dc:creator>kees</dc:creator>
		
		<category><![CDATA[Blogging]]></category>

		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/archives/2007/12/20/vmware-on-hardy/</guid>
		<description><![CDATA[For people using VMware, the new Hardy kernel requires updates to the source module tarballs that live in /usr/lib/vmware/modules/source/
Grab the three updated tarballs from the &#8220;vmware-any-any&#8221; tar.gz here.  Currently update115 works for me just fine.
]]></description>
			<content:encoded><![CDATA[<p>For people using VMware, the new Hardy kernel requires updates to the source module tarballs that live in <code>/usr/lib/vmware/modules/source/</code></p>
<p>Grab the three updated tarballs from the &#8220;vmware-any-any&#8221; tar.gz <a href="http://knihovny.cvut.cz/ftp/pub/">here</a>.  Currently update115 works for me just fine.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2007/12/20/vmware-on-hardy/feed/</wfw:commentRss>
		</item>
		<item>
		<title>force sendmail to deliver a specific item from the queue</title>
		<link>http://www.outflux.net/blog/archives/2007/12/18/force-sendmail-to-deliver-a-specific-item-from-the-queue/</link>
		<comments>http://www.outflux.net/blog/archives/2007/12/18/force-sendmail-to-deliver-a-specific-item-from-the-queue/#comments</comments>
		<pubDate>Wed, 19 Dec 2007 04:11:33 +0000</pubDate>
		<dc:creator>kees</dc:creator>
		
		<category><![CDATA[Networking]]></category>

		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/archives/2007/12/18/force-sendmail-to-deliver-a-specific-item-from-the-queue/</guid>
		<description><![CDATA[In case I or someone else ever needs this trick again, here&#8217;s my quick solution to work around QueueAge limits, and only force a specific queue id to get delivery retried:
/usr/sbin/sendmail -v -o MinQueueAge=0 -qI${ID_GOES_HERE}
]]></description>
			<content:encoded><![CDATA[<p>In case I or someone else ever needs this trick again, here&#8217;s my quick solution to work around QueueAge limits, and only force a specific queue id to get delivery retried:</p>
<p><code>/usr/sbin/sendmail -v -o MinQueueAge=0 -qI${ID_GOES_HERE}</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2007/12/18/force-sendmail-to-deliver-a-specific-item-from-the-queue/feed/</wfw:commentRss>
		</item>
		<item>
		<title>search for a crisp monospace true-type font</title>
		<link>http://www.outflux.net/blog/archives/2007/12/12/search-for-a-crisp-monospace-true-type-font/</link>
		<comments>http://www.outflux.net/blog/archives/2007/12/12/search-for-a-crisp-monospace-true-type-font/#comments</comments>
		<pubDate>Wed, 12 Dec 2007 17:36:49 +0000</pubDate>
		<dc:creator>kees</dc:creator>
		
		<category><![CDATA[Blogging]]></category>

		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/archives/2007/12/12/search-for-a-crisp-monospace-true-type-font/</guid>
		<description><![CDATA[I&#8217;ve been using xterms forever.  Whenever I try to switch to using a terminal with a true-type font, my eyes hurt after a few hours.  I&#8217;ve tried changing the various font-rendering options, and gone through lots of monospaced fonts &#8212; nothing gives the same clarity as the fixed raster fonts.  I suspect [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using xterms forever.  Whenever I try to switch to using a terminal with a true-type font, my eyes hurt after a few hours.  I&#8217;ve tried changing the various font-rendering options, and gone through lots of monospaced fonts &#8212; nothing gives the same clarity as the fixed raster fonts.  I suspect this is basically the same problem as <a href="http://gould.cx/ted/blog/Icon_Scaling">Icon Scaling</a>.  Things don&#8217;t work correctly when trying to line up a vector image against hard pixel edges.  I wish I could find a workable fix for this.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2007/12/12/search-for-a-crisp-monospace-true-type-font/feed/</wfw:commentRss>
		</item>
		<item>
		<title>CUPS banner template variables</title>
		<link>http://www.outflux.net/blog/archives/2007/09/28/cups-banner-template-variables/</link>
		<comments>http://www.outflux.net/blog/archives/2007/09/28/cups-banner-template-variables/#comments</comments>
		<pubDate>Sat, 29 Sep 2007 01:51:43 +0000</pubDate>
		<dc:creator>kees</dc:creator>
		
		<category><![CDATA[Networking]]></category>

		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.outflux.net/blog/archives/2007/09/28/cups-banner-template-variables/</guid>
		<description><![CDATA[A while back, I wanted to design some banner pages for a shared network printer that would show the name of the host that sent the request (none of the standard CUPS banners report this).  It was easy enough to define a custom banner page:

&#60;Printer lj4200&#62;
...
JobSheets shared-banner none
...
&#60;/Printer&#62;


Then, I could drop a modified banner [...]]]></description>
			<content:encoded><![CDATA[<p>A while back, I wanted to design some banner pages for a shared network printer that would show the name of the host that sent the request (none of the standard CUPS banners report this).  It was easy enough to define a custom banner page:</p>
<blockquote><pre>
&lt;Printer lj4200&gt;
...
JobSheets shared-banner none
...
&lt;/Printer&gt;
</pre>
</blockquote>
<p>Then, I could drop a modified banner into <code>/usr/share/cups/banners</code> with the filename &#8220;shared-banner&#8221;.  The banner is just a regular PostScript file, so I could muck around with it.  While looking at the &#8220;standard&#8221; banner, I saw some PS variables being used that had been defined by CUPS:</p>
<blockquote><pre>
...
  (Job ID: ) RIGHT
  2 copy                % Copy X &#038; Y
  moveto
  ({<strong>printer-name</strong>}-{<strong>job-id</strong>}) show
&#8230;
</pre>
</blockquote>
<p>I couldn&#8217;t find documentation on the available variables, but managed to track down some of the list at cupsGetJobs2 in <a href="http://svn.easysw.com/public/cups/trunk/cups/util.c">cups/utils.c</a>:</p>
<blockquote><p>
job-id<br />
job-priority<br />
job-k-octets<br />
job-state<br />
time-at-completed<br />
time-at-creation<br />
time-at-processing<br />
job-printer-uri<br />
document-format<br />
job-name<br />
job-originating-user-name
</p></blockquote>
<p>None of these had the sending host listed, so I continued searching.  Additional ones are defined in <a href="http://svn.easysw.com/public/cups/trunk/scheduler/ipp.c">scheduler/ipp.c</a>, including:</p>
<blockquote><p>
printer-name<br />
job-id<br />
job-billing<br />
job-hold-until<br />
job-sheets<br />
job-media-sheets-completed<br />
job-originating-host-name
</p></blockquote>
<p>&#8220;job-originating-host-name&#8221; did the trick for my banner:</p>
<blockquote><pre>
...
  (Host: ) RIGHT
  moveto
  ({job-originating-host-name}) show
...
</pre>
</blockquote>
<p>I&#8217;ve seen some other <a href="http://dvinfo.ifh.de/Cups_Admin#head-5d68564088ae2fa8fc15300ff6a1bc81f29bb43a">partial</a> <a href="http://www.easysw.com/printpro/howto.php?all">lists</a>, but I haven&#8217;t found an official complete list.  It&#8217;d be handy to see this documented better, since some variables aren&#8217;t valid until after the job is processed (job-sheets), so it&#8217;s only valid in the trailing banner, not the leading banner.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2007/09/28/cups-banner-template-variables/feed/</wfw:commentRss>
		</item>
		<item>
		<title>stupid BIOS tricks to find your 4G of RAM</title>
		<link>http://www.outflux.net/blog/archives/2007/09/27/stupid-bios-tricks-to-find-your-4g-of-ram/</link>
		<comments>http://www.outflux.net/blog/archives/2007/09/27/stupid-bios-tricks-to-find-your-4g-of-ram/#comments</comments>
		<pubDate>Thu, 27 Sep 2007 15:36:00 +0000</pubDate>
		<dc:creator>kees</dc:creator>
		
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://outflux.net/blog/archives/2007/09/27/stupid-bios-tricks-to-find-your-4g-of-ram/</guid>
		<description><![CDATA[A few months ago I upgraded my system to 4G of RAM.  Blinded by my shiny new DIMMs, I never actually looked at the output of &#8220;free&#8221;.  All I saw was that the system-monitor applet now showed lots of free memory.  Only recently did I notice that I only had 3G of [...]]]></description>
			<content:encoded><![CDATA[<p>A few months ago I upgraded my system to 4G of RAM.  Blinded by my shiny new DIMMs, I never actually looked at the output of &#8220;free&#8221;.  All I saw was that the system-monitor applet now showed lots of free memory.  Only recently did I notice that I only had 3G of RAM, instead of my expected 4G.  This is a rather common problem when running a 32bit OS, but I&#8217;ve been running 64bit for a while now.  In fact, since it&#8217;s such a common complaint for 32bit OSes, I didn&#8217;t have any luck Googling for an answer.  I did find references to chipset limitations (motherboards with only a 32bit memory bus), but &#8220;lshw&#8221; seemed to think I was okay.  I had 4 banks each showing:</p>
<blockquote><p>
        *-bank:0<br />
             description: DIMM DDR Synchronous 333 MHz (3.0 ns)<br />
             &#8230;<br />
             size: 1GB<br />
             width: <strong>64 bits</strong><br />
             clock: 333MHz (3.0ns)
</p></blockquote>
<p>On reboot, I also noted that my BIOS said I only had 3G.  I started to get worried, but managed to find a setting on my Northbridge for Memory to enable &#8220;Hardware memory hole&#8221;.  After that, both the BIOS and Linux were happy and seeing the full 4G.  I assume the BIOS just bumps the memory in the 3G region to above 4G, which makes for a silly kernel message:</p>
<blockquote><p>
[   24.617275] Memory: 3977852k/<strong>5259264k</strong> available (2281k kernel code, <strong>150272k reserved</strong>, 1182k data, 300k init)
</p></blockquote>
<p>But I don&#8217;t care.  :)  It works now, and my &#8220;free&#8221; output makes me happy again:</p>
<blockquote><pre>
             total       used       free     shared    buffers     cached
Mem:       3986156    3958396      27760          0      68268    2949472
-/+ buffers/cache:     940656    3045500
Swap:      3903672      38676    3864996
</pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2007/09/27/stupid-bios-tricks-to-find-your-4g-of-ram/feed/</wfw:commentRss>
		</item>
		<item>
		<title>stupid dpkg tricks when fighting XFS bugs</title>
		<link>http://www.outflux.net/blog/archives/2007/09/26/stupid-dpkg-tricks-when-fighting-xfs-bugs/</link>
		<comments>http://www.outflux.net/blog/archives/2007/09/26/stupid-dpkg-tricks-when-fighting-xfs-bugs/#comments</comments>
		<pubDate>Wed, 26 Sep 2007 23:26:28 +0000</pubDate>
		<dc:creator>kees</dc:creator>
		
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://outflux.net/blog/archives/2007/09/26/stupid-dpkg-tricks-when-fighting-xfs-bugs/</guid>
		<description><![CDATA[A few days ago, I found myself with corrupted libraries and other insanity after doing a &#8220;dist-upgrade&#8221;.  As it turns out, my filesystem was to blame.  After running xfs_repair on it, I used a handy short-cut to re-install all the packages that might have gotten caught in the breakage:

sudo apt-get &#8211;reinstall install $(grep [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago, I found myself with corrupted libraries and other insanity after doing a &#8220;dist-upgrade&#8221;.  As it turns out, my filesystem was to blame.  After running xfs_repair on it, I used a handy short-cut to re-install all the packages that might have gotten caught in the breakage:</p>
<blockquote><p>
sudo apt-get &#8211;reinstall install $(grep ^2007-09-24 /var/log/dpkg.log | cut -d\  -f4)
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2007/09/26/stupid-dpkg-tricks-when-fighting-xfs-bugs/feed/</wfw:commentRss>
		</item>
		<item>
		<title>0&#215;41 0&#215;41 0&#215;41 0&#215;41</title>
		<link>http://www.outflux.net/blog/archives/2007/09/24/0x41-0x41-0x41-0x41/</link>
		<comments>http://www.outflux.net/blog/archives/2007/09/24/0x41-0x41-0x41-0x41/#comments</comments>
		<pubDate>Tue, 25 Sep 2007 04:34:41 +0000</pubDate>
		<dc:creator>kees</dc:creator>
		
		<category><![CDATA[Security]]></category>

		<category><![CDATA[Vulnerabilities]]></category>

		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://outflux.net/blog/archives/2007/09/24/0x41-0x41-0x41-0x41/</guid>
		<description><![CDATA[When trying to find buffer overflows, it is common practice to try and fill memory with lots of &#8220;A&#8221; characters.  I first saw this when learning basic stack smashing techniques from Smashing the Stack for Fun and Profit, and have long wondered who did it first.  Ever since, I&#8217;ve always used long strings [...]]]></description>
			<content:encoded><![CDATA[<p>When trying to find buffer overflows, it is common practice to try and fill memory with lots of &#8220;A&#8221; characters.  I first saw this when learning basic stack smashing techniques from <a href="http://www.phrack.org/issues.html?issue=49&#038;id=14#article">Smashing the Stack for Fun and Profit</a>, and have long wondered who did it first.  Ever since, I&#8217;ve always used long strings of &#8220;A&#8221;s too (sometimes &#8220;B&#8221;s), and only recently started using better things like Metasploit&#8217;s <a href="http://metasploit.com/svn/framework3/trunk/tools/pattern_create.rb">pattern generator</a> and <a href="http://metasploit.com/svn/framework3/trunk/tools/pattern_offset.rb">offset reporter</a>.</p>
<p>I&#8217;m fairly used to seeing things like this from my gdb sessions:</p>
<blockquote><p>
Program received signal SIGSEGV, Segmentation fault.<br />
0&#215;41414141 in ?? ()<br />
(gdb)
</p></blockquote>
<p>It means I&#8217;ve managed to gain control of the instruction pointer, and I&#8217;m now to the stage of needing to locate and deliver a shellcode.</p>
<p>Over the weekend I had the pleasure of causing my kernel to do something similar, via an unprivileged userspace process, using the <a href="http://marc.info/?l=full-disclosure&#038;m=119062587407908&#038;w=2">vulnerability discovered</a> by Wojciech Purczynski:</p>
<blockquote><p>
[119647.578349] general protection fault: 0000 [3] SMP<br />
[119647.578357] CPU 0<br />
&#8230;<br />
[119647.578759] Code:  Bad RIP value.<br />
[119647.578774] RIP  [&lt;4141414141414141&gt;]
</p></blockquote>
<p>I hadn&#8217;t had an opportunity to play with <a href="http://fist.immunitysec.com/pipermail/dailydave/2007-March/004133.html">kernel shellcode</a> before, so I ended up learning a lot from Brad Spengler.  Before the day was up, I was left staring at a root shell.</p>
<p>This was a nasty bug.  Luckily, it&#8217;s &#8220;only&#8221; a local exploit, and only for x86_64 kernels.  But that&#8217;s still a very large number of installations.  Please make sure your x86_64 machines are <a href="http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=176df2457ef6207156ca1a40991c54ca01fef567">patched</a> against <a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-4573">CVE-2007-4573</a> (for Ubuntu, this is <a href="http://www.ubuntu.com/usn/usn-518-1">USN-518-1</a>).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2007/09/24/0x41-0x41-0x41-0x41/feed/</wfw:commentRss>
		</item>
		<item>
		<title>catching stack overflows in gdb as they happen</title>
		<link>http://www.outflux.net/blog/archives/2007/09/15/catching-stack-overflows-in-gdb-as-they-happen/</link>
		<comments>http://www.outflux.net/blog/archives/2007/09/15/catching-stack-overflows-in-gdb-as-they-happen/#comments</comments>
		<pubDate>Sun, 16 Sep 2007 04:57:05 +0000</pubDate>
		<dc:creator>kees</dc:creator>
		
		<category><![CDATA[Security]]></category>

		<category><![CDATA[Reverse Engineering]]></category>

		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://outflux.net/blog/archives/2007/09/15/catching-stack-overflows-in-gdb-as-they-happen/</guid>
		<description><![CDATA[Recently I was trying to help debug a stack overflow crash in wpa_supplicant.  The trouble with a stack crash is that you end up without a useful call history since the stack is left partially wrecked.  The compiler code for detecting stack overflows (SSP), sets up a canary value between the local variables [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I was trying to help debug a stack overflow <a href="https://bugs.launchpad.net/ubuntu/+source/wpasupplicant/+bug/138873">crash in wpa_supplicant</a>.  The trouble with a stack crash is that you end up without a useful call history since the stack is left partially wrecked.  The compiler code for detecting stack overflows (SSP), sets up a canary value between the local variables of the function and the stack frame.  When the function exits, it tests this canary value and aborts if it doesn&#8217;t match what it is expecting.  So, logically, to catch the stack overflow, gdb needs to be set up in a way to watch the canary location too.  Since the canary is only valid while in the function, gdb must be set up to have a memory watch only when the function is called.</p>
<p>Here is the function preamble:</p>
<blockquote><pre>
0x08081940 &lt;wpa_driver_wext_get_scan_results+0&gt;:        push   %ebp
0x08081941 &lt;wpa_driver_wext_get_scan_results+1&gt;:        mov    %esp,%ebp
0x08081943 &lt;wpa_driver_wext_get_scan_results+3&gt;:        push   %edi
0x08081944 &lt;wpa_driver_wext_get_scan_results+4&gt;:        push   %esi
0x08081945 &lt;wpa_driver_wext_get_scan_results+5&gt;:        push   %ebx
</pre>
</blockquote>
<p>Save registers, prepare %ebp.</p>
<blockquote><pre>
0x08081946 &lt;wpa_driver_wext_get_scan_results+6&gt;:        mov    $0x1000,%ebx
0x08081951 &lt;wpa_driver_wext_get_scan_results+17&gt;:       mov    0x8(%ebp),%eax
0x08081954 &lt;wpa_driver_wext_get_scan_results+20&gt;:       mov    0xc(%ebp),%edx
0x08081957 &lt;wpa_driver_wext_get_scan_results+23&gt;:       lea    0xffffffb0(%ebp),%esi
</pre>
</blockquote>
<p>Make room for local variables, copy some function arguments and local variables into registers.</p>
<blockquote><pre>
0x0808195a &lt;wpa_driver_wext_get_scan_results+26&gt;:       mov    %gs:0x14,%ecx
0x08081961 &lt;wpa_driver_wext_get_scan_results+33&gt;:       mov    %ecx,0xffffffec(%ebp)
<b>0&#215;08081964</b> &lt;wpa_driver_wext_get_scan_results+36&gt;:       xor    %ecx,%ecx
</pre>
</blockquote>
<p>Here&#8217;s the stack canary getting set, and the register cleared.  It&#8217;s saved at %ebp minus 0&#215;14 (0xffffffec signed is -0&#215;14):</p>
<blockquote><pre>
(gdb) printf "0x%xn", 0-0xffffffec
0x14
</pre>
</blockquote>
<p>Now for the function play-out:</p>
<blockquote><pre>
0x08081a37 &lt;wpa_driver_wext_get_scan_results+247&gt;:      mov    0xffffffec(%ebp),%edx
<b>0&#215;08081a3a</b> &lt;wpa_driver_wext_get_scan_results+250&gt;:      xor    %gs:0&#215;14,%edx
0&#215;08081a41 &lt;wpa_driver_wext_get_scan_results+257&gt;:      jne    0&#215;8081eae &lt;wpa_driver_wext_get_scan_results+1390&gt;
</pre>
</blockquote>
<p>There is the canary check.</p>
<blockquote><pre>
0x08081a47 &lt;wpa_driver_wext_get_scan_results+263&gt;:      add    $0xec,%esp
0x08081a4d &lt;wpa_driver_wext_get_scan_results+269&gt;:      pop    %ebx
0x08081a4e &lt;wpa_driver_wext_get_scan_results+270&gt;:      pop    %esi
0x08081a4f &lt;wpa_driver_wext_get_scan_results+271&gt;:      pop    %edi
0x08081a50 &lt;wpa_driver_wext_get_scan_results+272&gt;:      pop    %ebp
0x08081a51 &lt;wpa_driver_wext_get_scan_results+273&gt;:      ret
...
0x08081eae &lt;wpa_driver_wext_get_scan_results+1390&gt;:     call   0x804bdc8 &lt;__stack_chk_fail@plt&gt;
</pre>
</blockquote>
<p>Release local stack, pop saved registers and return.  Nearer the end is the call to __stack_chk_fail when the canary doesn&#8217;t match.</p>
<p>So, to watch the canary, we need to set up a memory watch after it as been set, and tear it down before we leave the function.  Respectively, we can use addresses 0&#215;08081964 and 0&#215;08081a3a (in bold above):</p>
<blockquote><pre>
(gdb) br *0x08081964
Breakpoint 1 at 0x8081964
(gdb) br *0x08081a3a
Breakpoint 2 at 0x8081a3a
</pre>
</blockquote>
<p>At the first breakpoint, we set a memory watch using a gdb-local variable, based on %ebp (we can&#8217;t use %ebp directly since it will change in lower function calls):</p>
<blockquote><pre>
(gdb) commands 1
Type commands for when breakpoint 1 is hit, one per line.
End with a line saying just "end".
&gt;silent
&gt;set variable $cow = (unsigned long*)($ebp - 0x14)
&gt;watch *$cow
&gt;cont
&gt;end
</pre>
</blockquote>
<p>Since I couldn&#8217;t find an easy way to track the memory watch number that was created during the first breakpoint, I just built a gdb counter, and deleted the memory watch when leaving, since I could predict gdb&#8217;s numbering (first watch will be &#8220;3&#8243;, following our breakpoints 1 and 2):</p>
<blockquote><pre>
(gdb) set variable $count = 3
(gdb) commands 2
Type commands for when breakpoint 2 is hit, one per line.
End with a line saying just "end".
&gt;silent
&gt;delete $count
&gt;set variable $count = $count + 1
&gt;cont
&gt;end
</pre>
</blockquote>
<p>Now we can run, and wait for the canary to get overwritten:</p>
<blockquote><pre>
(gdb) cont
Continuing.
Hardware watchpoint 3: *$cow
Hardware watchpoint 4: *$cow
...
Hardware watchpoint 12: *$cow
Hardware watchpoint 13: *$cow
Hardware watchpoint 13: *$cow

Old value = 4278845440
New value = 4278845546
0x0804eae6 in ?? ()
</pre>
</blockquote>
<p>We see the canary value is 0xFF0A0000 getting it&#8217;s little-endian first byte overwritten to FF0A006A.  We catch it before it has wrecked the stack, and we can see very clearly where we are:</p>
<blockquote><pre>
(gdb) bt
#0  hexstr2bin (hex=0x080a239d "6151663870517a74", buf=0x080a2395 "aQf8pQzt00000000j", len=8)
    at ../src/utils/common.c:88
#1  0x08082297 in wpa_driver_wext_get_scan_results (priv=0xb7dd816c,
    results=0x080a239d, max_size=0x79)
    at ../src/drivers/driver_wext.c:1383
...
(gdb) x/1i $eip
0x804eae6 &lt;hexstr2bin +54&gt;:      addl   $0x1,0xfffffff0(%ebp)
</pre>
</blockquote>
<p>On a closer look at the source, we realize wext_get_scan_custom got inlined into the function (it was static and only called from one place, so the compiler optimized it).  Further tracking in the source shows that the &#8220;16&#8243; value passed in should actually be &#8220;8&#8243; (the limit of the destination, not the source, buffer size).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2007/09/15/catching-stack-overflows-in-gdb-as-they-happen/feed/</wfw:commentRss>
		</item>
		<item>
		<title>flag captured again</title>
		<link>http://www.outflux.net/blog/archives/2007/08/07/flag-captured-again/</link>
		<comments>http://www.outflux.net/blog/archives/2007/08/07/flag-captured-again/#comments</comments>
		<pubDate>Wed, 08 Aug 2007 00:22:44 +0000</pubDate>
		<dc:creator>kees</dc:creator>
		
		<category><![CDATA[Security]]></category>

		<category><![CDATA[Reverse Engineering]]></category>

		<guid isPermaLink="false">http://outflux.net/blog/archives/2007/08/07/flag-captured-again/</guid>
		<description><![CDATA[I thought last year was going to be a fluke.  Somehow we managed to do it again.  Team 1@stPlace won DefCon Capture the Flag for a second year in a row.  If my sources are correct, this is the first repeat CTF winner at DefCon since the Ghetto Hackers.  I&#8217;m honored [...]]]></description>
			<content:encoded><![CDATA[<p>I thought <a href="http://outflux.net/blog/archives/2006/08/07/flag-captured/">last year</a> was going to be a fluke.  Somehow we managed to <a href="http://www.flickr.com/photo_zoom.gne?id=1043905143&#038;context=set-72157601280791450&#038;size=l">do it again</a>.  Team 1@stPlace won DefCon Capture the Flag for a second year in a row.  If my <a href="http://midnightresearch.com/hacking-contest-scoreboard/">sources</a> are correct, this is the first repeat CTF winner at DefCon since the Ghetto Hackers.  I&#8217;m honored to be on such a very talented team.  I&#8217;ve only just recently recovered from getting almost no sleep for 3 days.  :)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2007/08/07/flag-captured-again/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Farewell Breezy</title>
		<link>http://www.outflux.net/blog/archives/2007/04/13/farewell-breezy/</link>
		<comments>http://www.outflux.net/blog/archives/2007/04/13/farewell-breezy/#comments</comments>
		<pubDate>Sat, 14 Apr 2007 02:46:14 +0000</pubDate>
		<dc:creator>kees</dc:creator>
		
		<category><![CDATA[Blogging]]></category>

		<category><![CDATA[Security]]></category>

		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://outflux.net/blog/archives/2007/04/13/farewell-breezy/</guid>
		<description><![CDATA[Breezy is now officially at end-of-life.
Looking back through my build logs, I can see that my desktop spent 18 hours, 49 minutes, and 4 seconds on 108 builds related to the roughly 64 breezy-security updates I was involved in publishing.  So far, Dapper is at 132 builds totaling 19:59:40, and Edgy is at 142 [...]]]></description>
			<content:encoded><![CDATA[<p>Breezy is now officially at <a href="https://lists.ubuntu.com/archives/ubuntu-security-announce/2007-March/000504.html">end-of-life</a>.</p>
<p>Looking back through my build logs, I can see that my desktop spent 18 hours, 49 minutes, and 4 seconds on 108 builds related to the roughly 64 breezy-security updates I was involved in publishing.  So far, Dapper is at 132 builds totaling 19:59:40, and Edgy is at 142 builds totaling 23:32:28.  These times obviously don&#8217;t include patch hunting/development, failed builds, testing, stuff done on my laptop or the PPC machine, etc.  Even if it&#8217;s a bit incomplete, I think it&#8217;s fun to be able to point to some hard numbers about CPU time spent on Breezy updates.  :)</p>
<p>Thank you Breezy!  You have housed my MythTV installation very nicely, but now it&#8217;s time for some long over-due upgrades&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2007/04/13/farewell-breezy/feed/</wfw:commentRss>
		</item>
		<item>
		<title>AppArmor now in Feisty</title>
		<link>http://www.outflux.net/blog/archives/2007/04/02/apparmor-now-in-feisty/</link>
		<comments>http://www.outflux.net/blog/archives/2007/04/02/apparmor-now-in-feisty/#comments</comments>
		<pubDate>Mon, 02 Apr 2007 19:03:24 +0000</pubDate>
		<dc:creator>kees</dc:creator>
		
		<category><![CDATA[Security]]></category>

		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://outflux.net/blog/archives/2007/04/02/apparmor-now-in-feisty/</guid>
		<description><![CDATA[With the help of Magnus Runesson, Jesse Michael, Martin Pitt, and many others, I&#8217;ve got AppArmor packaged and uploaded into Feisty universe.  Prior to this, admins interested in a Mandatory Access Control system in Ubuntu only had SELinux available; now we have more of a choice.  For anyone wanting to try out AppArmor, [...]]]></description>
			<content:encoded><![CDATA[<p>With the help of Magnus Runesson, Jesse Michael, Martin Pitt, and many others, I&#8217;ve got <a href="http://forge.novell.com/modules/xfmod/project/?apparmor">AppArmor</a> packaged and <a href="https://launchpad.net/ubuntu/feisty/+source/apparmor">uploaded</a> into Feisty universe.  Prior to this, admins interested in a <a href="http://en.wikipedia.org/wiki/Mandatory_access_control">Mandatory Access Control</a> system in Ubuntu only had <a href="http://en.wikipedia.org/wiki/Selinux">SELinux</a> available; now we have more of a choice.  For anyone wanting to try out AppArmor, you will need to compile the modules, and install the base packages:</p>
<p><code> sudo apt-get install apparmor-modules-source dpatch<br />
 sudo m-a -v -t prepare<br />
 sudo m-a -v -t build apparmor-modules<br />
 sudo m-a -v -t install apparmor-modules<br />
 sudo apt-get install apparmor apparmor-utils apparmor-profiles libterm-readline-gnu-perl<br />
</code></p>
<p>With the default profiles, you can see one quick example of a confined process.  Try doing this:</p>
<p><code> ping localhost >/dev/null &#038;<br />
 sudo ps aZ | grep ping<br />
</code></p>
<p>In the first column, you should see what profile is being used to confine the process:</p>
<p><code> /bin/ping                       14351 pts/14   S      0:00 ping localhost<br />
 unconstrained                   15381 pts/14   S+     0:00 grep ping<br />
</code></p>
<p>The list of active profiles can be seen as root in <code>/sys/kernel/security/apparmor/profiles</code>, which are loaded from <code>/etc/apparmor.d/</code>.</p>
<p>To confine a process, use <code>aa-autodep</code> and <code>aa-logprof</code>.  For example, I wanted to confine my PDF document browser to only use /tmp (since I tend to only use it when browsing PDFs online):</p>
<ul>
<li> First, I create an empty profile in &#8220;complain&#8221; mode: <code>sudo aa-autodep evince</code></li>
<li> Next, I run evince like I normally would, including as many actions as I can think of (printing, preferences, help, etc).  Watching the output of <code>dmesg</code> you can follow the trail of all the actions evince is taking.  When I&#8217;m finished, I quit evince.</li>
<li> Next, I run <code>aa-logprof</code>, which runs through all the kernel audit output and offers suggestions on what to allow from evince.  Where appropriate, I select &#8220;abstrations&#8221; for things like Gnome, DNS, fonts, tmp dir usage, etc.  When a whole directory tree should be allowed, I double-glob the path (<code>/usr/share/evince/**</code>).  Once all the items from the log have been processed, the profile is saved.</li>
<li> Finally, I enable the profile with <code>aa-enforce evince</code>.  Any disallowed actions will show up in the kernel logs.</li>
</ul>
<p>Check out the resulting <a href="http://people.ubuntu.com/~kees/apparmor/profiles/usr.bin.evince.txt">profile for evince</a>.</p>
<p>Now if I end up reading a malicious PDF that takes advantage of some currently-unknown vulnerability in evince, it will be confined to the above AppArmor profile, unable to exec new processes, and only able to write to the Gnome preferences for evince.  (It&#8217;s also unable to read files out of /home, so that the above profile may be way too strict for common usage.  And to even get caught by AppArmor, the imaginary exploit would have to avoid the randomized stack, randomized heap, stack protector, and, since I&#8217;m running 64bit, the NX processor bit.) </p>
<p>Be aware, this is still a new bit of packaging for Ubuntu, so you may run into sneaky gotchas.  If that happens, please <a href="https://bugs.launchpad.net/ubuntu/feisty/+source/apparmor/+filebug">open a bug</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2007/04/02/apparmor-now-in-feisty/feed/</wfw:commentRss>
		</item>
		<item>
		<title>detecting space-vs-tab indentation type in vim</title>
		<link>http://www.outflux.net/blog/archives/2007/03/09/detecting-space-vs-tab-indentation-type-in-vim/</link>
		<comments>http://www.outflux.net/blog/archives/2007/03/09/detecting-space-vs-tab-indentation-type-in-vim/#comments</comments>
		<pubDate>Fri, 09 Mar 2007 18:36:17 +0000</pubDate>
		<dc:creator>kees</dc:creator>
		
		<category><![CDATA[General]]></category>

		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://outflux.net/blog/archives/2007/03/09/detecting-space-vs-tab-indentation-type-in-vim/</guid>
		<description><![CDATA[I edit a lot of other people&#8217;s code.  Dealing with indenting depth has always plagued me, and I&#8217;ve tried all sorts of things to try to address it, but the &#8220;real&#8221; problems I have are when tabs are mixed into code.
I personally use &#8220;4 spaces&#8221; for code indentation, and if I&#8217;m working on code [...]]]></description>
			<content:encoded><![CDATA[<p>I edit a lot of other people&#8217;s code.  Dealing with indenting depth has always plagued me, and I&#8217;ve tried all sorts of things to try to address it, but the &#8220;real&#8221; problems I have are when tabs are mixed into code.</p>
<p>I personally use &#8220;4 spaces&#8221; for code indentation, and if I&#8217;m working on code that uses 8, I just hit &#8220;tab&#8221; twice, and if I&#8217;m working on code that uses 2, I can just backspace over the 2-too-many spaces.  When the code has actual tabs, things break.  When the code has a <em>mix</em> of tabs and spaces, it becomes a serious head-ache.</p>
<p>I wrote some vim insanity to detect which indentation type was being used &#8220;the most&#8221; in a given source file.  If anyone has a simpler way to solve this (without switching to a different editor), I&#8217;m all ears.  What follows are some bits from my .vimrc.</p>
<p>First, my space-indentation defaults:</p>
<pre>
set noai ts=4 sw=8 expandtab
</pre>
<p>Next, Makefiles and debian/rules files always use tabs, so I have a base set of overrides:</p>
<pre>
" Makefile sanity
autocmd BufEnter ?akefile* set noet ts=8 sw=8
autocmd BufEnter */debian/rules set noet ts=8 sw=8
</pre>
<p>Finally, define a function that compares the number of lines that start with a tab to those that start with a space.  If the tabs outnumber the spaces, disable my defaults, and don&#8217;t expand tabs:</p>
<pre>
function Kees_settabs()
    if len(filter(getbufline(winbufnr(0), 1, "$"), 'v:val =~ "^\t"')) &gt; len(filter(getbufline(winbufnr(0), 1, "$"), 'v:val =~ "^ "'))
        set noet ts=8 sw=8
    endif
endfunction
autocmd BufReadPost * call Kees_settabs()
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2007/03/09/detecting-space-vs-tab-indentation-type-in-vim/feed/</wfw:commentRss>
		</item>
		<item>
		<title>OpenID and goofy Claims</title>
		<link>http://www.outflux.net/blog/archives/2007/02/03/openid-and-goofy-claims/</link>
		<comments>http://www.outflux.net/blog/archives/2007/02/03/openid-and-goofy-claims/#comments</comments>
		<pubDate>Sat, 03 Feb 2007 16:33:08 +0000</pubDate>
		<dc:creator>kees</dc:creator>
		
		<category><![CDATA[Inkscape]]></category>

		<category><![CDATA[Blogging]]></category>

		<category><![CDATA[Web]]></category>

		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://outflux.net/blog/archives/2007/02/03/openid-and-goofy-claims/</guid>
		<description><![CDATA[I&#8217;ve been having fun fighting religious battles and confusing people with in-jokes at jyte.com.  Other good claims:

Inkscape rocks!
Ubuntu is the best Linux desktop
Duran Duran was neither Duran nor Duran

Or just see what&#8217;s been claimed about linux in general.  Yay for silly social networking sites!  :)
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been having fun fighting <a href="http://jyte.com/cl/emacs-is-better-than-vi">religious battles</a> and confusing people with <a href="http://jyte.com/cl/coreyshields.com-is-a-splunk-banner-ad">in-jokes</a> at <a href="http://jyte.com/">jyte.com</a>.  Other good claims:</p>
<ul>
<li><a href="http://jyte.com/cl/inkscape-rocks">Inkscape rocks!</a></li>
<li><a href="http://jyte.com/cl/ubuntu-is-best-linux-desktop">Ubuntu is the best Linux desktop</a></li>
<li><a href="http://jyte.com/cl/duran-duran-was-neither-duran-nor-duran">Duran Duran was neither Duran nor Duran</a></li>
</ul>
<p>Or just see what&#8217;s been <a href="http://jyte.com/site/search?q=linux&#038;x=0&#038;y=0">claimed about linux</a> in general.  Yay for silly social networking sites!  :)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2007/02/03/openid-and-goofy-claims/feed/</wfw:commentRss>
		</item>
		<item>
		<title>CVE links via Greasemonkey</title>
		<link>http://www.outflux.net/blog/archives/2007/01/23/cve-links-via-greasemonkey/</link>
		<comments>http://www.outflux.net/blog/archives/2007/01/23/cve-links-via-greasemonkey/#comments</comments>
		<pubDate>Wed, 24 Jan 2007 06:00:17 +0000</pubDate>
		<dc:creator>kees</dc:creator>
		
		<category><![CDATA[Blogging]]></category>

		<category><![CDATA[Security]]></category>

		<category><![CDATA[Web]]></category>

		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://outflux.net/blog/archives/2007/01/23/cve-links-via-greasemonkey/</guid>
		<description><![CDATA[I spend a good bit of time reading CVEs but their entries are plain text, without links associated with their various recorded URLs.  I&#8217;m annoyed at having to select/paste to load a URL, so I had to go code a work-around.  :)
Since MozDev&#8217;s &#8220;linkify.user.js&#8221; was a bit heavy-handed, I wrote up a quick [...]]]></description>
			<content:encoded><![CDATA[<p>I spend a good bit of time reading <a href="http://cve.mitre.org/cve/">CVEs</a> but their <a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2006-6120">entries</a> are plain text, without links associated with their various recorded URLs.  I&#8217;m annoyed at having to select/paste to load a URL, so I had to go code a work-around.  :)</p>
<p>Since <a href="http://greasemonkey.mozdev.org/">MozDev</a>&#8217;s &#8220;<a href="http://downloads.mozdev.org/greasemonkey/linkify.user.js">linkify.user.js</a>&#8221; was a bit heavy-handed, I wrote up a quick hack based on similar code to only look at mitre.org&#8217;s LI tags: &#8220;<a href="http://outflux.net/greasemonkey/cve-links.user.js">cve-links.user.js</a>&#8220;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2007/01/23/cve-links-via-greasemonkey/feed/</wfw:commentRss>
		</item>
		<item>
		<title>attempting a secondlife build on ubuntu</title>
		<link>http://www.outflux.net/blog/archives/2007/01/10/attempting-a-secondlife-build-on-ubuntu/</link>
		<comments>http://www.outflux.net/blog/archives/2007/01/10/attempting-a-secondlife-build-on-ubuntu/#comments</comments>
		<pubDate>Wed, 10 Jan 2007 13:37:32 +0000</pubDate>
		<dc:creator>kees</dc:creator>
		
		<category><![CDATA[Blogging]]></category>

		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://outflux.net/blog/archives/2007/01/10/attempting-a-secondlife-build-on-ubuntu/</guid>
		<description><![CDATA[Linden Labs released their Second Life client under the GPL, so I figured I&#8217;d have a go at getting it compiled on Ubuntu.  Three libraries weren&#8217;t already packaged, so I threw together some initial attempts at getting them usable (libelfio, libopenjpeg, and libxmlrpc-epi).  I think the long-term approach will be trying to convince [...]]]></description>
			<content:encoded><![CDATA[<p>Linden Labs <a href="http://secondlife.com/developers/opensource/">released</a> their Second Life client under the GPL, so I figured I&#8217;d have a go at getting it <a href="https://wiki.secondlife.com/wiki/Compiling_the_viewer_%28Linux%29">compiled</a> on Ubuntu.  Three libraries weren&#8217;t already packaged, so I threw together some <a href="http://outflux.net/ubuntu/">initial attempts</a> at getting them usable (libelfio, libopenjpeg, and libxmlrpc-epi).  I think the long-term approach will be trying to convince Linden Labs to use stuff that is being actively maintained.</p>
<p>One big hurdle is audio, since <a href="http://www.fmod.org/">FMOD</a> doesn&#8217;t have a Free license.  I hope it can get replaced; I&#8217;d be curious to hear what Second Life needs from FMOD that some of the other Free stacks can&#8217;t do.</p>
<p>So, if you&#8217;re in a mood to play with getting the Second Life client running, hopefully my stab at packaging can help (I&#8217;ve solved a number of gotchas in the assumptions their build system made), and so far it built:</p>
<blockquote><p>$ ls -lh secondlife-x86_64-bin<br />
-rwxr-xr-x 1 kees kees 34M 2007-01-10 05:33 secondlife-x86_64-bin*<br />
$ ldd ./secondlife-x86_64-bin | wc -l<br />
77
</p></blockquote>
<p>Unfortunately, it immediately crashes when I load it.  :)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.outflux.net/blog/archives/2007/01/10/attempting-a-secondlife-build-on-ubuntu/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
