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

<channel>
	<title>Noa&#039;s blog &#187; System administration</title>
	<atom:link href="http://noa.resare.com/category/system-administration/feed/" rel="self" type="application/rss+xml" />
	<link>http://noa.resare.com</link>
	<description>moderately interesting words about things going through my mind</description>
	<lastBuildDate>Fri, 29 Jan 2010 23:56:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>D-Link DWL-G510 in CentOS 5</title>
		<link>http://noa.resare.com/2009/12/dwl-g510-centos/</link>
		<comments>http://noa.resare.com/2009/12/dwl-g510-centos/#comments</comments>
		<pubDate>Sat, 26 Dec 2009 15:48:11 +0000</pubDate>
		<dc:creator>noa</dc:creator>
				<category><![CDATA[System administration]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[AirPlus G]]></category>
		<category><![CDATA[D-Link]]></category>
		<category><![CDATA[DWL-G510]]></category>
		<category><![CDATA[PCI]]></category>
		<category><![CDATA[WiFi]]></category>

		<guid isPermaLink="false">http://noa.resare.com/?p=281</guid>
		<description><![CDATA[Some days ago I spent some time getting a PCI WiFi 802.11G network card to work in CentOS 5.4. My card identifies itself as a "D-Link System Inc AirPlus G DWL-G510" (PCI id 1186:3c09) and uses the "RaLink RT2561/RT61 rev B 802.11g" chipset (PCI id 1814:0302)
A driver for this card is included in the standard [...]]]></description>
			<content:encoded><![CDATA[<p>Some days ago I spent some time getting a PCI WiFi 802.11G network card to work in CentOS 5.4. My card identifies itself as a "D-Link System Inc AirPlus G DWL-G510" (PCI id 1186:3c09) and uses the "RaLink RT2561/RT61 rev B 802.11g" chipset (PCI id 1814:0302)<img class="alignleft size-full wp-image-284" title="DWL-G510" src="http://noa.resare.com/wp-content/uploads/2009/12/Satellite.jpg" alt="DWL-G510" width="180" height="120" /></p>
<p>A driver for this card is included in the standard CentOS 5 kernel (tested with kernel-2.6.18-164.9.1.el5) under the name rt61pci, however to be able to function a binary firmware is needed. Some searching revealed that the firmware is available in Fedora's 	rt61pci-firmware package. I rebuilt the package and put it in my <a href="http://rpm.resare.com/centos5-playground/">CentOS playground</a> repository.</p>
<p>So, if you have such a card and want to make it work in CentOS5 you might want to try running <tt>rpm -ivh http://rpm.resare.com/centos5-playground/i386/rt61pci-firmware-1.2-6.el5.noarch.rpm</tt> as root. Once that is done, running <tt>modprobe rt61pci</tt> should do the trick.</p>
]]></content:encoded>
			<wfw:commentRss>http://noa.resare.com/2009/12/dwl-g510-centos/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>My DNSSEC validator</title>
		<link>http://noa.resare.com/2009/11/dnssec/</link>
		<comments>http://noa.resare.com/2009/11/dnssec/#comments</comments>
		<pubDate>Sun, 08 Nov 2009 19:14:08 +0000</pubDate>
		<dc:creator>noa</dc:creator>
				<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[System administration]]></category>
		<category><![CDATA[DNSSEC]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://noa.resare.com/?p=267</guid>
		<description><![CDATA[As readers of this blog might have noticed I started to experiment with DNSSEC a few months ago. DNSSEC is basically a way of adding cryptographic keys and signatures to your DNS data that gives resolvers the ability to cryptographically verify the correctness of your DNS records using a series of cryptographic operations.
DNSSEC protects the [...]]]></description>
			<content:encoded><![CDATA[<p>As readers of this blog might have noticed I started to experiment with <a href="http://dnssec.net/">DNSSEC</a> a few months ago. DNSSEC is basically a way of adding cryptographic keys and signatures to your DNS data that gives resolvers the ability to cryptographically verify the correctness of your DNS records using a series of cryptographic operations.</p>
<p>DNSSEC protects the DNS system against a certain group of security problems such as the <a href="http://kaminskybug.se">kaminskybug</a>, where an attacker tricks a DNS server to return the wrong data to end users. If an attack against the DNS system is successful that means serious trouble, since we depend on it to work reliably in a vast number of online activities. An attacker that controls the DNS system can trick people to for example supply their account information to their online bank and use that to steal money. Whenever there is the potential for large scale fraud you can pretty much be sure that someone will try to break it, and that is why DNSSEC is important.</p>
<p>So, we need DNSSEC. What's stopping us from using it? A few things, but the most important obstacle in my opinion is that it is a complex set of standards and that it is difficult to understand. There are some <a href="http://alan.clegg.com/files/DNSSEC_in_6_minutes.pdf">presentations</a> and <a href="http://www.nlnetlabs.nl/publications/dnssec_howto/">HOWTO documents</a> online that attempts to explain and help people get started, but the learning curve is steep. One thing that I ran into when experimenting with my own zones was that somehow I managed to corrupt the signatures of one zone and I couldn't easily pinpoint what the problem was.</p>
<p>When confronted with this I got the idea to build an online service that tries to answer a simple question.<em> What data was used and what cryptographic operations was performed to actually verify one specific DNS record?</em> The answer to that question can be thought of as a chain of operations and records where one link connects to the other from all the way from the record being verified down to the <a href="https://dlv.isc.org/">DLV</a> root key.</p>
<p>I decided to write the service in Python and it was one of the most fun programming projects that I have worked on in years. In a way it was basic research but with a clear application and an end result that I think could be a useful contribution. I even wrote my own <a href="http://en.wikipedia.org/wiki/RSA">RSA</a> signature verification functionality, with a lots of help from Python's excellent large integer support.</p>
<p>The service can be found at <a href="http://dnssec.resare.com">http://dnssec.resare.com</a> Feel free to give it a spin. There are no doubt bugs and errors that will be fixed and other modifications that will be made, but the basic functionality is in place.</p>
<p>Thanks to Alex for the beautiful HTML design,  to the python dns library <a href="http://www.dnspython.org/">dnspython</a> that I use extensively and the <a href="http://dev.sanityinc.com/airspeed/">airspeed</a> templating library.</p>
]]></content:encoded>
			<wfw:commentRss>http://noa.resare.com/2009/11/dnssec/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>sha1sum rewritten in python using openssl</title>
		<link>http://noa.resare.com/2009/11/sha1sum/</link>
		<comments>http://noa.resare.com/2009/11/sha1sum/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 18:44:59 +0000</pubDate>
		<dc:creator>noa</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[System administration]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[sha1sum]]></category>
		<category><![CDATA[Terminal]]></category>

		<guid isPermaLink="false">http://noa.resare.com/?p=261</guid>
		<description><![CDATA[I like how I can use the sha1sum tool on my Linux boxes to create a file with checksums of a collection of files and then use the tool again to verify the files against the checksums.
I've been missing that functionality on my Mac, so I wrote a small wrapper to the openssl command that [...]]]></description>
			<content:encoded><![CDATA[<p>I like how I can use the <tt>sha1sum</tt> tool on my Linux boxes to create a file with checksums of a collection of files and then use the tool again to verify the files against the checksums.</p>
<p>I've been missing that functionality on my Mac, so I wrote a small wrapper to the openssl command that provide the same basic functionality using Python. Python is really handy when it comes to writing small scripts like that does some string handling and calls other programs and since the basic checksumming functionality already is available in the openssl package it simple, short and neat.</p>
<p>As usual, feel free to use this any way you want.</p>
<pre class="python">&nbsp;
<span style="color: #808080; font-style: italic;">#!/usr/bin/python</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">subprocess</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> checksum_file<span style="color: black;">&#40;</span>filename<span style="color: black;">&#41;</span>:
    sp = <span style="color: #dc143c;">subprocess</span>.<span style="color: black;">Popen</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;/usr/bin/openssl&quot;</span>, <span style="color: #483d8b;">&quot;sha1&quot;</span>, filename<span style="color: black;">&#93;</span>,
                          stdout=<span style="color: #dc143c;">subprocess</span>.<span style="color: black;">PIPE</span><span style="color: black;">&#41;</span>
    retval = sp.<span style="color: black;">communicate</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>
    <span style="color: #ff7700;font-weight:bold;">return</span> retval<span style="color: black;">&#91;</span>retval.<span style="color: black;">find</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;= &quot;</span><span style="color: black;">&#41;</span> + <span style="color: #ff4500;">2</span>:<span style="color: #ff4500;">-1</span><span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> verify<span style="color: black;">&#40;</span>checksumfile<span style="color: black;">&#41;</span>:
    f = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span>checksumfile, <span style="color: #483d8b;">&quot;r&quot;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">for</span> line <span style="color: #ff7700;font-weight:bold;">in</span> f:
        line = line<span style="color: black;">&#91;</span>:<span style="color: #ff4500;">-1</span><span style="color: black;">&#93;</span>
		<span style="color: black;">&#40;</span>sha1, fn<span style="color: black;">&#41;</span> = line.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;  &quot;</span><span style="color: black;">&#41;</span>
		calc = checksum_file<span style="color: black;">&#40;</span>fn<span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">if</span> calc != sha1:
            <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;%s: FAILED&quot;</span> % fn
            <span style="color: #dc143c;">sys</span>.<span style="color: black;">exit</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">else</span>:
            <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;%s: OK&quot;</span> % fn
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> usage<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Usage: sha1sum [-c CHECKSUM_FILE] [FILE]...&quot;</span>
    <span style="color: #dc143c;">sys</span>.<span style="color: black;">exit</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">'__main__'</span>:
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#41;</span> == <span style="color: #ff4500;">1</span>:
        usage<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span> == <span style="color: #483d8b;">'-c'</span>:
        <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#41;</span> != <span style="color: #ff4500;">3</span>:
            usage<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
        verify<span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">else</span>:
        <span style="color: #ff7700;font-weight:bold;">for</span> f <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span>:<span style="color: black;">&#93;</span>:
            <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;%s  %s&quot;</span> % <span style="color: black;">&#40;</span>checksum_file<span style="color: black;">&#40;</span>f<span style="color: black;">&#41;</span>, f<span style="color: black;">&#41;</span>
&nbsp;</pre>
]]></content:encoded>
			<wfw:commentRss>http://noa.resare.com/2009/11/sha1sum/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Video problems on svt.se or svd.se? Blame qbrick.com</title>
		<link>http://noa.resare.com/2009/11/qbrick-dns-fail/</link>
		<comments>http://noa.resare.com/2009/11/qbrick-dns-fail/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 14:13:06 +0000</pubDate>
		<dc:creator>noa</dc:creator>
				<category><![CDATA[System administration]]></category>

		<guid isPermaLink="false">http://noa.resare.com/?p=255</guid>
		<description><![CDATA[The Swedish public broadcasting corporation offers lots of content online on SVTPlay. Unfortunately have not worked for a while for me, and today I decided to track down the problems. It turns out to be a rather non-obvious interaction between a new feature in my resolving name server and the nameservers of the streaming provider [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://svt.se">Swedish public broadcasting corporation</a> offers lots of content online on <a href="http://svtplay.se">SVTPlay</a>. Unfortunately have not worked for a while for me, and today I decided to track down the problems. It turns out to be a rather non-obvious interaction between a new feature in my resolving name server and the nameservers of the streaming provider <a href="http://qbrick.com/">Qbrick</a> not following the DNS Specification.</p>
<p>Unlike most of the internet i use <a href="http://unbound.net/">Unbound</a> instead of <a href="https://www.isc.org/software/bind">bind</a> as my nameserver. It offers great DNSSEC support as well as a well maintained code base. One recent feature is the use of mixed case labels when sending queries to other nameservers, as outlined in the <a href="http://tools.ietf.org/html/draft-vixie-dnsext-dns0x20">DNS0x20</a> document. This is one countermeasure to the DNS Spoofing attacks that is an increasing problem on the internet these days, and it depends on the fact that name servers should treat queries that only differs in the case as if they were equals. In other words, mobizoft.qbrick.com and MobiZoft.Qbrick.com should be treated as the same.</p>
<p>The exact wording of the specification can be found in <a href="http://www.dns.net/dnsrd/rfc/rfc1035/rfc1035.html#2.3.1.">RFC1035 section 2.3.1</a>:</p>
<pre>Note that while upper and lower case letters are allowed in domain
names, no significance is attached to the case.  That is, two names with
the same spelling but different case are to be treated as if identical.</pre>
<p>Unfortunately, Qbrick's nameservers fail to implement this specification, and mixed case questions gets answered with the NXDOMAIN reply code, which means that there is no data for the given domain name. I hope that Qbrick will get their act together and fix this soon, but in the meantime it can be a good idea to use the <tt>use-caps-for-id: no</tt> directive if you are using unbound.</p>
<p>In summary it is a bit annoying that errors like these are so hard to find and correct. Most video displaying flash plugins will not report a meaningful error, and the fact that SVT uses an external provider for their streaming video solution puts the problem even further away from the end user.</p>
<p><strong>Update 091104</strong>: I have now gotten in contact with Qbrick. They recognize the problem but state that they have an ongoing project to replace the DNS solution and they will not address this issue until the new solution is in place.</p>
]]></content:encoded>
			<wfw:commentRss>http://noa.resare.com/2009/11/qbrick-dns-fail/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Moving to proper UTF-8 in MySQL for bugzilla on CentOS 5</title>
		<link>http://noa.resare.com/2009/10/bugzilla/</link>
		<comments>http://noa.resare.com/2009/10/bugzilla/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 20:34:07 +0000</pubDate>
		<dc:creator>noa</dc:creator>
				<category><![CDATA[System administration]]></category>
		<category><![CDATA[bugzilla]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[perl-DBD-MySQL]]></category>

		<guid isPermaLink="false">http://noa.resare.com/?p=246</guid>
		<description><![CDATA[I have an old bugzilla instance that has been live for some years, with lots of text in it with the Swedish non-ascii characters å, ä and ö. When I set it up I didn't think about what character encoding I used for the data, I just added data and it worked. A few days [...]]]></description>
			<content:encoded><![CDATA[<p>I have an old <a href="http://bugzilla.org/">bugzilla</a> instance that has been live for some years, with lots of text in it with the Swedish non-ascii characters å, ä and ö. When I set it up I didn't think about what character encoding I used for the data, I just added data and it worked. A few days back it was time to migrate the instance to a new bugzilla version, on a <a href="http://centos.org/">CentOS</a> 5 box. It seemed like a good idea to move the data to properly <a href="http://en.wikipedia.org/wiki/UTF-8">UTF-8</a> encoded data in the database while I was in the process of moving it. It turned out to be more difficult than I anticipated. Here is a sort list of discoveries:</p>
<ol>
<li>The text was encoded in UTF-8 in the old database, but mysql thought that it was what it calls latin1. What I had entered as å the database perceived as Ã¥, but the transformation was applied on both write to and read from the database, so the characters turned out to be correct when displayed in bugzilla again.</li>
<li>The default behavior of mysqldump is to treat data it knows to be latin1 into UTF-8 in the output file. Since my data was really UTF-8, but mysql was under the impression that it was latin1, it encoded the UTF-8 into UTF-8 once more.</li>
<li>To make matters even more complicated, what mysql calls 'latin1' is not actually ISO-8859-1 but rather a slightly modified variant of the <a href="http://en.wikipedia.org/wiki/Windows-1252">Windows-1252</a> character encoding. A result of this is that in some instances the double application of the UTF-8 transformation a single input character results in 5 output characters.</li>
<li>The solution to this mess is a curiously named option to <code>mysqldump</code> named <code>--default-character-set</code>. It can be used to override the default behavior of encoding strings marked as latin1 into UTF-8. <code>mysqldump --default-character-set latin1</code> outputs my UTF-8 correctly. Once the database is in a file, just search and replace <code>default charset=latin1</code> with <code>default charset=utf8</code> and import the data.</li>
<li>At this point, the data that was UTF-8 all along is now correctly understood by mysql to be UTF-8.</li>
<li>Next problem: when starting up bugzilla with UTF-8 settings the characters still gets mangled.</li>
<li>It turns out that the bridge between mysql and perl in CentOS 5, the perl-DBD-MySQL package, is too old to support the mysql_enable_utf8 connection parameter. As a result, strings coming out of perl-DBD-MySQL containing non-ascii is not marked as utf8 strings.</li>
<li>So, why didn't checksetup.pl tell me this when I ran it? It turns out that there is a patch in the bugzilla shipped with EPEL to remove the check for the proper perl-DBD-MySQL version to make it runnable on CentOS 5. Perhaps a reasonable tradeoff, but a bit annoying when trying to find out what fails.</li>
<li>So I compiled a recent perl-DBD-MySQL and put it in my <a href="http://rpm.resare.com/centos5-playground/">playground repository</a> and now my bugzilla displays all sorts of strange characters correctly.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://noa.resare.com/2009/10/bugzilla/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
