<?xml version="1.0" encoding="iso-8859-1" ?>
<rss version="2.0"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  xmlns:wfw="http://wellformedweb.org/CommentAPI/"
  >

 <channel>
  <title><![CDATA[Natulte::Blog]]></title>
  <link>http://natulte.net/index.php/blog</link>
  <description><![CDATA[]]></description>
  <copyright>Copyright 2008, David Anderson</copyright>
  <language>fr</language>
  <generator>Zwe v2.6-angela (alpha), http://zwe.bulix.org</generator>
  <pubDate>Thu, 07 Aug 2008 17:25:37 +0200</pubDate>
  <dc:creator>David Anderson</dc:creator>
  <item>
   <title><![CDATA[Epic DNS fail]]></title>
   <link>http://natulte.net/index.php/blog/531</link>
   <description>
And the lesson here is: Don't tweak the DNS zone for your domain when you're tired. You might end up writing, .121 instead of, say, .127, and end up blackholing your entire domain for 9 hours.

Gah.
   </description>
   <author><![CDATA[David Anderson]]></author>
   <category><![CDATA[English]]></category>
   <category><![CDATA[Geek]]></category>
   <guid>http://natulte.net/index.php/blog/531</guid>
   <pubDate><![CDATA[Thu, 07 Aug 2008 17:25:37 +0200]]></pubDate>
   <dc:creator><![CDATA[David Anderson]]></dc:creator>
   <content:encoded><![CDATA[<p>
And the lesson here is: Don't tweak the DNS zone for your domain when you're tired. You might end up writing, .121 instead of, say, .127, and end up blackholing your entire domain for 9 hours.</p>
<p>
Gah.</p>
   ]]></content:encoded>
   <wfw:commentRss>http://natulte.net/index.php/blog/rss/531/comments</wfw:commentRss>
  </item>

  <item>
   <title><![CDATA[(win-p :Common-Lisp) --> T]]></title>
   <link>http://natulte.net/index.php/blog/530</link>
   <description>
This weekend, following a stimulating discussion on Friday with Jose, I decided to walk a little further down the road of Lisp, and more specifically Common Lisp. After a couple of days with Peter Seibel's Practical Common Lisp, I am surprised to report that I can reasonably mutter out a Lisp program, albeit a little slowly, and also that I enjoy it very much.I've tried to get into Lisp several times in the past. The first time my brain was still all soft from C, and the prefix notation scared me off. Hey, I was still in Visual Basic rehab at the time, trying to make the nightmares stop.

The second time, through an AI course, I got decently fluent in very basic Emacs Lisp. Not actually interacting with Emacs that much, just using elisp as a Lisp dialect for getting the course projects done (for various reasons, elisp is a bit of a stupid choice of dialect for general-purpose programming, but never mind). Being young and stupid, I thought that I could just switch gears and pick up Common Lisp in my stride. 

I tore through some random Common Lisp tutorial with ease, reached macros, and my head exploded. It wasn't its fault, it had never seen anything like that. I had a gut feeling that macros were exceedingly cool, kind of the light sabers of programming: an elegant weapon for a more civilized age, that can cut through just about anything while making a cool sound. But I wasn't ready. So retreated once more, back to the familiar pastures of C, Python and Java.

Last year, after rebuilding and consolidating my brain in various ways, I tried again. This time, I understood how macros worked, and was suitably impressed at being able to run code at compile time to produces more code. But I lost interest. It seemed to me that Common Lisp was being used for really byzantine pieces of software, which could only be described with multiple uses of the 'meta-' prefix, and just generally spent a lot of time not doing anything of practical value. Doing anything that might benefit mere mortals seemed just out of grasp.

And so, I went back to the pastures of C, C++, Python, and other old friends. To my surprise, I did sometimes find myself pining for macros once or twice, when building particularly horrid little pieces of code that were trying really hard to abstract away concepts with no help from the language.

Which brings us to here and now. I've spent two days with Seibel's book, which addresses precisely what I felt last time, that Common Lisp cannot be used for pragmatic development of everyday software. The book elegantly demolishes this illusion by digging into a cornucopia of practical programming projects in Common Lisp, including: · A unit testing framework, using macros to define new syntactic constructs that can concisely define new tests, and abstract away the ugly book-keeping machinery · An ID3v2 tag parser. The approach used here is to first create, using macros, a domain-specific language for describing the structure of binary formats. The code to read, write and manipulate the tags is then derived from this very beautiful and concise definition. · A Shoutcast streaming server, demonstrating everything from network I/O to keeping an MP3 database to using our ID3v2 tag library · A little HTML template language. This little language lets programmers describe the HTML object tree in a delightfully minimal manner, as well as mixin some basic rendering logic (conditional blocks, looping ...). Peter then goes on to write both an interpreter and a compiler for this language, showing an abstraction technique that is still something pretty exclusive to Lisp: the creation of new languages to concisely express solutions to problems.

The great thing about Lisp, as so many have said before me, is the REPL. If you've ever used Python, Perl or Ruby, you know what I'm talking about: the ability to establish a dialog with the language. You feed it something, it tells you what it thinks. You change the code slightly, build up a little more functionality, tell the language about a new abstraction you'd like it to understand... And all the time, you have at your fingertips the ability to ask Lisp "What do you think? Does this look good? Could you evaluate this for me real quick, to see if I got it right?" I don't think that anyone coming from a purely edit-compile-run language background can really grasp the basic joy that there is in having a conversation with your language to build software. It's a very pleasant way of programming, and on a fundamental level it defies description. You have to try it.

Given how much Lisp code I've written, I am but a humble grasshopper. I've barely started my journey down this path, and to paraphrase Feynman, if I think I understand Common Lisp, I probably don't understand Common Lisp. Not yet at least. But, while writing the 70 lines of Lisp code that make up my first non-trivial program (a parser for the wire format of Google Protocol Buffers, if you care), there were brief moments when the clouds parted, and I caught a glimpse of where the path leads, all the way to the horizon.

I think I may enjoy walking the path.



