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

<channel>
	<title>Simon Josefsson's blog</title>
	<atom:link href="http://blog.josefsson.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.josefsson.org</link>
	<description></description>
	<pubDate>Tue, 13 Jul 2010 16:16:59 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	http://creativecommons.org/licenses/by-sa/3.0/<creativeCommons:license></creativeCommons:license>		<item>
		<title>Bridging SASL and GSS-API: GS2</title>
		<link>http://blog.josefsson.org/2010/07/13/bridging-sasl-and-gss-api-gs2/</link>
		<comments>http://blog.josefsson.org/2010/07/13/bridging-sasl-and-gss-api-gs2/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 13:58:33 +0000</pubDate>
		<dc:creator>simon</dc:creator>
		
		<category><![CDATA[gsasl]]></category>

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

		<category><![CDATA[cram-md5]]></category>

		<category><![CDATA[digest-md5]]></category>

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

		<category><![CDATA[gss-api]]></category>

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

		<guid isPermaLink="false">http://blog.josefsson.org/?p=158</guid>
		<description><![CDATA[Yesterday (12th July 2010) the RFC editor announced the publication of RFC 5801, which I&#8217;m co-author of.  The GS2 document has taken 5 years to reach this status, see my page on GS2 status.
So what is GS2? Briefly explained, it is a method that turns every GSS-API mechanism (with some exceptions) into a SASL [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday (12th July 2010) the <a href="http://www.rfc-editor.org/" onclick="javascript:urchinTracker ('/outbound/article/www.rfc-editor.org');">RFC editor</a> <a href="http://www.rfc-editor.org/pipermail/rfc-dist/2010-July/002682.html" onclick="javascript:urchinTracker ('/outbound/article/www.rfc-editor.org');">announced</a> the publication of <a href="http://www.rfc-editor.org/rfc/rfc5801.txt" onclick="javascript:urchinTracker ('/outbound/article/www.rfc-editor.org');">RFC 5801</a>, which I&#8217;m co-author of.  The GS2 document has taken 5 years to reach this status, see my <a href="http://josefsson.org/sasl-gs2/" >page on GS2 status</a>.</p>
<p>So what is GS2?<span id="more-158"></span> Briefly explained, it is a method that turns every GSS-API mechanism (with some exceptions) into a SASL mechanism automatically.  The document describes a way to transform GSS-API mechanism OIDs (e.g., 1.2.840.113554.1.2.2) into SASL mechanism names (e.g., GS2-QLJHGJLWNPL) which takes care of uniquely identifying each mechanism in each framework.  The content of each SASL message is exactly the same as the GSS-API context tokens, except (no rules without exceptions..) for the first message from the client to the server.  The first message is modified to include a short prefix &#8212; called the &#8220;GS2 header&#8221; &#8212; before the first GSS-API context token.  The shortest GS2 header is &#8220;n,,&#8221; which denotes that no channel binding is supported and no authorization identity is present.  The GSS-API context token is modified to remove the ASN.1 blob that RFC 2743 section 3.1 requires to be present.</p>
<p>One important aspect of the GS2 design is that we make it easy for SASL mechanisms to become GSS-API mechanisms.  To align a SASL mechanism to the GS2 framework, and thus to make it a GSS-API mechanism, a few steps are required.  First, you need to assign an OID for the mechanism (if you don&#8217;t know how to do this, just <a href="mailto:simon@josefsson.org">contact me</a> and I&#8217;ll assign an OID for you).  Then you need to make sure the first message is compatible with GS2 in that it uses the GS2 header to signal channel binding and authorization identity.  Finally, you need some discussion about what it means for your SASL mechanism to be used as a GSS-API mechanism.  This may include discussions on naming types, meaning and use of GSS-API flags, whether delegated credentials are supported, how per-message tokens work.</p>
<p>The primary example SASL mechanism to make use of the GS2 design to become a GSS-API mechanism is SCRAM: also published yesterday as <a href="http://www.rfc-editor.org/rfc/rfc5802.txt" onclick="javascript:urchinTracker ('/outbound/article/www.rfc-editor.org');">RFC 5802</a>.  SCRAM is an updated variant of the CRAM-MD5 and DIGEST-MD5 mechanisms (for example, it uses SHA-1 instead of MD5).  Another recent example is the <a href="http://tools.ietf.org/html/draft-lear-ietf-sasl-openid" onclick="javascript:urchinTracker ('/outbound/article/tools.ietf.org');">OpenID SASL mechanism</a>.</p>
<p>My project <a href="http://www.gnu.org/software/gsasl/" onclick="javascript:urchinTracker ('/outbound/article/www.gnu.org');">GNU SASL</a> supports both GS2 and SCRAM, see my earlier <a href="http://blog.josefsson.org/2010/03/31/gs2-krb5-in-gnu-sasl-150/" >post on testing GS2-KRB5</a>.  I am not aware of any other project that implements GS2 yet, that is why my implementation is still marked as experimental.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.josefsson.org/2010/07/13/bridging-sasl-and-gss-api-gs2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>OpenWRT 10.03 &#8220;Backfire&#8221;</title>
		<link>http://blog.josefsson.org/2010/05/03/openwrt-1003-backfire/</link>
		<comments>http://blog.josefsson.org/2010/05/03/openwrt-1003-backfire/#comments</comments>
		<pubDate>Mon, 03 May 2010 10:08:15 +0000</pubDate>
		<dc:creator>simon</dc:creator>
		
		<category><![CDATA[embedded]]></category>

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

		<category><![CDATA[3g]]></category>

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

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

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

		<guid isPermaLink="false">http://blog.josefsson.org/?p=153</guid>
		<description><![CDATA[Earlier I have written about OpenWRT configuration for two routers in a home network and OpenWRT configuration for 3G dial-up (which succeeded my summerhouse OpenWRT writeup) before.  The OpenWRT project recently announced a new release, OpenWRT 10.03 Backfire.  Thus, this appeared like a good opportunity to wipe out the old configurations on my [...]]]></description>
			<content:encoded><![CDATA[<p>Earlier I have written about <a href="http://blog.josefsson.org/2008/05/08/home-wireless-network/" >OpenWRT configuration for two routers in a home network</a> and <a href="http://josefsson.org/openwrt/dongle.html" >OpenWRT configuration for 3G dial-up</a> (which succeeded my <a href="http://josefsson.org/openwrt/internet.html" >summerhouse OpenWRT writeup</a>) before.  The <a href="http://www.openwrt.org/" onclick="javascript:urchinTracker ('/outbound/article/www.openwrt.org');">OpenWRT project</a> recently announced a new release, <a href="https://forum.openwrt.org/viewtopic.php?id=24177" onclick="javascript:urchinTracker ('/outbound/article/forum.openwrt.org');">OpenWRT 10.03 Backfire</a>.  Thus, this appeared like a good opportunity to wipe out the old configurations on my routers and rewrite the articles using the latest software.  I have two articles:</p>
<ul>
<li><a href="http://josefsson.org/openwrt/wlan.html" >Wireless Home Network</a> with OpenWRT and two routers
<li><a href="http://josefsson.org/openwrt/dongle.html" >Wireless Router with a 3G/UMTS/HSDPA dongle</a>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.josefsson.org/2010/05/03/openwrt-1003-backfire/feed/</wfw:commentRss>
		</item>
		<item>
		<title>GS2-KRB5 in GNU SASL 1.5.0</title>
		<link>http://blog.josefsson.org/2010/03/31/gs2-krb5-in-gnu-sasl-150/</link>
		<comments>http://blog.josefsson.org/2010/03/31/gs2-krb5-in-gnu-sasl-150/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 23:10:22 +0000</pubDate>
		<dc:creator>simon</dc:creator>
		
		<category><![CDATA[gsasl]]></category>

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

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

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

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

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

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

		<guid isPermaLink="false">http://blog.josefsson.org/?p=147</guid>
		<description><![CDATA[I have worked in the IETF on the specification for the next generation GSSAPI-to-SASL bridge called GS2 (see my status page for background) for a couple of years now.   The specification is (finally!) in the RFC editor&#8217;s queue, and is supposed to be stable and final although we are still tuning some details. [...]]]></description>
			<content:encoded><![CDATA[<p>I have worked in the <a href="http://www.ietf.org/" onclick="javascript:urchinTracker ('/outbound/article/www.ietf.org');">IETF</a> on the specification for the next generation GSSAPI-to-SASL bridge called GS2 (see <a href="http://josefsson.org/sasl-gs2/" >my status page</a> for background) for a couple of years now.   The specification is (finally!) in the RFC editor&#8217;s queue, and is supposed to be stable and final although we are still tuning some details.  The next step is to implement the protocol and do interop testing.  A couple of months of implementation and testing work culminated in tonight&#8217;s release of GNU SASL 1.5.0 (see announcement <a href="http://lists.gnu.org/archive/html/help-gsasl/2010-03/msg00014.html" onclick="javascript:urchinTracker ('/outbound/article/lists.gnu.org');">here</a>).  Or should I say that the work can now begin&#8230;<br />
<span id="more-147"></span><br />
To get you started with GS2-KRB5 here is a brief walk-through on installing GNU SASL 1.5.0 on a Mac OS X machine and using it to connect to my GS2-KRB5 interop server.  I&#8217;m assuming you have already installed a compiler on your system.  Start by downloading and installing GNU SASL:</p>
<pre>
wget -q ftp://alpha.gnu.org/gnu/gsasl/gsasl-1.5.0.tar.gz
tar xfz gsasl-1.5.0.tar.gz
cd gsasl-1.5.0
./configure --prefix=$HOME CFLAGS=-g
make all check install
</pre>
<p>Next you need to configure Kerberos on your system.  If you have already have a configuration, make sure to take a backup of your configuration files.  First let&#8217;s tell your machine about my interop Kerberos V5 realm by creating a file ~/Library/Preferences/edu.mit.Kerberos with the following content:</p>
<pre>
[libdefaults]
        default_realm = interop.josefsson.org

[realms]
        interop.josefsson.org = {
                kdc = interop.josefsson.org:88
        }

[domain_realm]
        interop.josefsson.org = interop.josefsson.org
</pre>
<p>Next get a ticket for a dummy user.  Use the password &#8216;pass&#8217; at the prompt:</p>
<pre>
espresso:~ jas$ kinit user@interop.josefsson.org
Please enter the password for user@interop.josefsson.org:
espresso:~ jas$ klist
Kerberos 5 ticket cache: 'API:Initial default ccache'
Default principal: user@interop.josefsson.org

Valid Starting     Expires            Service Principal
03/31/10 00:59:04  03/31/10 10:59:02  krbtgt/interop.josefsson.org@interop.josefsson.org
	renew until 01/01/70 01:00:00

klist: No Kerberos 4 tickets in credentials cache
espresso:~ jas$
</pre>
<p>Next connect to my test IMAP server using the command-line &#8216;gsasl&#8217; tool (long lines cut for legibility):</p>
<pre>
espresso:~ jas$ ~/bin/gsasl interop.josefsson.org -auser
Trying `interop.josefsson.org'...
* OK IMAP4rev1
. CAPABILITY
* CAPABILITY ... AUTH=GS2-KRB5
. OK CAPABILITY Completed
. AUTHENTICATE GS2-KRB5
+
biwsAQBuggINMIICCa...
+ YHEGCSqGSIb3EgEC...

. OK AUTHENTICATE GS2-KRB5 authentication successful
Client authentication finished (server trusted)...
Enter application data (EOF to finish):
. list "" "*"
* LIST (\NoInferiors) NIL INBOX
* LIST (\NoInferiors) "/" .bashrc
* LIST (\NoInferiors) "/" .bash_logout
* LIST (\NoInferiors) "/" .profile
* LIST (\NoInferiors) "/" .bash_history
. OK LIST Completed
. logout
* BYE Session terminating.
. OK LOGOUT Completed
Session finished...
. LOGOUT
espresso:~ jas$
</pre>
<p>There!  You have just completed a GS2-KRB5 authenticated session.</p>
<p>Of course, this works just as well on your favorite GNU/Linux system, but I thought I&#8217;d explain it for a non-GNU platform and GSS-API library to show that the code is quite portable despite its experimental status.</p>
<p>Btw, the server is running <a href="http://www.gnu.org/software/shishi/" onclick="javascript:urchinTracker ('/outbound/article/www.gnu.org');">GNU Shishi</a> as the Kerberos V5 KDC and <a href="http://www.gnu.org/software/mailutils/" onclick="javascript:urchinTracker ('/outbound/article/www.gnu.org');">GNU MailUtils</a> as the IMAP server.  The IMAP server is using GNU SASL in server mode.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.josefsson.org/2010/03/31/gs2-krb5-in-gnu-sasl-150/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Fellowship interview</title>
		<link>http://blog.josefsson.org/2010/01/08/fellowship-interview/</link>
		<comments>http://blog.josefsson.org/2010/01/08/fellowship-interview/#comments</comments>
		<pubDate>Fri, 08 Jan 2010 14:01:18 +0000</pubDate>
		<dc:creator>simon</dc:creator>
		
		<category><![CDATA[advocacy]]></category>

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

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

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

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

		<guid isPermaLink="false">http://blog.josefsson.org/?p=144</guid>
		<description><![CDATA[At FSCONS I met Stian Rødven Eide who is doing a series of fellowship interviews for FSF Europe.  He recently posted an interview with me.
]]></description>
			<content:encoded><![CDATA[<p>At <a href="http://fscons.org/" onclick="javascript:urchinTracker ('/outbound/article/fscons.org');">FSCONS</a> I met Stian Rødven Eide who is doing a series of <a href="http://blogs.fsfe.org/fellowship-interviews/simon-josefsson/" onclick="javascript:urchinTracker ('/outbound/article/blogs.fsfe.org');">fellowship interviews</a> for <a href="http://www.fsfe.org/" onclick="javascript:urchinTracker ('/outbound/article/www.fsfe.org');">FSF Europe</a>.  He recently posted an <a href="http://blogs.fsfe.org/fellowship-interviews/simon-josefsson/" onclick="javascript:urchinTracker ('/outbound/article/blogs.fsfe.org');">interview with me</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.josefsson.org/2010/01/08/fellowship-interview/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Nordic Free Software Award 2009</title>
		<link>http://blog.josefsson.org/2009/11/15/nordic-free-software-award-2009/</link>
		<comments>http://blog.josefsson.org/2009/11/15/nordic-free-software-award-2009/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 15:13:05 +0000</pubDate>
		<dc:creator>simon</dc:creator>
		
		<category><![CDATA[advocacy]]></category>

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

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

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

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

		<guid isPermaLink="false">http://blog.josefsson.org/?p=141</guid>
		<description><![CDATA[Last night at FSCONS I was awarded the Nordic Free Software Award, sharing the price with Daniel Stenberg who incidentally (or perhaps not) I have been collaborating with on some projects.   Receiving a price like this is a great motivator and I feel humbled when thinking about the many excellent hackers that were [...]]]></description>
			<content:encoded><![CDATA[<p>Last night at <a href="http://www.fscons.org/" onclick="javascript:urchinTracker ('/outbound/article/www.fscons.org');">FSCONS</a> I was awarded the <a href="http://fscons.org/award" onclick="javascript:urchinTracker ('/outbound/article/fscons.org');">Nordic Free Software Award</a>, sharing the price with <a href="http://daniel.haxx.se/" onclick="javascript:urchinTracker ('/outbound/article/daniel.haxx.se');">Daniel Stenberg</a> who incidentally (or perhaps not) I have been collaborating with on some projects.   Receiving a price like this is a great motivator and I feel humbled when thinking about the many excellent hackers that were attending the FSCONS that cheered <i>me</i> on.  Thank you everyone.</p>
<p>Now back to coding.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.josefsson.org/2009/11/15/nordic-free-software-award-2009/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Storing OpenPGP keys in the DNS</title>
		<link>http://blog.josefsson.org/2009/10/29/storing-openpgp-keys-in-the-dns/</link>
		<comments>http://blog.josefsson.org/2009/10/29/storing-openpgp-keys-in-the-dns/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 08:33:55 +0000</pubDate>
		<dc:creator>simon</dc:creator>
		
		<category><![CDATA[ietf]]></category>

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

		<guid isPermaLink="false">http://blog.josefsson.org/?p=138</guid>
		<description><![CDATA[Many years ago, for my master&#8217;s thesis, I worked on evaluating using the DNS to store certificates.  I eventually ended up fixing several problems in RFC 2538 in a document that became RFC 4398.  Using CERT records to store certificates haven&#8217;t really taken off, but now I&#8217;m happy to see work in this [...]]]></description>
			<content:encoded><![CDATA[<p>Many years ago, for my <a href="http://josefsson.org/thesis/" >master&#8217;s thesis</a>, I worked on evaluating using the DNS to store certificates.  I eventually ended up fixing several problems in <a href="http://tools.ietf.org/html/rfc2538" onclick="javascript:urchinTracker ('/outbound/article/tools.ietf.org');">RFC 2538</a> in a document that became <a href="http://tools.ietf.org/html/rfc4398" onclick="javascript:urchinTracker ('/outbound/article/tools.ietf.org');">RFC 4398</a>.  Using CERT records to store certificates haven&#8217;t really taken off, but now I&#8217;m happy to see work in this area: Dan Mahoney has blogged about <a href="http://gushi.livejournal.com/524199.html" onclick="javascript:urchinTracker ('/outbound/article/gushi.livejournal.com');">How to publish PGP keys in DNS</a>.  Nice work!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.josefsson.org/2009/10/29/storing-openpgp-keys-in-the-dns/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Thread Safe Functions</title>
		<link>http://blog.josefsson.org/2009/06/23/thread-safe-functions/</link>
		<comments>http://blog.josefsson.org/2009/06/23/thread-safe-functions/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 20:17:02 +0000</pubDate>
		<dc:creator>simon</dc:creator>
		
		<category><![CDATA[general]]></category>

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

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

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

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

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

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

		<category><![CDATA[thread safety]]></category>

		<guid isPermaLink="false">http://blog.josefsson.org/?p=104</guid>
		<description><![CDATA[I have read Russel Coker&#8217;s nice article on identifying use of thread unsafe functions.  This reminded me of a script I wrote a long time ago that is part of GNU SASL&#8217;s regression suite: threadsafety.
As you can see, my script looks for functions mentioned in the latest POSIX specification as being thread unsafe.  [...]]]></description>
			<content:encoded><![CDATA[<p>I have read <a href="http://etbe.coker.com.au/2009/06/14/finding-thread-unsafe-code/" onclick="javascript:urchinTracker ('/outbound/article/etbe.coker.com.au');">Russel Coker&#8217;s nice article on identifying use of thread unsafe functions</a>.  This reminded me of a script I wrote a long time ago that is part of <a href="http://www.gnu.org/software/gsasl/" onclick="javascript:urchinTracker ('/outbound/article/www.gnu.org');">GNU SASL</a>&#8217;s regression suite: <a href="http://git.savannah.gnu.org/cgit/gsasl.git/tree/tests/threadsafety?id=8b699b8f45db2a1afaf226dc8a37e852530edee9" onclick="javascript:urchinTracker ('/outbound/article/git.savannah.gnu.org');">threadsafety</a>.</p>
<p>As you can see, my script looks for <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_09_01" onclick="javascript:urchinTracker ('/outbound/article/www.opengroup.org');">functions mentioned in the latest POSIX specification as being thread unsafe</a>.  In the last POSIX release, they actually removed some older interfaces (e.g., gethostbyname) so the script also checks for <a href="http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_09.html#tag_02_09_01" onclick="javascript:urchinTracker ('/outbound/article/www.opengroup.org');">thread-unsafe functions mentioned in one older POSIX specification</a>.</p>
<p>Russel&#8217;s approach is to look for man pages of functions ending with <code>_r</code> and labeling the non-<code>_r</code>-function as a thread unsafe function.  Russel&#8217;s and my approach are quite different, so I wanted to compare the results.  There is potential for me to add more functions to search for.  I still want to preserve my approach of explicitly listing known thread unsafe functions, though.</p>
<p>Running Russel&#8217;s command, I get a list of functions that my script catches that Russel&#8217;s doesn&#8217;t, and vice versa.  For reference, the functions that my script catches that Russel&#8217;s doesn&#8217;t are:</p>
<p><code>basename catgets dbm_clearerr dbm_close dbm_delete dbm_error dbm_fetch dbm_firstkey dbm_nextkey dbm_open dbm_store dirname dlerror endgrent endpwent endutxent ftw gcvt getc_unlocked getchar_unlocked getenv getopt getutxent getutxid getutxline inet_ntoa l64a lgamma lgammaf lgammal localeconv nftw nl_langinfo putc_unlocked putchar_unlocked putenv pututxline setenv setgrent setpwent setutxent strsignal system unsetenv wcstombs wctomb</code></p>
<p>The list contains lgamma, lgammaf, and lgammal which are all excluded by Russel&#8217;s command.  I don&#8217;t understand why &#8212; according to the man page, the functions uses a global variable for sign, which doesn&#8217;t seem thread safe.  So it seems right to include them?</p>
<p>What&#8217;s more interesting (for me) is the list of functions that Russel&#8217;s script catches that my script currently doesn&#8217;t.  Here is the list:</p>
<p><code>erand48 ether_aton ether_ntoa fgetgrent fgetpwent fgetspent getaliasbyname getaliasent gethostbyname2 getmntent getnetgrent getrpcbyname getrpcbynumber getrpcent getspent getspnam getutent getutid getutline initstate jrand48 lcong48 nrand48 qecvt qfcvt random seed48 setstate sgetspent srand48 srandom tmpnam</code></p>
<p>I started looking into each function. For <code>erand48</code> there is a <code>erand48_r</code> function in glibc, and the former does indeed seem to use a global variable.  However, as far as I can tell from the POSIX specification, <code>erand48</code> should be thread safe.  So I filed a <a href="http://sourceware.org/bugzilla/show_bug.cgi?id=10320" onclick="javascript:urchinTracker ('/outbound/article/sourceware.org');">glibc bug about it</a>.  The same concern may hold for <code>jrand48</code>, <code>lcong48</code>, <code>nrand48</code>, <code>seed48</code>, and <code>srand48</code>.</p>
<p>I noticed that <code>initstate</code>, <code>random</code>, <code>setstate</code>, and <code>srandom</code> are defined by latest POSIX, but not mentioned as a thread-unsafe functions.  Possibly a bug in the POSIX specification?</p>
<p>I also noticed that I had missed to include <code>tmpnam</code> even though it is mentioned separately in the POSIX link.</p>
<p>The rest of the functions are not documented by POSIX, and presumably thread unsafe (although I didn&#8217;t read the man page or source code for each of them).</p>
<p>In the end, I ended up adding several new functions to check for.  The latest script is always available from:</p>
<p><a href="http://git.savannah.gnu.org/cgit/gsasl.git/tree/tests/threadsafety" onclick="javascript:urchinTracker ('/outbound/article/git.savannah.gnu.org');">http://git.savannah.gnu.org/cgit/gsasl.git/tree/tests/threadsafety</a></p>
<p>So, finally, did the updated script catch any use of thread-unsafe functions in GNU SASL?   Nope.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.josefsson.org/2009/06/23/thread-safe-functions/feed/</wfw:commentRss>
		</item>
		<item>
		<title>CACert and GnuTLS</title>
		<link>http://blog.josefsson.org/2009/04/16/cacert-and-gnutls/</link>
		<comments>http://blog.josefsson.org/2009/04/16/cacert-and-gnutls/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 15:51:02 +0000</pubDate>
		<dc:creator>simon</dc:creator>
		
		<category><![CDATA[gnutls]]></category>

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

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

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

		<guid isPermaLink="false">http://blog.josefsson.org/?p=88</guid>
		<description><![CDATA[I haven&#8217;t seen this before, so I thought I&#8217;d documment how to generate a server TLS certificate using CACert.  This can be useful if you are running a mail or web server and easily (and cost free) want to support TLS for integrity/confidentiality.  I just re-installed my secondary mail server, and tested this [...]]]></description>
			<content:encoded><![CDATA[<p>I haven&#8217;t seen this before, so I thought I&#8217;d documment how to generate a server TLS certificate using <a href="http://www.cacert.org/" onclick="javascript:urchinTracker ('/outbound/article/www.cacert.org');">CACert</a>.  This can be useful if you are running a mail or web server and easily (and cost free) want to support TLS for integrity/confidentiality.  I just re-installed my secondary mail server, and tested this recipe with <a href="http://www.exim.org/" onclick="javascript:urchinTracker ('/outbound/article/www.exim.org');">Exim4</a> with <a href="http://www.debian.org/" onclick="javascript:urchinTracker ('/outbound/article/www.debian.org');">Debian</a>.  See below for a step-by-step howto.<br />
<span id="more-88"></span><br />
First make sure you have the GnuTLS command line tools installed:</p>
<blockquote><p>
kniv:~# apt-get install gnutls-bin
</p></blockquote>
<p>The next step is to generate a private key:</p>
<blockquote><p>
kniv:/etc/exim4# certtool &#8211;generate-privkey &#8211;outfile exim.key<br />
Generating a 2048 bit RSA private key&#8230;<br />
kniv:/etc/exim4#
</p></blockquote>
<p>You can use <code>--dsa</code> if you want to use DSA instead of RSA, and can change the key size using <code>--bits</code>.  The default is 2048-bit RSA which should be good enough for most people.</p>
<p>The next step is to generate a Certificate Request.  CACert only looks at the Common Name field, so I left the rest empty.  If you are using some commercial CA, you may need to enter something in the other fields.</p>
<blockquote><p>
kniv:/etc/exim4# certtool &#8211;generate-request &#8211;load-privkey exim.key &#8211;outfile exim.csr<br />
Generating a PKCS #10 certificate request&#8230;<br />
Country name (2 chars):<br />
Organization name:<br />
Organizational unit name:<br />
Locality name:<br />
State or province name:<br />
Common name: kniv.josefsson.org<br />
UID:<br />
Enter a challenge password:<br />
kniv:/etc/exim4#
</p></blockquote>
<p>Then login to <a href="http://www.cacert.org/" onclick="javascript:urchinTracker ('/outbound/article/www.cacert.org');">CACert</a> and click on &#8216;Server Certificates&#8217; and then &#8216;New&#8217;.  It will ask you to paste in the certificate request.  Here you paste in the content of the <code>exim.csr</code> file.  CACert will ask you to confirm the hostname.  After that it will show a certificate in the resulting web page.  Put the certificate in a file <code>exim.crt</code> like this:</p>
<pre>
kniv:/etc/exim4# cat>exim.crt
-----BEGIN CERTIFICATE-----
MIIEuDCCAqCgAwIBAgICegUwDQYJKoZIhvcNAQEFBQAwVDEUMBIGA1UEChMLQ0Fj
ZXJ0IEluYy4xHjAcBgNVBAsTFWh0dHA6Ly93d3cuQ0FjZXJ0Lm9yZzEcMBoGA1UE
AxMTQ0FjZXJ0IENsYXNzIDMgUm9vdDAeFw0wOTA0MTYxNTIyNDFaFw0xMTA0MTYx
NTIyNDFaMB0xGzAZBgNVBAMTEmtuaXYuam9zZWZzc29uLm9yZzCCASIwDQYJKoZI
hvcNAQEBBQADggEPADCCAQoCggEBAOCA/9NCraz72OG9c41w0aPenWZcdyiwI+OZ
2drOFHAQf0y9ihKZtZSkMJHHQBIdYwQPvaXuvzWJG6leaIeed4/Er/7BMvN4NqhU
r28qPv5HHCkGEKfUmmc5+sorYSCAgsEJU5SITIjpeSZqcL07hib+Mj0PUUkcVRZU
Jk7WHMaHFUZ1gvbYHEvk9C29CS/yq6SqAWdLwY8FRBHW9XvQa+zVp9j+ZecwS87i
NjzCMI13NAMEBanEc4LKuG2bN0EGGbceyd91YnCxQNDSiXrm9GvAfboidKmNmgAI
LJqAy3gXCCu0BXHDtJut8Z6mOz6gu5bFeLV3jARk+/CHVXypi7sCAwEAAaOByjCB
xzAMBgNVHRMBAf8EAjAAMDQGA1UdJQQtMCsGCCsGAQUFBwMCBggrBgEFBQcDAQYJ
YIZIAYb4QgQBBgorBgEEAYI3CgMDMAsGA1UdDwQEAwIFoDAzBggrBgEFBQcBAQQn
MCUwIwYIKwYBBQUHMAGGF2h0dHA6Ly9vY3NwLmNhY2VydC5vcmcvMD8GA1UdEQQ4
MDaCEmtuaXYuam9zZWZzc29uLm9yZ6AgBggrBgEFBQcIBaAUDBJrbml2Lmpvc2Vm
c3Nvbi5vcmcwDQYJKoZIhvcNAQEFBQADggIBABi/NjSTTFvw9XLWgfm7wnnOO9LP
U8yEgrQYCNIW6Zh7zH5w+pGzvBUSMOthMnmyfLacZSYjtOknlIG2kNDZEGaWznCN
WPMjNTctarR/g2qnD329o6orxPiK6Nmtcvcrj7BTecHDcExtE7CPe+msBN4OzIj1
zQGTMjge/Ofhft4Y2vYHOJMqsrQ2vj8xnUE7yGpw7IPDFTnyIyw55lSSbnAhACkp
eLrTcyYpxs7gTcaKqTOUEmUKCFqPsGPRGP3cgIMn3MHgqdq6b0XeF8E9+4iSuHBa
yPOxeWDLV4OEZZ0ygiQBgXyZQ+aRsuLo2BTSW0UEf+/J4ZbPiZlrUPouJ5tADceN
7DDhZu3q2RtCQLTNrMaUUY0uvUS41T8iox00tphi7DsOqq/Sku8vVR370NJJmWix
ChD74seszVlU+nPsrvFGN53+1wbgvtFSOSTRol7AvaPnx2TvC215GZ3wRb/WGCm4
r2em9QsI1T+7AjSHoFoaCWfFekHa1x+q7IJoAt/uMJBrvimC0ioTUMkyfrkcLWTr
mFObSwvq6zhV+MhgtYe/nEkb45eAyy5TP3qvmrjBAKad0qUpazmRbiWsb5VLK1hO
+FR6nD1aNDyukCSO0UH6bu9BzcbET5kkybkSlslDnrNfpn16EsIlrQgZ9RrF1Dr/
a6rS5JJX1gbewzse
-----END CERTIFICATE-----
kniv:/etc/exim4#
</pre>
<p>That&#8217;s it!</p>
<p>You need to finish the Exim4 configuration.  Below ^D means to type ctrl-d.</p>
<blockquote><p>
kniv:/etc/exim4# chgrp Debian-exim exim.key<br />
kniv:/etc/exim4# chmod g+r exim.key<br />
kniv:/etc/exim4# cat>/etc/exim4/conf.d/main/000_local<br />
MAIN_LOG_SELECTOR=+tls_cipher +tls_peerdn<br />
MAIN_TLS_ENABLE=t<br />
^D<br />
kniv:/etc/exim4# update-exim4.conf<br />
kniv:/etc/exim4# /etc/init.d/exim4 restart<br />
Stopping MTA for restart: exim4_listener.<br />
Restarting MTA: exim4.<br />
kniv:/etc/exim4#
</p></blockquote>
<p>You can test the setup by using <code>gnutls-cli</code>.  Again, ^D means ctrl-d.</p>
<pre>
kniv:/etc/exim4# gnutls-cli -s -p 25 kniv.josefsson.org
Resolving 'kniv.josefsson.org'...
Connecting to '195.238.76.189:25'...

- Simple Client Mode:

220 kniv ESMTP Exim 4.69 Thu, 16 Apr 2009 18:10:19 +0200
ehlo foo
250-kniv Hello kniv.josefsson.org [195.238.76.189]
250-SIZE 52428800
250-PIPELINING
250-STARTTLS
250 HELP
starttls
220 TLS go ahead
^D
*** Starting TLS handshake
- Successfully sent 0 certificate(s) to server.
- Ephemeral Diffie-Hellman parameters
 - Using prime: 2056 bits
 - Secret key: 2040 bits
 - Peer's public key: 2048 bits
- Certificate type: X.509
 - Got a certificate list of 1 certificates.

 - Certificate[0] info:
 # The hostname in the certificate matches 'kniv.josefsson.org'.
 # valid since: Thu Apr 16 17:22:41 CEST 2009
 # expires at: Sat Apr 16 17:22:41 CEST 2011
 # fingerprint: 21:C5:4E:60:02:02:93:9A:3B:B6:F0:D6:8E:6B:6C:B0
 # Subject's DN: CN=kniv.josefsson.org
 # Issuer's DN: O=CAcert Inc.,OU=http://www.CAcert.org,CN=CAcert Class 3 Root

- Peer's certificate issuer is unknown
- Peer's certificate is NOT trusted
- Version: TLS1.0
- Key Exchange: DHE-RSA
- Cipher: AES-128-CBC
- MAC: SHA1
- Compression: NULL
quit
221 kniv closing connection
- Peer has closed the GNUTLS connection
kniv:/etc/exim4#
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.josefsson.org/2009/04/16/cacert-and-gnutls/feed/</wfw:commentRss>
		</item>
		<item>
		<title>OpenWRT 8.09 plus Huawei E220</title>
		<link>http://blog.josefsson.org/2009/03/05/openwrt-809-plus-huawei-e220/</link>
		<comments>http://blog.josefsson.org/2009/03/05/openwrt-809-plus-huawei-e220/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 15:39:53 +0000</pubDate>
		<dc:creator>simon</dc:creator>
		
		<category><![CDATA[general]]></category>

		<category><![CDATA[3g]]></category>

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

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

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

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

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

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

		<guid isPermaLink="false">http://blog.josefsson.org/?p=81</guid>
		<description><![CDATA[Now that OpenWRT 8.09 has been released, I finally took the time to write down my notes on how to use it together with the Huawei E220 dongle, which supports 3G/HSDPA.

The writeup on how to do this is long, so I put it at a separate page:
http://josefsson.org/openwrt/dongle.html
]]></description>
			<content:encoded><![CDATA[<p>Now that <a href="http://www.openwrt.org/" onclick="javascript:urchinTracker ('/outbound/article/www.openwrt.org');">OpenWRT 8.09</a> has been <a href="http://downloads.openwrt.org/kamikaze/release.txt" onclick="javascript:urchinTracker ('/outbound/article/downloads.openwrt.org');">released</a>, I finally took the time to write down my notes on how to use it together with the <a href="http://en.wikipedia.org/wiki/Huawei_E220" onclick="javascript:urchinTracker ('/outbound/article/en.wikipedia.org');">Huawei E220 dongle</a>, which supports 3G/<a href="http://en.wikipedia.org/wiki/HSDPA" onclick="javascript:urchinTracker ('/outbound/article/en.wikipedia.org');">HSDPA</a>.</p>
<p><img src="http://josefsson.org/openwrt/huawei-e220.jpg" alt="Huawei E220" /></p>
<p>The writeup on how to do this is long, so I put it at a separate page:<br />
<a href="http://josefsson.org/openwrt/dongle.html" >http://josefsson.org/openwrt/dongle.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.josefsson.org/2009/03/05/openwrt-809-plus-huawei-e220/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Redmine on Debian Lenny Using Lighttpd</title>
		<link>http://blog.josefsson.org/2008/10/17/redmine-on-debian-lenny-using-lighttpd/</link>
		<comments>http://blog.josefsson.org/2008/10/17/redmine-on-debian-lenny-using-lighttpd/#comments</comments>
		<pubDate>Fri, 17 Oct 2008 09:47:59 +0000</pubDate>
		<dc:creator>simon</dc:creator>
		
		<category><![CDATA[general]]></category>

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

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

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

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

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

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

		<guid isPermaLink="false">http://blog.josefsson.org/?p=61</guid>
		<description><![CDATA[The GnuTLS trac installation is in a poor shape.  To fix that, I looked into alternatives and found Redmine.  Redmine appears to do most things that I liked in Trac (wiki, roadmap and issue tracking) plus it supports more than one project (would come in handy for my other projects) and has built-in [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://trac.gnutls.org/" onclick="javascript:urchinTracker ('/outbound/article/trac.gnutls.org');">GnuTLS trac installation</a> is in a poor shape.  To fix that, I looked into alternatives and found <a href="http://www.redmine.org/" onclick="javascript:urchinTracker ('/outbound/article/www.redmine.org');">Redmine</a>.  Redmine appears to do most things that I liked in <a href="http://trac.edgewall.org/" onclick="javascript:urchinTracker ('/outbound/article/trac.edgewall.org');">Trac</a> (wiki, roadmap and issue tracking) plus it supports more than one project (would come in handy for my other projects) and has built-in <a href="http://git.or.cz/" onclick="javascript:urchinTracker ('/outbound/article/git.or.cz');">git</a> support.  I would like to see better spam handling and OpenID support, but it is good enough for our purposes now, and there are similar concerns with trac.</p>
<p>However, getting it up and running with <a href="http://www.lighttpd.net/" onclick="javascript:urchinTracker ('/outbound/article/www.lighttpd.net');">lighttpd</a> on a modern <a href="http://www.debian.org/" onclick="javascript:urchinTracker ('/outbound/article/www.debian.org');">debian</a> lenny installation was not trivial, and I needed some help from #redmine (thanks stbuehler).  After finally getting it up and running, I made a copy of the machine using <a href="http://samba.anu.edu.au/rsync/" onclick="javascript:urchinTracker ('/outbound/article/samba.anu.edu.au');">rsync</a> and <a href="http://rsnapshot.org/" onclick="javascript:urchinTracker ('/outbound/article/rsnapshot.org');">rsnapshot</a>, so I could re-create a working configuration if I get stuck, and then re-installed the virtual machine.</p>
<p>The notes below are the steps required to set up Redmine using Lighttpd and <a href="http://www.mysql.org" onclick="javascript:urchinTracker ('/outbound/article/www.mysql.org');">MySQL</a> on a Debian Lenny.  I&#8217;m posting this to help others searching for the error messages I got, and to help my own memory in case I need to re-install the server sometime.<br />
<span id="more-61"></span><br />
I assume you have installed Debian Lenny, and have root access to it.  You need to install some dependencies:</p>
<blockquote><p>
apt-get install mysql-server rails lighttpd<br />
apt-get install librmagick-ruby<br />
apt-get install subversion git-core
</p></blockquote>
<p>It is highly recommend to set a password on the MySQL root account, for example:</p>
<blockquote><p>
# /usr/bin/mysql -u root -D mysql -e &#8220;update user set password=password(&#8217;foobar&#8217;) where user=&#8217;root&#8217;&#8221;<br />
# /usr/bin/mysql -u root -e &#8220;flush privileges&#8221;
</p></blockquote>
<p>There are <a href="http://www.redmine.org/wiki/redmine/RedmineInstall" onclick="javascript:urchinTracker ('/outbound/article/www.redmine.org');">official Redmine installation instructions</a>, and these steps follow them but contains more details.</p>
<p>First, create a database for Redmine and set up a MySQL user, like this:</p>
<blockquote><p>
li37-61:~# mysql<br />
Welcome to the MySQL monitor.  Commands end with ; or \g.<br />
Your MySQL connection id is 31<br />
Server version: 5.0.51a-15 (Debian)</p>
<p>Type &#8216;help;&#8217; or &#8216;\h&#8217; for help. Type &#8216;\c&#8217; to clear the buffer.</p>
<p>mysql> create database redmine character set utf8;<br />
Query OK, 1 row affected (0.00 sec)</p>
<p>mysql> GRANT SELECT,INSERT,UPDATE,DELETE,INDEX,ALTER ON redmine.* TO &#8216;rbuser&#8217;@'localhost&#8217; IDENTIFIED BY &#8216;barfoo&#8217;;<br />
Query OK, 0 rows affected (0.00 sec)</p>
<p>mysql>
</p></blockquote>
<p>Then download and install Redmine.</p>
<p>You could check out the code using SVN although I chosed to use a stable release.  I created a new user for the redmine installation, to reduce root account usage.</p>
<blockquote><p>
adduser &#8211;disabled-password redmine<br />
su redmine<br />
wget http://rubyforge.org/frs/download.php/39477/redmine-0.7.3.tar.gz<br />
tar xfz redmine-0.7.3.tar.gz<br />
ln -s redmine-0.7.3 redmine
</p></blockquote>
<p>Modify the file redmine*/config/database.yml to read:</p>
<pre>
production:
  adapter: mysql
  database: redmine
  host: localhost
  username: rbuser
  password: barfoo
  encoding: utf8
</pre>
<p>You should now setup the database, however I got the following error at this point:</p>
<blockquote><p>
redmine@li37-61:~/redmine$ rake db:migrate RAILS_ENV=&#8221;production&#8221;<br />
(in /home/redmine/redmine)<br />
rake aborted!<br />
No such file or directory - /tmp/mysql.sock</p>
<p>(See full trace by running task with &#8211;trace)<br />
redmine@li37-61:~/redmine$
</p></blockquote>
<p>The problem is that you need the Ruby MySQL wrappers.  This isn&#8217;t really clear from the error message.  Install it using:</p>
<blockquote><p>
# apt-get install libmysql-ruby
</p></blockquote>
<p>Now re-run the database setup as the redmine user.</p>
<blockquote><p>
redmine@li37-61:~/redmine$ rake db:migrate RAILS_ENV=&#8221;production<br />
&#8230;<br />
redmine@li37-61:~/redmine$ rake redmine:load_default_data RAILS_ENV=&#8221;production&#8221;<br />
(in /home/redmine/redmine-0.7.3)</p>
<p>Select language: bg, cs, da, de, en, es, fi, fr, he, hu, it, ja, ko, lt, nl, no, pl, pt, pt-br, ro, ru, sr, sv, th, uk, zh, zh-tw [en]<br />
====================================<br />
Default configuration data loaded.<br />
redmine@li37-61:~/redmine$
</p></blockquote>
<p>At this point you should be able to test the Redmine installation using:</p>
<blockquote><p>
ruby script/server -e production
</p></blockquote>
<p>Shut it down before you continue with next steps.</p>
<p>Create a file called /etc/lighttpd/conf-available/20-redmine.conf and put the following in it.  Change the filename and hostname as appropriate, but be sure the change commands later on.</p>
<pre>
server.modules   += ( "mod_fastcgi" )

$HTTP["host"] == "redmine.josefsson.org" {
  server.document-root = "/home/redmine/redmine/public/"
  fastcgi.server    = ( ".fcgi" =>
        ((
                "bin-path" => "/home/redmine/redmine/public/dispatch.fcgi",
                "socket" => "/tmp/ruby-rails.socket",
                "max-procs" => 5,
                "idle-timeout" => 20,
                "bin-environment" => (
                        "RAILS_ENV" => "production",
                        "RAILS_ROOT" => "/home/redmine/redmine"
                ),
        ))
  )
  magnet.attract-physical-path-to = ( "/home/redmine/cleanurl.lua" )
}
</pre>
<p>Enable the module using:</p>
<blockquote><p>
# lighttpd-enable-mod redmine
</p></blockquote>
<p>You will also need to create a FastCGI wrapper:</p>
<blockquote><p>
li37-61:/home/redmine/redmine/public# cp dispatch.fcgi.example dispatch.fcgi<br />
li37-61:/home/redmine/redmine/public# chmod +x dispatch.fcgi
</p></blockquote>
<p>At this point, it can be useful to tail the various log files, I&#8217;m using a command like:</p>
<blockquote><p>
tail -F /var/log/lighttpd/access.log /var/log/lighttpd/error.log /home/redmine/redmine/log/production.log
</p></blockquote>
<p>Starting the lighttpd server at this point results in an error message:</p>
<blockquote><p>
li37-61:~# /etc/init.d/lighttpd restart<br />
Stopping web server: lighttpd.<br />
Starting web server: lighttpd.<br />
li37-61:~#<br />
2008-10-17 04:50:03: (mod_fastcgi.c.1047) the fastcgi-backend /home/redmine/redmine/public/dispatch.fcgi failed to start:<br />
2008-10-17 04:50:03: (mod_fastcgi.c.1051) child exited with status 9 /home/redmine/redmine/public/dispatch.fcgi<br />
2008-10-17 04:50:03: (mod_fastcgi.c.1054) If you&#8217;re trying to run PHP as a FastCGI backend, make sure you&#8217;re using the FastCGI-enabled version.<br />
You can find out if it is the right one by executing &#8216;php -v&#8217; and it should display &#8216;(cgi-fcgi)&#8217; in the output, NOT &#8216;(cgi)&#8217; NOR &#8216;(cli)&#8217;.<br />
For more information, check http://trac.lighttpd.net/trac/wiki/Docs%3AModFastCGI#preparing-php-as-a-fastcgi-programIf this is PHP on Gentoo, add &#8216;fastcgi&#8217; to the USE flags.<br />
2008-10-17 04:50:03: (mod_fastcgi.c.1358) [ERROR]: spawning fcgi failed.<br />
2008-10-17 04:50:03: (server.c.908) Configuration of plugins failed. Going down.
</p></blockquote>
<p>FastCGI modules are not installed by default, so you will need to install them:</p>
<blockquote><p>
li37-61:~# apt-get install libfcgi-ruby1.8
</p></blockquote>
<p>Restarting the server again, and accessing dispatch.fcgi using your browser, will result in errors like:</p>
<blockquote><p>
  Status: 500 Internal Server Error<br />
  No route matches &#8220;/dispatch.fcgi&#8221; with {:method=>:get}
</p></blockquote>
<p>Solving this is the most complicated part, and I&#8217;m not sure whether there are better solutions.  Here is what I did.  First, install lighttpd&#8217;s mod-magnet:</p>
<blockquote><p>
# apt-get install lighttpd-mod-magnet<br />
# lighttpd-enable-mod magnet
</p></blockquote>
<p>Then get a small script to invoke dispatch.fcgi properly:</p>
<blockquote><p>
cd /home/redmine<br />
wget http://nordisch.org./cleanurl.lua
</p></blockquote>
<p>For reference, the contents of the script is:</p>
<pre>
-- little helper function
function file_exists(path, ftype)
  local attr = lighty.stat(path)
  return (attr and attr[ftype])
end

function check_path(path)
    local rv = path
    if (not file_exists(path, "is_file")) then
        rv = nil
        local html_file = path .. ".html"
        if (file_exists(html_file, "is_file")) then
            rv = html_file
        else
            -- handle directory indeces
            -- we first check if we have a dir and than look for an index.html
            local index_file = path .. "/index.html"
            if (file_exists(path,"is_dir") and file_exists(index_file, "is_file")) then
                rv = index_file
            end
        end
    end
    if rv then
        lighty.env["physical.path"] = rv
    end
    return rv
end

-- the magic <img src='http://blog.josefsson.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />
if (not check_path(lighty.env["physical.path"])) then
    -- file still missing. pass it to the fastcgi backend
    lighty.env["uri.path"]          = "/dispatch.fcgi"
    lighty.env["physical.rel-path"] = lighty.env["uri.path"]
    lighty.env["request.orig-uri"]  = lighty.env["request.uri"]
    lighty.env["physical.path"]     = lighty.env["physical.doc-root"] .. lighty.env["physical.rel-path"]
end
-- fallthrough will put it back into the lighty request loop
-- that means we get the 304 handling for free. <img src='http://blog.josefsson.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />
-- debugging code
-- print ("final file is " ..  lighty.env["physical.path"])
</pre>
<p>At this point, you should be able to restart lighttpd and access your server successfully!</p>
<p>If you get permission errors such as:</p>
<blockquote><p>
  Status: 500 Internal Server Error<br />
  file /home/redmine/redmine-0.7.3/tmp/sessions//ruby_sess.c06b5f395568fd87 not readable
</p></blockquote>
<p>You need to re-run these commands:</p>
<blockquote><p>
li37-61:/home/redmine/redmine-0.7.3# chgrp -R www-data files log tmp<br />
li37-61:/home/redmine/redmine-0.7.3# chmod -R 775 files log tmp
</p></blockquote>
<p>Happy hacking!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.josefsson.org/2008/10/17/redmine-on-debian-lenny-using-lighttpd/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
