<?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>Fri, 08 Jan 2010 14:01:18 +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>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>
		<item>
		<title>FSCONS / Nordic Free Software Award Nomination</title>
		<link>http://blog.josefsson.org/2008/10/14/nordic-free-software-award-nomination/</link>
		<comments>http://blog.josefsson.org/2008/10/14/nordic-free-software-award-nomination/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 09:59:51 +0000</pubDate>
		<dc:creator>simon</dc:creator>
		
		<category><![CDATA[general]]></category>

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

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

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

		<guid isPermaLink="false">http://blog.josefsson.org/?p=59</guid>
		<description><![CDATA[The Free Software &#038; Culture conference FSCONS is held in Gothenburg October 24-26th.  Having been there and given talks last year, I can recommend it for anyway interested in what&#8217;s going on the free software and culture world.
I&#8217;m happy and proud to notice that I have been nominated for their award, for my work [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://fscons.org" onclick="javascript:urchinTracker ('/outbound/article/fscons.org');">Free Software &#038; Culture conference FSCONS</a> is held in Gothenburg October 24-26th.  Having been there and given talks last year, I can recommend it for anyway interested in what&#8217;s going on the free software and culture world.</p>
<p>I&#8217;m happy and proud to notice that I have been <a href="http://fscons.org/award/" onclick="javascript:urchinTracker ('/outbound/article/fscons.org');">nominated for their award</a>, for my work on security packages for the <a href="http://www.gnu.org/" onclick="javascript:urchinTracker ('/outbound/article/www.gnu.org');">GNU project</a>.  Too bad I cannot make it to the conference this year.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.josefsson.org/2008/10/14/nordic-free-software-award-nomination/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Cyclomatic Code Complexity</title>
		<link>http://blog.josefsson.org/2008/10/07/cyclomatic-code-complexity/</link>
		<comments>http://blog.josefsson.org/2008/10/07/cyclomatic-code-complexity/#comments</comments>
		<pubDate>Tue, 07 Oct 2008 11:57:01 +0000</pubDate>
		<dc:creator>simon</dc:creator>
		
		<category><![CDATA[programming]]></category>

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

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

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

		<guid isPermaLink="false">http://blog.josefsson.org/?p=46</guid>
		<description><![CDATA[Inspired by my own OWASP Sweden chapter talk last night, I learned more about Cyclomatic Code Complexity and did some practical experiments.
Cyclomatic Code Complexity was described by Thomas J. McCabe in 1976.  Read the Wikipedia entry for the entire story, but in short it is a measure of C code complexity relevent to code [...]]]></description>
			<content:encoded><![CDATA[<p>Inspired by my own OWASP Sweden chapter <a href="http://josefsson.org/talks/owasp-sec.pdf" >talk</a> last night, I learned more about Cyclomatic Code Complexity and did some practical experiments.</p>
<p>Cyclomatic Code Complexity was described by Thomas J. McCabe in 1976.  Read the <a href="http://en.wikipedia.org/wiki/Cyclomatic_complexity" onclick="javascript:urchinTracker ('/outbound/article/en.wikipedia.org');">Wikipedia entry</a> for the entire story, but in short it is a measure of C code complexity relevent to code testing.</p>
<p>I learned about its practical use from <a href="http://www.gnupdf.org/" onclick="javascript:urchinTracker ('/outbound/article/www.gnupdf.org');">GNUPDF</a>&#8217;s nice <a href="http://gnupdf.org/Lib:Cyclomatic_Report" onclick="javascript:urchinTracker ('/outbound/article/gnupdf.org');">cyclomatic report</a>.  They use a tool called <a href="http://www.parisc-linux.org/~bame/pmccabe/overview.html" onclick="javascript:urchinTracker ('/outbound/article/www.parisc-linux.org');">PMCCABE</a> which happen to be packaged in Debian, so it was easy for me to test it.</p>
<p>I produced reports for some of my projects and some other popular tools, and put them online at:<br />
<a href="http://josefsson.org/cyclo/" >http://josefsson.org/cyclo/</a>.</p>
<p>Hopefully this will help me and others to find where the complex code is located.  Knowing where to look is the first step towards improving things.</p>
<p>In my projects (e.g., gnutls, gnu sasl, shishi, libidn) I use <a href="http://www.gnu.org/software/gnulib/" onclick="javascript:urchinTracker ('/outbound/article/www.gnu.org');">gnulib</a> for portability modules and maintainer scripts.  Thus it felt natural to integrate GNUPDF&#8217;s custom scripts into a gnulib module.  I&#8217;m <a href="http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/15069" onclick="javascript:urchinTracker ('/outbound/article/thread.gmane.org');">discussing the module</a> now.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.josefsson.org/2008/10/07/cyclomatic-code-complexity/feed/</wfw:commentRss>
		</item>
		<item>
		<title>My blog uses Yubikey authentication</title>
		<link>http://blog.josefsson.org/2008/06/30/my-blog-uses-yubikey-authentication/</link>
		<comments>http://blog.josefsson.org/2008/06/30/my-blog-uses-yubikey-authentication/#comments</comments>
		<pubDate>Mon, 30 Jun 2008 15:32:13 +0000</pubDate>
		<dc:creator>simon</dc:creator>
		
		<category><![CDATA[general]]></category>

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

		<category><![CDATA[two-factor]]></category>

		<category><![CDATA[wordpress plugin]]></category>

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

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

		<guid isPermaLink="false">http://blog.josefsson.org/?p=45</guid>
		<description><![CDATA[Thanks to Henrik Schack&#8217;s great work in developing a Wordpress Yubikey plugin, I now use two-factor hardware-assisted authentication technology (i.e., the Yubikey) to log in to my blog.  Kudos, Henrik!

Since my server still uses php4 (sigh), I had to create a small patch to make it use mhash instead of hash.
]]></description>
			<content:encoded><![CDATA[<p>Thanks to <a href="http://henrik.schack.dk/" onclick="javascript:urchinTracker ('/outbound/article/henrik.schack.dk');">Henrik Schack</a>&#8217;s great work in developing a <a href="http://henrik.schack.dk/yubikey-plugin/" onclick="javascript:urchinTracker ('/outbound/article/henrik.schack.dk');">Wordpress Yubikey plugin</a>, I now use two-factor hardware-assisted authentication technology (i.e., the <a href="http://yubico.com/products/yubikey/" onclick="javascript:urchinTracker ('/outbound/article/yubico.com');">Yubikey</a>) to log in to my blog.  Kudos, Henrik!</p>
<p><img src="http://yubico.com/img/_press_yubikey_hand_comp_.jpg"></p>
<p>Since my server still uses php4 (sigh), I had to create a <a href="http://forum.yubico.com/viewtopic.php?p=384#p384" onclick="javascript:urchinTracker ('/outbound/article/forum.yubico.com');">small patch</a> to make it use mhash instead of hash.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.josefsson.org/2008/06/30/my-blog-uses-yubikey-authentication/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