The Road goes ever on and on
Down from the door where it began.
Now far ahead the Road has gone,
And I must follow, if I can,
Pursuing it with eager feet,
Until it joins some larger way
Where many paths and errands meet.
And whither then? I cannot say. 


   </description>
   <author><![CDATA[David Anderson]]></author>
   <category><![CDATA[English]]></category>
   <category><![CDATA[Geek]]></category>
   <guid>http://natulte.net/index.php/blog/530</guid>
   <pubDate><![CDATA[Mon, 28 Jul 2008 02:46:46 +0200]]></pubDate>
   <dc:creator><![CDATA[David Anderson]]></dc:creator>
   <content:encoded><![CDATA[<p>
This weekend, following a stimulating discussion on Friday with <a href="http://jaortega.wordpress.com/">Jose</a>, I decided to walk a little further down the road of Lisp, and more specifically Common Lisp. After a couple of days with Peter Seibel's <em><a href="http://gigamonkeys.com/book/">Practical Common Lisp</a></em>, I am surprised to report that I can reasonably mutter out a Lisp program, albeit a little slowly, and also that I enjoy it very much.<br /><br />I've tried to get into Lisp several times in the past. The first time my brain was still all soft from C, and the prefix notation scared me off. Hey, I was still in Visual Basic rehab at the time, trying to make the nightmares stop.</p>
<p>
The second time, through an AI course, I got decently fluent in very basic Emacs Lisp. Not actually interacting with Emacs that much, just using elisp as a Lisp dialect for getting the course projects done (for various reasons, elisp is a bit of a stupid choice of dialect for general-purpose programming, but never mind). Being young and stupid, I thought that I could just switch gears and pick up Common Lisp in my stride. </p>
<p>
I tore through some random Common Lisp tutorial with ease, reached macros, and my head exploded. It wasn't its fault, it had never seen anything like that. I had a gut feeling that macros were exceedingly cool, kind of the light sabers of programming: an elegant weapon for a more civilized age, that can cut through just about anything while making a cool sound. But I wasn't ready. So retreated once more, back to the familiar pastures of C, Python and Java.</p>
<p>
Last year, after rebuilding and consolidating my brain in various ways, I tried again. This time, I understood how macros worked, and was suitably impressed at being able to run code at compile time to produces more code. But I lost interest. It seemed to me that Common Lisp was being used for really byzantine pieces of software, which could only be described with multiple uses of the 'meta-' prefix, and just generally spent a lot of time not doing anything of practical value. Doing anything that might benefit mere mortals seemed just out of grasp.</p>
<p>
And so, I went back to the pastures of C, C++, Python, and other old friends. To my surprise, I did sometimes find myself pining for macros once or twice, when building particularly horrid little pieces of code that were trying really hard to abstract away concepts with no help from the language.</p>
<p>
Which brings us to here and now. I've spent two days with Seibel's book, which addresses precisely what I felt last time, that Common Lisp cannot be used for pragmatic development of everyday software. The book elegantly demolishes this illusion by digging into a cornucopia of practical programming projects in Common Lisp, including:<br /> &middot; A unit testing framework, using macros to define new syntactic constructs that can concisely define new tests, and abstract away the ugly book-keeping machinery<br /> &middot; An ID3v2 tag parser. The approach used here is to first create, using macros, a domain-specific language for describing the structure of binary formats. The code to read, write and manipulate the tags is then derived from this very beautiful and concise definition.<br /> &middot; A Shoutcast streaming server, demonstrating everything from network I/O to keeping an MP3 database to using our ID3v2 tag library<br /> &middot; A little HTML template language. This little language lets programmers describe the HTML object tree in a delightfully minimal manner, as well as mixin some basic rendering logic (conditional blocks, looping ...). Peter then goes on to write both an interpreter and a compiler for this language, showing an abstraction technique that is still something pretty exclusive to Lisp: the creation of new languages to concisely express solutions to problems.</p>
<p>
The great thing about Lisp, as so many have said before me, is the REPL. If you've ever used Python, Perl or Ruby, you know what I'm talking about: the ability to establish a dialog with the language. You feed it something, it tells you what it thinks. You change the code slightly, build up a little more functionality, tell the language about a new abstraction you'd like it to understand... And all the time, you have at your fingertips the ability to ask Lisp &quot;What do you think? Does this look good? Could you evaluate this for me real quick, to see if I got it right?&quot; I don't think that anyone coming from a purely edit-compile-run language background can really grasp the basic joy that there is in having a conversation with your language to build software. It's a very pleasant way of programming, and on a fundamental level it defies description. You have to try it.</p>
<p>
Given how much Lisp code I've written, I am but a humble grasshopper. I've barely started my journey down this path, and to paraphrase Feynman, if I think I understand Common Lisp, I probably don't understand Common Lisp. Not yet at least. But, while writing the 70 lines of Lisp code that make up my first non-trivial program (a parser for the wire format of Google Protocol Buffers, if you care), there were brief moments when the clouds parted, and I caught a glimpse of where the path leads, all the way to the horizon.</p>
<p>
I think I may enjoy walking the path.</p>

<blockquote><p>
<br />
The Road goes ever on and on<br />
Down from the door where it began.<br />
Now far ahead the Road has gone,<br />
And I must follow, if I can,<br />
Pursuing it with eager feet,<br />
Until it joins some larger way<br />
Where many paths and errands meet.<br />
And whither then? I cannot say. <br />
</p></blockquote>
<p></p>
   ]]></content:encoded>
   <wfw:commentRss>http://natulte.net/index.php/blog/rss/530/comments</wfw:commentRss>
  </item>

  <item>
   <title><![CDATA[Apache configuration with mod_macro]]></title>
   <link>http://natulte.net/index.php/blog/529</link>
   <description>
After my brief brush with Lighttpd, I found that it couldn't handle group authentication. So, instead, I decided to rewrite my Apache configuration, using mod_macro to obtain a more compact configuration. In the process, I discovered that I actually wanted that from the start, and only went to Lighttpd because it appeared to offer a simpler way to that. After a little poking around with it, its templating capabilities turned out to be quite weak compared to that of a properly equipped Apache.

The short version: My configuration is now 50% smaller, even with the addition of an extra virtual host or two. mod_macro is really kinda cool.If you don't know, mod_macro is an Apache module that lets you define macros. Astounding and surprising, isn't it? In web programming, you'd be more correct in calling them templates: a named chunk of configuration directives, in which you can perform limited variable expansion. As a simple example, here is a macro that restricts access to a path:



&lt;Macro RestrictAccess $url $userfile $username&gt;
  &lt;Location $url&gt;
    AuthType basic
    AuthName "Restricted access"
    AuthUserFile $userfile
    Require user $username
  &lt;/Location&gt;
&lt;/Macro&gt;




You then invoke this macro and pass it parameters to inject into the template:



Use RestrictAccess /private /srv/www/.htpasswd dave




Using this mechanism, you can dramatically reduce the size of your apache configuration, especially with several virtual hosts with redundant statements. I used macros to do just that. Let's construct a set of macros to aid us in configuring virtual hosts.

First of all, let's standardize and fold away all the tedious boilerplate of virtual hosts: defining the server name, the logging configuration, and default access directives.



&lt;Macro DocrootLoggingAccess $name $vhost_dir&gt;
  ServerName $name
  ServerAdmin dave+httpd_$name@...
  DocumentRoot ${APACHE_WWWROOT}/$vhost_dir
  CustomLog ${APACHE_LOGROOT}/$vhost_dir/access.log combined
  ErrorLog ${APACHE_LOGROOT}/$vhost_dir/error.log
  LogLevel warn
  ServerSignature off
  &lt;Directory ${APACHE_WWWROOT}/$vhost_dir&gt;
    AllowOverride None
    Order allow,deny
    Allow from all
  &lt;/Directory&gt;
&lt;/Macro&gt;




Note the use of APACHE_WWWROOT and APACHE_LOGROOT variables. These are environment variables, which Debian's apache package helpfully lets us define in /etc/apache2/envvars. Debian uses this mechanism to define things like the PID file path, which gets pushed into the configuration, but also gets included by debian helper scripts, like the start-stop daemon. I subverted the mechanism to define my own global configuration variables:



export APACHE_WWWROOT=/srv/www
export APACHE_LOGROOT=/srv/logs/www




This lets me define paths relative to these global roots, which makes the configuration look much nicer. With this macro alone, a virtual host for serving static files becomes as simple as:



&lt;VirtualHost *:80&gt;
  Use DocrootLoggingAccess static.natulte.net natulte.net/static
&lt;/VirtualHost&gt;




That will serve the content of /srv/www/natulte.net/static on http://static.natulte.net . Don't try it, it was just an example, I'm not actually serving anything there :-)

I won't go over the other macros I have in detail, but here is a quick overview:



# Configure a FastCGI dynamic instance to handle all .php files through PHP 5
Use PHP5

# Serve the Trac environment 'nxos' under URL path /nxos, via FastCGI.
# Logins to the environment should use authentication data for
# domain natulte.net, group 'nxos-dev'
#
# This macro makes use of an APACHE_TRACROOT envvar.
Use Trac nxos /nxos natulte.net nxos-dev

# Serve a read-only copy of the nxos mercurial repositories under /hg
#
# Uses the APACHE_HGROOT envvar.
Use MercurialReadOnly nxos /hg

# Same as above, but authenticate write access using natulte.net's
# authentication data (access to specific repositories is configured in
# each repo directly, apache needs only to identify potentially acceptable
# users).
Use Mercurial nxos /authenticated-hg natulte.net

# Configure the given URL path as a Dokuwiki instance (directory access and
# rewrite rules).
Use Dokuwiki /wiki

# Activate /server-status and /server-info on this vhost. Useful for
# debugging broken macro expansions.
Use ServerStatus
Use ServerInfo

# Small helper template: given a domain name, include configuration directives
# for HTTP Basic authentication using user/group data global to that domain.
# Reused in all the above templates that do authentication.
Use AuthData natulte.net




I won't bore you with any more gruelling details. Suffice it to say that, with this set of macros, the configuration for, say, nxt.natulte.net goes from a 50 line monstrosity of boilerplate and weird FastCGI directives, to:



# Notice how I can still add snippets of configuration. I just
# don't have boilerplate rubbish any more!
&lt;VirtualHost *:80&gt;
  Use DocrootLoggingAccess nxt.natulte.net natulte.net/nxt
  Use TracEnv nxos /nxos/trac natulte.net nxos
  Use MercurialReadOnly nxos /nxos/hg

  &lt;Location /nxos/docs&gt;
    Options Indexes
  &lt;/Location&gt;
&lt;/VirtualHost&gt;




Thanks to mod_macro, I'm happy with my web server configuration for the first time in a while. It's as code should be: compact, common elements refactored, no duplication, and above all, clear and easy to understand.
   </description>
   <author><![CDATA[David Anderson]]></author>
   <category><![CDATA[English]]></category>
   <category><![CDATA[Geek]]></category>
   <guid>http://natulte.net/index.php/blog/529</guid>
   <pubDate><![CDATA[Tue, 29 Apr 2008 03:07:11 +0200]]></pubDate>
   <dc:creator><![CDATA[David Anderson]]></dc:creator>
   <content:encoded><![CDATA[<p>
After my brief brush with <a href="http://lighttpd.net">Lighttpd</a>, I found that it couldn't handle group authentication. So, instead, I decided to rewrite my Apache configuration, using <tt>mod_macro</tt> to obtain a more compact configuration. In the process, I discovered that I actually wanted that from the start, and only went to Lighttpd because it appeared to offer a simpler way to that. After a little poking around with it, its templating capabilities turned out to be quite weak compared to that of a properly equipped Apache.</p>
<p>
The short version: My configuration is now 50% smaller, even with the addition of an extra virtual host or two. <tt>mod_macro</tt> is really kinda cool.<br /><br />If you don't know, <tt>mod_macro</tt> is an Apache module that lets you define macros. Astounding and surprising, isn't it? In web programming, you'd be more correct in calling them templates: a named chunk of configuration directives, in which you can perform limited variable expansion. As a simple example, here is a macro that restricts access to a path:</p>

<div class="cmd">
<pre>
&lt;Macro RestrictAccess $url $userfile $username&gt;
  &lt;Location $url&gt;
    AuthType basic
    AuthName &quot;Restricted access&quot;
    AuthUserFile $userfile
    Require user $username
  &lt;/Location&gt;
&lt;/Macro&gt;
</pre>
</div>
<p></p>
<p>
You then invoke this macro and pass it parameters to inject into the template:</p>

<div class="cmd">
<pre>
Use RestrictAccess /private /srv/www/.htpasswd dave
</pre>
</div>
<p></p>
<p>
Using this mechanism, you can dramatically reduce the size of your apache configuration, especially with several virtual hosts with redundant statements. I used macros to do just that. Let's construct a set of macros to aid us in configuring virtual hosts.</p>
<p>
First of all, let's standardize and fold away all the tedious boilerplate of virtual hosts: defining the server name, the logging configuration, and default access directives.</p>

<div class="cmd">
<pre>
&lt;Macro DocrootLoggingAccess $name $vhost_dir&gt;
  ServerName $name
  ServerAdmin dave+httpd_$name@...
  DocumentRoot ${APACHE_WWWROOT}/$vhost_dir
  CustomLog ${APACHE_LOGROOT}/$vhost_dir/access.log combined
  ErrorLog ${APACHE_LOGROOT}/$vhost_dir/error.log
  LogLevel warn
  ServerSignature off
  &lt;Directory ${APACHE_WWWROOT}/$vhost_dir&gt;
    AllowOverride None
    Order allow,deny
    Allow from all
  &lt;/Directory&gt;
&lt;/Macro&gt;
</pre>
</div>
<p></p>
<p>
Note the use of APACHE_WWWROOT and APACHE_LOGROOT variables. These are environment variables, which Debian's apache package helpfully lets us define in /etc/apache2/envvars. Debian uses this mechanism to define things like the PID file path, which gets pushed into the configuration, but also gets included by debian helper scripts, like the start-stop daemon. I subverted the mechanism to define my own global configuration variables:</p>

<div class="cmd">
<pre>
export APACHE_WWWROOT=/srv/www
export APACHE_LOGROOT=/srv/logs/www
</pre>
</div>
<p></p>
<p>
This lets me define paths relative to these global roots, which makes the configuration look much nicer. With this macro alone, a virtual host for serving static files becomes as simple as:</p>

<div class="cmd">
<pre>
&lt;VirtualHost *:80&gt;
  Use DocrootLoggingAccess static.natulte.net natulte.net/static
&lt;/VirtualHost&gt;
</pre>
</div>
<p></p>
<p>
That will serve the content of /srv/www/natulte.net/static on http://static.natulte.net . Don't try it, it was just an example, I'm not actually serving anything there :-)</p>
<p>
I won't go over the other macros I have in detail, but here is a quick overview:</p>

<div class="cmd">
<pre>
# Configure a FastCGI dynamic instance to handle all .php files through PHP 5
Use PHP5

# Serve the Trac environment 'nxos' under URL path /nxos, via FastCGI.
# Logins to the environment should use authentication data for
# domain natulte.net, group 'nxos-dev'
#
# This macro makes use of an APACHE_TRACROOT envvar.
Use Trac nxos /nxos natulte.net nxos-dev

# Serve a read-only copy of the nxos mercurial repositories under /hg
#
# Uses the APACHE_HGROOT envvar.
Use MercurialReadOnly nxos /hg

# Same as above, but authenticate write access using natulte.net's
# authentication data (access to specific repositories is configured in
# each repo directly, apache needs only to identify potentially acceptable
# users).
Use Mercurial nxos /authenticated-hg natulte.net

# Configure the given URL path as a Dokuwiki instance (directory access and
# rewrite rules).
Use Dokuwiki /wiki

# Activate /server-status and /server-info on this vhost. Useful for
# debugging broken macro expansions.
Use ServerStatus
Use ServerInfo

# Small helper template: given a domain name, include configuration directives
# for HTTP Basic authentication using user/group data global to that domain.
# Reused in all the above templates that do authentication.
Use AuthData natulte.net
</pre>
</div>
<p></p>
<p>
I won't bore you with any more gruelling details. Suffice it to say that, with this set of macros, the configuration for, say, <a href="http://nxt.natulte.net/">nxt.natulte.net</a> goes from a 50 line monstrosity of boilerplate and weird FastCGI directives, to:</p>

<div class="cmd">
<pre>
# Notice how I can still add snippets of configuration. I just
# don't have boilerplate rubbish any more!
&lt;VirtualHost *:80&gt;
  Use DocrootLoggingAccess nxt.natulte.net natulte.net/nxt
  Use TracEnv nxos /nxos/trac natulte.net nxos
  Use MercurialReadOnly nxos /nxos/hg

  &lt;Location /nxos/docs&gt;
    Options Indexes
  &lt;/Location&gt;
&lt;/VirtualHost&gt;
</pre>
</div>
<p></p>
<p>
Thanks to <tt>mod_macro</tt>, I'm happy with my web server configuration for the first time in a while. It's as code should be: compact, common elements refactored, no duplication, and above all, clear and easy to understand.</p>
   ]]></content:encoded>
   <wfw:commentRss>http://natulte.net/index.php/blog/rss/529/comments</wfw:commentRss>
  </item>

  <item>
   <title><![CDATA[Lighttpd]]></title>
   <link>http://natulte.net/index.php/blog/528</link>
   <description>
I've just wasted^Wspent a day trying to convert my web setup from Apache to Lighttpd. On the surface, Lighty looks like a very high performance web server, with a rather slick configuration format that looks quite enjoyable. I therefore spent a day or so getting up to speed on it, and converting my websites to use lighttpd. And I failed.Basically, what I take from this experience is that when lighttpd advocates say that it is better for simple setups, boy are they not kidding. The thing that finally beat me is that I want to unify all my authentication over my domain in a single htpasswd file, and then use groups to control access to various sub-areas. Except that, while a group file is specified in the lighttpd documentations, the server meekly logs the error "group: not implemented..." whenever a require group=foo is present in the ACL.

If, like me, you were drawn in by the prospect of being able to have a more compact configuration, but have anything but the very simplest setup, you may want to save yourself a day or so and head straight for Apache's mod_define and mod_macro instead.
   </description>
   <author><![CDATA[David Anderson]]></author>
   <category><![CDATA[English]]></category>
   <category><![CDATA[Geek]]></category>
   <guid>http://natulte.net/index.php/blog/528</guid>
   <pubDate><![CDATA[Sun, 27 Apr 2008 15:08:03 +0200]]></pubDate>
   <dc:creator><![CDATA[David Anderson]]></dc:creator>
   <content:encoded><![CDATA[<p>
I've just wasted^Wspent a day trying to convert my web setup from Apache to Lighttpd. On the surface, Lighty looks like a very high performance web server, with a rather slick configuration format that looks quite enjoyable. I therefore spent a day or so getting up to speed on it, and converting my websites to use lighttpd. And I failed.<br /><br />Basically, what I take from this experience is that when lighttpd advocates say that it is better for simple setups, boy are they not kidding. The thing that finally beat me is that I want to unify all my authentication over my domain in a single htpasswd file, and then use groups to control access to various sub-areas. Except that, while a group file is specified in the lighttpd documentations, the server meekly logs the error &quot;group: not implemented...&quot; whenever a require group=foo is present in the ACL.</p>
<p>
If, like me, you were drawn in by the prospect of being able to have a more compact configuration, but have anything but the very simplest setup, you may want to save yourself a day or so and head straight for Apache's mod_define and mod_macro instead.</p>
   ]]></content:encoded>
   <wfw:commentRss>http://natulte.net/index.php/blog/rss/528/comments</wfw:commentRss>
  </item>

  <item>
   <title><![CDATA[It's okay, we use AES!]]></title>
   <link>http://natulte.net/index.php/blog/527</link>
   <description>
I've been looking at password safe applications recently, to keep track of my growing number of accounts, both online and offline. And I've noticed something quite striking in all of them: none seems to find it necessary to explain exactly how they go about protecting my passwords. They all resort to what I'd call the crypto-defense: "The database uses AES for encryption, it's safe!"

Everyone and their dog uses AES, why is it safe?Secure because of AES, not necessarily. As with many things, it's not just what you have, it's all about how you use it. I could write a password store that uses AES to encrypt all fields but the password, and say "It's secure, it uses AES!" Of course this would be ridiculous, but it's just an extreme demonstration of the core point: using a currently secure cipher doesn't magically make your password store secure.

I looked around the sites of both Password Manager and KeePass for an overview of their datastore, and all I could find was "it's encrypted, so it's secure", followed by dissertations on how to securely copy a password from the store into an application.

Am I the only one who would like an overview of how the database is structured? Is each password encrypted individually, or is the final binary blob of a database encrypted? When I access one password, is the entire database sitting decrypted in ram, or just that entry? Is chaffing used so that an attacker is unable to infer password length by observing changes to the database's size? Are codes used to detect, and maybe even correct errors, so that an attacker flipping a bit doesn't alter my passwords, or at the very least makes it detectable?

All these are questions that a password store should be answering in an "overview of the system" page, without forcing me to go down into the code to reverse engineer it all.

Consequently, I'm still on the lookout for a good cross-platform password store. Ideally, all security critical code would be constrained to a small portable library, both for auditability and to ease the creation of varied UIs. If I can read the whole source of the core "database" layer (ie. no GUI) in one afternoon and convince myself that it is secure enough for me, I will feel much less bothered at the idea of using your software. Please don't force me to make a leap of faith with password storage.
   </description>
   <author><![CDATA[David Anderson]]></author>
   <category><![CDATA[English]]></category>
   <category><![CDATA[Geek]]></category>
   <guid>http://natulte.net/index.php/blog/527</guid>
   <pubDate><![CDATA[Sun, 06 Apr 2008 19:56:38 +0200]]></pubDate>
   <dc:creator><![CDATA[David Anderson]]></dc:creator>
   <content:encoded><![CDATA[<p>
I've been looking at password safe applications recently, to keep track of my growing number of accounts, both online and offline. And I've noticed something quite striking in all of them: none seems to find it necessary to explain exactly how they go about protecting my passwords. They all resort to what I'd call the crypto-defense: &quot;The database uses AES for encryption, it's safe!&quot;</p>
<p>
Everyone and their dog uses AES, why is it safe?<br /><br />Secure because of AES, not necessarily. As with many things, it's not just what you have, it's all about how you use it. I could write a password store that uses AES to encrypt all fields but the password, and say &quot;It's secure, it uses AES!&quot; Of course this would be ridiculous, but it's just an extreme demonstration of the core point: using a currently secure cipher doesn't magically make your password store secure.</p>
<p>
I looked around the sites of both Password Manager and KeePass for an overview of their datastore, and all I could find was &quot;it's encrypted, so it's secure&quot;, followed by dissertations on how to securely copy a password from the store into an application.</p>
<p>
Am I the only one who would like an overview of how the database is structured? Is each password encrypted individually, or is the final binary blob of a database encrypted? When I access one password, is the entire database sitting decrypted in ram, or just that entry? Is chaffing used so that an attacker is unable to infer password length by observing changes to the database's size? Are codes used to detect, and maybe even correct errors, so that an attacker flipping a bit doesn't alter my passwords, or at the very least makes it detectable?</p>
<p>
All these are questions that a password store should be answering in an &quot;overview of the system&quot; page, without forcing me to go down into the code to reverse engineer it all.</p>
<p>
Consequently, I'm still on the lookout for a good cross-platform password store. Ideally, all security critical code would be constrained to a small portable library, both for auditability and to ease the creation of varied UIs. If I can read the whole source of the core &quot;database&quot; layer (ie. no GUI) in one afternoon and convince myself that it is secure enough for me, I will feel much less bothered at the idea of using your software. Please don't force me to make a leap of faith with password storage.</p>
   ]]></content:encoded>
   <wfw:commentRss>http://natulte.net/index.php/blog/rss/527/comments</wfw:commentRss>
  </item>

  <item>
   <title><![CDATA[Today's fun fact]]></title>
   <link>http://natulte.net/index.php/blog/526</link>
   <description>
When you connect to an IRC server, you get spammed with a lot of messages reporting various information. Some of it is purely informational, such as the MOTD, for the eyes of the user. Others are of use to the IRC client itself.For example, this is numeric reply 004 from a DALnet IRC server (line-wrapped for readability):



:mozilla.se.eu.dal.net 004 daive mozilla.se.eu.dal.net bahamut-1.8(04)
   aAbcdefFghiIjkKmnoOrRswxXy bceiIjklLmMnoOprRstv




This message tells the client what server he is connected to (mozilla.se.eu.dal.net), what server software is running (bahamut-1.8(04)), what user modes this network knows about (aAbcdefFghiIjkKmnoOrRswxXy, one letter per mode), and what channel modes it knows about (bceiIjklLmMnoOprRstv, again one letter per mode).

All this information helps the IRC client to be a good citizen of that network, for example by avoiding attempting to set modes that aren't known to the network (which will fail anyway, so it's just a waste of network trafic).

Another one of those very useful messages is actually so big that it's transmitted in several messages: numeric reply 005.



:mozilla.se.eu.dal.net 005 dave NETWORK=DALnet SAFELIST MAXBANS=200 MAXCHANNELS=20 
  CHANNELLEN=32 KICKLEN=307 NICKLEN=30 TOPICLEN=307 MODES=6 CHANTYPES=#
  CHANLIMIT=#:20 PREFIX=(ov)@+ STATUSMSG=@+ :are available on this server
:mozilla.se.eu.dal.net 005 dave CASEMAPPING=ascii WATCH=128 SILENCE=10 ELIST=cmntu
  EXCEPTS INVEX CHANMODES=beI,k,jl,cimMnOprRst MAXLIST=b:200,e:100,I:100
  TARGMAX=DCCALLOW:,JOIN:,KICK:4,KILL:20,NOTICE:20,PART:,PRIVMSG:20,WHOIS:,WHOWAS:
  :are available on this server




What does all that garbage mean? Well, it looks like a list of directives giving information about some capabilities of the network. Some are fairly obvious: the network is called 'DALnet', the maximum topic length on a channel is 307 characters...

But others on that list are somewhat more cryptic. What does INVEX mean? What's with the strange comma-separated syntax for CHANMODES ? Fortunately, this is what we have RFCs for! This is what RFC 2812, "Internet Relay Chat: Client Protocol", has to say about numeric reply 005:



005    RPL_BOUNCE
       "Try server &lt;server name&gt;, port &lt;port number&gt;"

       - Sent by the server to a user to suggest an alternative
         server.  This is often used when the connection is
         refused because the server is already full.




If you're thinking that this doesn't look like our message from above at all, you would be right. I've tried five different IRC networks, and all transmit numeric reply 005 in the format I showed above. What probably happened is that someone came up with this capabilities system for IRC networks, and replaced an unused numeric reply with it. And, of course, didn't document it or anything. Because that would be too easy!

I can't help but think that this change was rather stupid. There is a huge gap of unused numeric replies from 006 to 199. And yet, whoever came up with this new message chose to replace an existing one, which means that we now have conflicting specifications and reality. It seems that this is unfortunately par for the course for IRC.

And, for extra credit, figure out what the third set of flags EFnet sends out in numeric reply 004 is for! It's also not in the spec.
   </description>
   <author><![CDATA[David Anderson]]></author>
   <category><![CDATA[English]]></category>
   <category><![CDATA[Geek]]></category>
   <guid>http://natulte.net/index.php/blog/526</guid>
   <pubDate><![CDATA[Sun, 23 Mar 2008 06:01:20 +0100]]></pubDate>
   <dc:creator><![CDATA[David Anderson]]></dc:creator>
   <content:encoded><![CDATA[<p>
When you connect to an <a href="http://en.wikipedia.org/wiki/Internet_Relay_Chat">IRC</a> server, you get spammed with a lot of messages reporting various information. Some of it is purely informational, such as the MOTD, for the eyes of the user. Others are of use to the IRC client itself.<br /><br />For example, this is <tt>numeric reply 004</tt> from a DALnet IRC server (line-wrapped for readability):</p>

<div class="cmd">
<pre>
:mozilla.se.eu.dal.net 004 daive mozilla.se.eu.dal.net bahamut-1.8(04)
   aAbcdefFghiIjkKmnoOrRswxXy bceiIjklLmMnoOprRstv
</pre>
</div>
<p></p>
<p>
This message tells the client what server he is connected to (<tt>mozilla.se.eu.dal.net</tt>), what server software is running (<tt>bahamut-1.8(04)</tt>), what <em>user modes</em> this network knows about (<tt>aAbcdefFghiIjkKmnoOrRswxXy</tt>, one letter per mode), and what <em>channel modes</em> it knows about (<tt>bceiIjklLmMnoOprRstv</tt>, again one letter per mode).</p>
<p>
All this information helps the IRC client to be a good citizen of that network, for example by avoiding attempting to set modes that aren't known to the network (which will fail anyway, so it's just a waste of network trafic).</p>
<p>
Another one of those very useful messages is actually so big that it's transmitted in several messages: <tt>numeric reply 005</tt>.</p>

<div class="cmd">
<pre>
:mozilla.se.eu.dal.net 005 dave NETWORK=DALnet SAFELIST MAXBANS=200 MAXCHANNELS=20 
  CHANNELLEN=32 KICKLEN=307 NICKLEN=30 TOPICLEN=307 MODES=6 CHANTYPES=#
  CHANLIMIT=#:20 PREFIX=(ov)@+ STATUSMSG=@+ :are available on this server
:mozilla.se.eu.dal.net 005 dave CASEMAPPING=ascii WATCH=128 SILENCE=10 ELIST=cmntu
  EXCEPTS INVEX CHANMODES=beI,k,jl,cimMnOprRst MAXLIST=b:200,e:100,I:100
  TARGMAX=DCCALLOW:,JOIN:,KICK:4,KILL:20,NOTICE:20,PART:,PRIVMSG:20,WHOIS:,WHOWAS:
  :are available on this server
</pre>
</div>
<p></p>
<p>
What does all that garbage mean? Well, it looks like a list of directives giving information about some capabilities of the network. Some are fairly obvious: the network is called 'DALnet', the maximum topic length on a channel is 307 characters...</p>
<p>
But others on that list are somewhat more cryptic. What does <tt>INVEX</tt> mean? What's with the strange comma-separated syntax for <tt>CHANMODES</tt> ? Fortunately, this is what we have <a href="http://en.wikipedia.org/wiki/RFC">RFC</a>s for! This is what <a href="http://irchelp.org/irchelp/rfc/rfc2812.txt">RFC 2812</a>, &quot;Internet Relay Chat: Client Protocol&quot;, has to say about numeric reply 005:</p>

<div class="cmd">
<pre>
005    RPL_BOUNCE
       &quot;Try server &lt;server name&gt;, port &lt;port number&gt;&quot;

       - Sent by the server to a user to suggest an alternative
         server.  This is often used when the connection is
         refused because the server is already full.
</pre>
</div>
<p></p>
<p>
If you're thinking that this doesn't look like our message from above at all, you would be right. I've tried five different IRC networks, and all transmit numeric reply 005 in the format I showed above. What probably happened is that someone came up with this capabilities system for IRC networks, and replaced an unused numeric reply with it. And, of course, didn't document it or anything. Because that would be too easy!</p>
<p>
I can't help but think that this change was rather stupid. There is a huge gap of unused numeric replies from 006 to 199. And yet, whoever came up with this new message chose to replace an existing one, which means that we now have conflicting specifications and reality. It seems that this is unfortunately par for the course for IRC.</p>
<p>
And, for extra credit, figure out what the third set of flags EFnet sends out in numeric reply 004 is for! It's also not in the spec.</p>
   ]]></content:encoded>
   <wfw:commentRss>http://natulte.net/index.php/blog/rss/526/comments</wfw:commentRss>
  </item>

  <item>
   <title><![CDATA[A simple templating static website engine]]></title>
   <link>http://natulte.net/index.php/blog/525</link>
   <description>
I'm looking for a website "engine" with a few very specific features. Actually, calling it a website engine is misleading, what I want is more a website generator.

I want something where I edit files containing HTML fragments, or something like restructured text. When I want to publish, I run a script that puts all these files through a templating engine that would work somewhat like Django's inheritance mechanism, which injects the fragments in a given base template. Then, I can publish these pages as static content, with ubercaching configured to have good performance.

I don't care much for any cool dynamic features. Making the timestamp at which the script runs available in the template engine might be cool, but that's about it.

It's simple enough for me to write this in Python, but before I start, does anyone know of a project that does this?

Edit: Found it! It's webgen.
   </description>
   <author><![CDATA[David Anderson]]></author>
   <category><![CDATA[English]]></category>
   <category><![CDATA[Geek]]></category>
   <guid>http://natulte.net/index.php/blog/525</guid>
   <pubDate><![CDATA[Sun, 02 Mar 2008 20:48:36 +0100]]></pubDate>
   <dc:creator><![CDATA[David Anderson]]></dc:creator>
   <content:encoded><![CDATA[<p>
I'm looking for a website &quot;engine&quot; with a few very specific features. Actually, calling it a website engine is misleading, what I want is more a website generator.</p>
<p>
I want something where I edit files containing HTML fragments, or something like restructured text. When I want to publish, I run a script that puts all these files through a templating engine that would work somewhat like Django's inheritance mechanism, which injects the fragments in a given base template. Then, I can publish these pages as static content, with ubercaching configured to have good performance.</p>
<p>
I don't care much for any cool dynamic features. Making the timestamp at which the script runs available in the template engine might be cool, but that's about it.</p>
<p>
It's simple enough for me to write this in Python, but before I start, does anyone know of a project that does this?</p>
<p>
<strong>Edit</strong>: Found it! It's <a href="http://webgen.rubyforge.org">webgen</a>.</p>
   ]]></content:encoded>
   <wfw:commentRss>http://natulte.net/index.php/blog/rss/525/comments</wfw:commentRss>
  </item>

  <item>
   <title><![CDATA[Ergonomics]]></title>
   <link>http://natulte.net/index.php/blog/524</link>
   <description>
I just got an ergonomic keyboard because a tendon in my right hand was aching a little. After a few hours of use and reduced WPM rate, my whole right arm from fingers to elbow is aching very painfully. So, the ergonomic keyboard is so far making things worse.

I must be defective.
   </description>
   <author><![CDATA[David Anderson]]></author>
   <category><![CDATA[English]]></category>
   <category><![CDATA[Geek]]></category>
   <category><![CDATA[Grrr]]></category>
   <guid>http://natulte.net/index.php/blog/524</guid>
   <pubDate><![CDATA[Fri, 08 Feb 2008 14:46:58 +0100]]></pubDate>
   <dc:creator><![CDATA[David Anderson]]></dc:creator>
   <content:encoded><![CDATA[<p>
I just got an ergonomic keyboard because a tendon in my right hand was aching a little. After a few hours of use and reduced WPM rate, my whole right arm from fingers to elbow is aching very painfully. So, the ergonomic keyboard is so far making things worse.</p>
<p>
I must be defective.</p>
   ]]></content:encoded>
   <wfw:commentRss>http://natulte.net/index.php/blog/rss/524/comments</wfw:commentRss>
  </item>

  <item>
   <title><![CDATA[The restaurant at the end of the universe]]></title>
   <link>http://natulte.net/index.php/blog/523</link>
   <description>
Today, I ate at Milliways. Assorted sushi, macaroni and cheese, chestnut and chocolate slice, cookie dough ice cream.

I love this place.
   </description>
   <author><![CDATA[David Anderson]]></author>
   <category><![CDATA[English]]></category>
   <category><![CDATA[Happy]]></category>
   <guid>http://natulte.net/index.php/blog/523</guid>
   <pubDate><![CDATA[Wed, 06 Feb 2008 15:39:02 +0100]]></pubDate>
   <dc:creator><![CDATA[David Anderson]]></dc:creator>
   <content:encoded><![CDATA[<p>
Today, I ate at Milliways. Assorted sushi, macaroni and cheese, chestnut and chocolate slice, cookie dough ice cream.</p>
<p>
I love this place.</p>
   ]]></content:encoded>
   <wfw:commentRss>http://natulte.net/index.php/blog/rss/523/comments</wfw:commentRss>
  </item>

  <item>
   <title><![CDATA[Getting translucent terminals on Openbox]]></title>
   <link>http://natulte.net/index.php/blog/522</link>
   <description>
People have asked me how to do this, so here's a quick manual on setting up transparent terminals in Openbox, using xcompmgr and transset-df.First, make sure that you have the Composite X11 extension activated. xdpyinfo | grep Composite should print 'Composite'. If it doesn't, refer to google for information on how to enable the composite extension for your video board.

Then, install xcompmgr. If you're on ubuntu, the package is in universe. In Debian, the package is only in experimental, and you have to build it yourself. Add the following to your /etc/apt/sources.list:



deb-src ftp://ftp.pl.debian.org/debian/ experimental main non-free contrib




You should also comment out all other deb-src sources temporarily. Then:



$ sudo apt-get update
$ apt-get source xcompmgr
$ cd xcompmgr-1.1.1+cvs.20051218
$ fakeroot debian/rules binary
$ dpkg -i ../*.deb




You also need to install transset-df. Ubuntu also has transset in universe, but that is not what you want: transset-df is a fork of transset, and where transset can only apply transparency settings to the window you click on, transset-df can also select the window by window-id. Transset-df is pretty easy to install, just run make &amp;&amp; sudo make install in the extracted sources directory.

Now, we have all the components that we need. First things first, we need to get Openbox to start xcompmgr. Put the following in your ~/.config/openbox/autostart.sh:



# Call the systemwide startup script to start Gnome/KDE/DBus services
. $GLOBALAUTOSTART

# Set the wallpaper, and any other stuff you might want here
$BG -full ~/.config/openbox/wallpaper.jpg

# Start xcompmgr
xcompmgr -n &amp;




Check out the xcompmgr manual for more flags. -n tells xcompmgr to do simple client-side compositing: transparency only, no dropshadows or eyecandy fading effects. I like my desktop simple.

Restart openbox (or start xcompmgr manually for this session), and check if the compositing works: run transset-df 0.80 and click on any window when the cursor turns to a targetting reticle. When you click, the targetted window should turn a classy shade of transparent. If it didn't, there's something wrong with xcompmgr or your X11 Composite setup.

Now, that's all very well, but how do we make all terminals transparent? We're not going to click on each one each time we open it!

The easiest way I've found to do this is to edit my .bashrc (replace with the settings script appropriate for your shell), and add the following right at the end:



# Engage transparency if we're running in xterm
if [ "$TERM" = "xterm" ]; then
  sleep 0.1; transset-df -i $WINDOWID 0.75 &gt;/dev/null
fi




The sleep is there to give xterm enough time to actually create the window. Without it I found that on my machine, transset-df would sometimes run before the window was actually created, so it'd end up not being transparent. A 0.1s delay is imperceptible enough to not be annoying, and gives xterm enough time to fire up properly before going transparent.

And there you have it. Of course, now that you have compositing enabled, you can make any window as transparent as you like, but I like to keep it simple and classy, and only have the terminals colored a hyperintelligent shade of transparent.

That is all.
   </description>
   <author><![CDATA[David Anderson]]></author>
   <category><![CDATA[English]]></category>
   <category><![CDATA[Geek]]></category>
   <guid>http://natulte.net/index.php/blog/522</guid>
   <pubDate><![CDATA[Thu, 31 Jan 2008 17:20:13 +0100]]></pubDate>
   <dc:creator><![CDATA[David Anderson]]></dc:creator>
   <content:encoded><![CDATA[<p>
People have asked me how to do this, so here's a quick manual on setting up transparent terminals in Openbox, using xcompmgr and transset-df.<br /><br />First, make sure that you have the Composite X11 extension activated. <tt>xdpyinfo | grep Composite</tt> should print 'Composite'. If it doesn't, refer to google for information on how to enable the composite extension for your video board.</p>
<p>
Then, install xcompmgr. If you're on ubuntu, the package is in universe. In Debian, the package is only in experimental, and you have to build it yourself. Add the following to your <tt>/etc/apt/sources.list</tt>:</p>

<div class="cmd">
<pre>
deb-src ftp://ftp.pl.debian.org/debian/ experimental main non-free contrib
</pre>
</div>
<p></p>
<p>
You should also comment out all other deb-src sources temporarily. Then:</p>

<div class="cmd">
<pre>
$ sudo apt-get update
$ apt-get source xcompmgr
$ cd xcompmgr-1.1.1+cvs.20051218
$ fakeroot debian/rules binary
$ dpkg -i ../*.deb
</pre>
</div>
<p></p>
<p>
You also need to install <a href="http://forchheimer.se/transset-df/">transset-df</a>. Ubuntu also has <tt>transset</tt> in universe, but that is not what you want: transset-df is a fork of transset, and where transset can only apply transparency settings to the window you click on, transset-df can also select the window by window-id. Transset-df is pretty easy to install, just run <tt>make &amp;&amp; sudo make install</tt> in the extracted sources directory.</p>
<p>
Now, we have all the components that we need. First things first, we need to get Openbox to start xcompmgr. Put the following in your <tt>~/.config/openbox/autostart.sh</tt>:</p>

<div class="cmd">
<pre>
# Call the systemwide startup script to start Gnome/KDE/DBus services
. $GLOBALAUTOSTART

# Set the wallpaper, and any other stuff you might want here
$BG -full ~/.config/openbox/wallpaper.jpg

# Start xcompmgr
xcompmgr -n &amp;
</pre>
</div>
<p></p>
<p>
Check out the xcompmgr manual for more flags. <tt>-n</tt> tells xcompmgr to do simple client-side compositing: transparency only, no dropshadows or eyecandy fading effects. I like my desktop simple.</p>
<p>
Restart openbox (or start xcompmgr manually for this session), and check if the compositing works: run <tt>transset-df 0.80</tt> and click on any window when the cursor turns to a targetting reticle. When you click, the targetted window should turn a classy shade of transparent. If it didn't, there's something wrong with xcompmgr or your X11 Composite setup.</p>
<p>
Now, that's all very well, but how do we make <em>all</em> terminals transparent? We're not going to click on each one each time we open it!</p>
<p>
The easiest way I've found to do this is to edit my <tt>.bashrc</tt> (replace with the settings script appropriate for your shell), and add the following right at the end:</p>

<div class="cmd">
<pre>
# Engage transparency if we're running in xterm
if [ &quot;$TERM&quot; = &quot;xterm&quot; ]; then
  sleep 0.1; transset-df -i $WINDOWID 0.75 &gt;/dev/null
fi
</pre>
</div>
<p></p>
<p>
The sleep is there to give xterm enough time to actually create the window. Without it I found that on my machine, transset-df would sometimes run before the window was actually created, so it'd end up not being transparent. A 0.1s delay is imperceptible enough to not be annoying, and gives xterm enough time to fire up properly before going transparent.</p>
<p>
And there you have it. Of course, now that you have compositing enabled, you can make any window as transparent as you like, but I like to keep it simple and classy, and only have the terminals colored a hyperintelligent shade of transparent.</p>
<p>
That is all.</p>
   ]]></content:encoded>
   <wfw:commentRss>http://natulte.net/index.php/blog/rss/522/comments</wfw:commentRss>
  </item>

 </channel>
</rss>
