<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom">
 
  <title>Brane Dump</title>
  <link href="http://hezmatt.org/~mpalmer/blog/"/>
  <link type="application/atom+xml" rel="self" href="http://hezmatt.org/~mpalmer/blog/atom.xml"/>
  <updated>2012-01-14T07:44:58+11:00</updated>
  <id>http://hezmatt.org/~mpalmer/blog/</id>
  <author>
    <name>Matt Palmer</name>
    <email>mpalmer@hezmatt.org</email>
  </author>

  
  <entry>
    <id>http://hezmatt.org/~mpalmer/blog/2011/12/25/the-other-way</id>
    <link type="text/html" rel="alternate" href="http://hezmatt.org/~mpalmer/blog/2011/12/25/the-other-way.html"/>
    <title>The Other Way...</title>
    <updated>2011-12-25T00:00:00+11:00</updated>
    <author>
      <name>Matt Palmer</name>
      <uri>http://hezmatt.org/~mpalmer/blog/</uri>
      <email>mpalmer@hezmatt.org</email>
    </author>
    <content type="html">&lt;p&gt;&lt;a href=&quot;http://twitter.com/thatcks/status/146700184099889153&quot;&gt;Chris Siebenmann
sez&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;The profusion of network cables strung through doorways here demonstrates
that two drops per sysadmin isn&amp;rsquo;t anywhere near enough.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;What I &lt;em&gt;actually&lt;/em&gt; suspect it demonstrates is that Chris&amp;rsquo; company hasn&amp;rsquo;t
learnt about the magic that is VLANs.  All of the reasons he cites in the
&lt;a href=&quot;http://utcc.utoronto.ca/~cks/space/blog/sysadmin/WiringForSysadmins&quot;&gt;longer, explanatory blog
post&lt;/a&gt;
could be solved with VLANs.  The only time you can&amp;rsquo;t get away with one
gigabit drop per office and an 8 port VLAN-capable switch is when you need
high capacity, and given how many companies struggle by with wifi, I&amp;rsquo;m going
to guess that sustained gigabit-per-machine is not a common requirement.&lt;/p&gt;

&lt;p&gt;So, for Christmas, buy your colleages a bunch of gigabit VLAN capable
switches, and you can avoid both the nightmare of not having enough network
ports, and the more hideous tragedy of having to crawl around the roofspace
and recable an entire office.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://hezmatt.org/~mpalmer/blog/2011/12/17/rethtool-how-i-learned-to-stop-worrying-and-love-the-ioctl</id>
    <link type="text/html" rel="alternate" href="http://hezmatt.org/~mpalmer/blog/2011/12/17/rethtool-how-i-learned-to-stop-worrying-and-love-the-ioctl.html"/>
    <title>Rethtool: How I Learned to Stop Worrying and Love the ioctl</title>
    <updated>2011-12-17T00:00:00+11:00</updated>
    <author>
      <name>Matt Palmer</name>
      <uri>http://hezmatt.org/~mpalmer/blog/</uri>
      <email>mpalmer@hezmatt.org</email>
    </author>
    <content type="html">&lt;p&gt;Damn those &lt;a href=&quot;http://catb.org/jargon/html/Y/yak-shaving.html&quot;&gt;unshaven
yaks&lt;/a&gt;&amp;hellip;&lt;/p&gt;

&lt;p&gt;I&amp;rsquo;m trying to write a Nagios plugin for work that will comprehensively
monitor network interfaces and make sure they&amp;rsquo;re up, passing traffic, all
those sorts of things.  Of course, I&amp;rsquo;m doing it all in Ruby, because that&amp;rsquo;s
how I roll.&lt;/p&gt;

&lt;p&gt;So, I need to Know Things about the interface.  Everyone does that with
ethtool.  Right?  Sure, if your eyeballs are parsing it.  But have you ever
tried to machine parse it?  To put it &lt;a href=&quot;http://pjrlost.blogspot.com/2011/11/linuxunix-and-new-output-pipe-stdobj.html&quot;&gt;as eloquently as
possible&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre&gt;&lt;code&gt;# ethtool eth0
Settings for eth0:
 Supported ports: [ TP MII ]
 Supported link modes:   10baseT/Half 10baseT/Full 
                         100baseT/Half 100baseT/Full 
                         1000baseT/Half 1000baseT/Full 
 Supports auto-negotiation: Yes
 Advertised link modes:  10baseT/Half 10baseT/Full 
                         100baseT/Half 100baseT/Full 
                         1000baseT/Half 1000baseT/Full 
 Advertised pause frame use: No
 Advertised auto-negotiation: Yes
 Link partner advertised link modes:  10baseT/Half 10baseT/Full 
                                      100baseT/Half 100baseT/Full 
                                      1000baseT/Half 1000baseT/Full 
 Link partner advertised pause frame use: No
 Link partner advertised auto-negotiation: Yes
 Speed: 1000Mb/s
 Duplex: Full
 Port: MII
 PHYAD: 0
 Transceiver: internal
 Auto-negotiation: on
 Supports Wake-on: pumbg
 Wake-on: g
 Current message level: 0x00000033 (51)
 Link detected: yes
&lt;/code&gt;&lt;/pre&gt;

  &lt;p&gt;Parse that, bitch!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Or&amp;hellip; perhaps not.&lt;/p&gt;

&lt;p&gt;At any rate, I decided that it would be most advantageous if I went
straight to the source and twiddle the &lt;code&gt;ioctl&lt;/code&gt; until it did my bidding.&lt;/p&gt;

&lt;p&gt;And thus, about 5 hours later, was
&lt;a href=&quot;http://theshed.hezmatt.org/rethtool&quot;&gt;Rethtool&lt;/a&gt; born.&lt;/p&gt;

&lt;p&gt;Once I worked out a less-than-entirely-crackful way of dealing with C
structs in Ruby (after a bit of digging around, I went with the
appallingly-undocumented-but-sufficiently-featureful
&lt;a href=&quot;http://cstruct.rubyforge.org/&quot;&gt;CStruct&lt;/a&gt;), and after I finally worked out I
was passing the &lt;em&gt;wrong damned struct&lt;/em&gt; to &lt;code&gt;ioctl(SIOCETHTOOL)&lt;/code&gt; (speaking of
appallingly-undocumented: fuck you, &lt;code&gt;ioctl&lt;/code&gt;, and all your twisty-passages
children), it was smooth sailing.&lt;/p&gt;

&lt;p&gt;So, if you&amp;rsquo;re one of the eight or so people on earth who will ever need to
get at the grubby internals of your network interfaces using Ruby (and can&amp;rsquo;t
do it via some sysfs magic), &lt;a href=&quot;http://theshed.hezmatt.org/rethtool&quot;&gt;Rethtool&lt;/a&gt;
is for you.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://hezmatt.org/~mpalmer/blog/2011/11/12/misleading-error-messages-from-blktrace</id>
    <link type="text/html" rel="alternate" href="http://hezmatt.org/~mpalmer/blog/2011/11/12/misleading-error-messages-from-blktrace.html"/>
    <title>Misleading error messages from blktrace</title>
    <updated>2011-11-12T00:00:00+11:00</updated>
    <author>
      <name>Matt Palmer</name>
      <uri>http://hezmatt.org/~mpalmer/blog/</uri>
      <email>mpalmer@hezmatt.org</email>
    </author>
    <content type="html">&lt;p&gt;If you ever get an error message from the &lt;code&gt;blktrace&lt;/code&gt; tool that looks like
this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;BLKTRACESETUP(2) /dev/dm-0 failed: 2/No such file or directory
Thread 3 failed open /sys/kernel/debug/block/(null)/trace3: 2/No such file or directory
Thread 2 failed open /sys/kernel/debug/block/(null)/trace2: 2/No such file or directory
Thread 0 failed open /sys/kernel/debug/block/(null)/trace0: 2/No such file or directory
Thread 1 failed open /sys/kernel/debug/block/(null)/trace1: 2/No such file or directory
FAILED to start thread on CPU 0: 1/Operation not permitted
FAILED to start thread on CPU 1: 1/Operation not permitted
FAILED to start thread on CPU 2: 1/Operation not permitted
FAILED to start thread on CPU 3: 1/Operation not permitted
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Don&amp;rsquo;t be alarmed &amp;ndash; your disk hasn&amp;rsquo;t suddenly disappeared out from
underneath you.  In fact, it means quite the opposite of what &amp;ldquo;No such file
or directory&amp;rdquo; might imply.  In fact, it means that there is already a
&lt;code&gt;blktrace&lt;/code&gt; of that particular block device in progress, and you&amp;rsquo;ll need to
kill that one off before you can start another one.&lt;/p&gt;

&lt;p&gt;Thank $DEITY for the kernel source code &amp;ndash; it was the only hope I had of
diagnosing this particular nit before I went completely bananas and smashed
my keyboard into small pieces.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://hezmatt.org/~mpalmer/blog/2011/10/28/rsync-for-lvm-managed-block-devices</id>
    <link type="text/html" rel="alternate" href="http://hezmatt.org/~mpalmer/blog/2011/10/28/rsync-for-lvm-managed-block-devices.html"/>
    <title>rsync for LVM-managed block devices</title>
    <updated>2011-10-28T00:00:00+11:00</updated>
    <author>
      <name>Matt Palmer</name>
      <uri>http://hezmatt.org/~mpalmer/blog/</uri>
      <email>mpalmer@hezmatt.org</email>
    </author>
    <content type="html">&lt;p&gt;If you&amp;rsquo;ve ever had to migrate a service to a new machine, you&amp;rsquo;ve probably
found &lt;code&gt;rsync&lt;/code&gt; to be a godsend.  It&amp;rsquo;s ability to pre-sync most data while the
service is still running, then perform the much quicker &amp;ldquo;sync the new
changes&amp;rdquo; action after the service has been taken down is fantastic.&lt;/p&gt;

&lt;p&gt;For a long time, I&amp;rsquo;ve wanted a similar tool for block devices.  I&amp;rsquo;ve managed
ridiculous numbers of VMs in my time, almost all stored in LVM logical
volumes, and migrating them between machines is a downtime hassle.  You need
to shutdown the VM, do a massive &lt;code&gt;dd | netcat&lt;/code&gt;, and then bring the machine
back up.  For a large disk, even over a fast local network, this can be
quite an extended period of downtime.&lt;/p&gt;

&lt;p&gt;The naive implementation of a tool that was capable of doing a block-device
&lt;code&gt;rsync&lt;/code&gt; would be to checksum the contents of the device, possibly in blocks,
and transfer only the blocks that have changed.  Unfortunately, as network
speeds approach disk I/O speeds, this becomes a pointless operation. 
Scanning 200GB of data and checksumming it still takes a fair amount of time
&amp;ndash; in fact, it&amp;rsquo;s often nearly as quick to just send all the data as it is to
checksum it and then send the differences.&lt;sup id=&quot;fnref:rsync-speed&quot;&gt;&lt;a href=&quot;#fn:rsync-speed&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;

&lt;p&gt;No, a different approach is needed for block devices.  We need something
that keeps track of the blocks on disk that have changed since our initial
sync, so that we can just transfer those changed blocks.&lt;/p&gt;

&lt;p&gt;As it turns out, keeping track of changed blocks is &lt;em&gt;exactly&lt;/em&gt; what LVM
snapshots do.  They actually keep a copy of what was in the blocks before it
changed, but we&amp;rsquo;re not interested in that so much.  No, what we want is the
list of changed blocks, which is stored in a hash table on disk.&lt;/p&gt;

&lt;p&gt;All that was missing was a tool that read this hash table to get the list of
blocks that had changed, then sent them over a network to another program
that was listening for the changes and could write them into the right
places on the destination.&lt;/p&gt;

&lt;p&gt;That tool now exists, and is called
&lt;a href=&quot;http://theshed.hezmatt.org/lvmsync&quot;&gt;&lt;code&gt;lvmsync&lt;/code&gt;&lt;/a&gt;.  It is a slightly crufty
chunk of ruby that, when given a local LV and a remote machine and block
device, reads the snapshot metadata and transfers the changed blocks over an
SSH connection it sets up.&lt;/p&gt;

&lt;p&gt;Be warned: at present, it&amp;rsquo;s a pretty raw piece of code.  It does nothing but
the &amp;ldquo;send updated blocks over the network&amp;rdquo;, so you have to deal with the
snapshot creation, initial sync, and so on.  As time goes on, I&amp;rsquo;m hoping to
polish it and turn it into something Very Awesome.  &amp;ldquo;Patches Accepted&amp;rdquo;, as
the saying goes.&lt;/p&gt;
&lt;div class=&quot;footnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:rsync-speed&quot;&gt;
      &lt;p&gt;&lt;code&gt;rsync&lt;/code&gt; avoids a full-disk checksum because it cheats and
uses file metadata (the last-modified time, or &lt;code&gt;mtime&lt;/code&gt; of a file) to
choose which files can be ignored.  No such metadata is available for
block devices (in the general case).&lt;a href=&quot;#fnref:rsync-speed&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</content>
  </entry>
  
  <entry>
    <id>http://hezmatt.org/~mpalmer/blog/2011/08/23/upses-in-datacentres</id>
    <link type="text/html" rel="alternate" href="http://hezmatt.org/~mpalmer/blog/2011/08/23/upses-in-datacentres.html"/>
    <title>UPSes in Datacentres</title>
    <updated>2011-08-23T00:00:00+10:00</updated>
    <author>
      <name>Matt Palmer</name>
      <uri>http://hezmatt.org/~mpalmer/blog/</uri>
      <email>mpalmer@hezmatt.org</email>
    </author>
    <content type="html">&lt;p&gt;&lt;em&gt;(This was going to be a comment on &lt;a href=&quot;http://thenubbyadmin.com/2011/08/22/dont-laugh-at-people-who-place-battery-backups-in-their-colocation-racks/&quot;&gt;this blog
post&lt;/a&gt;,
but it&amp;rsquo;s a Turdpress site that wants JS and cookies to comment.  Bugger that
for a game of skittles.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Rimuhosting&amp;rsquo;s recent &lt;a href=&quot;https://rimuhosting.com/maintenance.jsp?server_maint_oid=422895391&quot;&gt;extended outage due to power
problems&lt;/a&gt;
was apparently caused by &lt;a href=&quot;https://accounts.colo4.com/status/&quot;&gt;a transfer switch failure at their colo
provider&lt;/a&gt;.  This has led people to
wonder if putting UPSes in individual racks is a wise move.  The theory is
that in the event of a small outage, the UPS can keep things humming, and in
an extended outage you can gracefully shut things down rather than having a
hard &lt;em&gt;thump&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;I happen to think this theory is bunkum.  Your UPS is a newly instituted
single point of failure.  I&amp;rsquo;d be willing to bet that the cost of purchasing,
installing, and maintaining the UPSes, as well as the cost of the outages
that inevitably result from their occasional failure, would be far greater
than the cost of the occasional power outage you get in a well-managed
facility.&lt;/p&gt;

&lt;p&gt;Good facilities don&amp;rsquo;t have small outages.  They don&amp;rsquo;t have squirrels in the
roof cavities, and they don&amp;rsquo;t have people dropping spanners across busbars. 
The only outages they have are the big ones, when some piece of
overengineered equipment turns out to be not so overengineered &amp;ndash; the
multi-hour (or multi-day) ones where your UPS isn&amp;rsquo;t going to stop you from
going down.  Your SLA credit and customer goodwill is already toast, so all
you&amp;rsquo;re saving is the incremental cost of a little bit more downtime while
you get fscks run.&lt;/p&gt;

&lt;p&gt;If you want the best possible power reliability, get yourself into a really
well engineered facility, and run dual-power on everything.  &lt;em&gt;Definitely&lt;/em&gt;
run the numbers before you go down the UPS road; I&amp;rsquo;ll bet you find they&amp;rsquo;re
not worth it.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://hezmatt.org/~mpalmer/blog/2011/08/23/oh-hp-you-bucket-of-fail</id>
    <link type="text/html" rel="alternate" href="http://hezmatt.org/~mpalmer/blog/2011/08/23/oh-hp-you-bucket-of-fail.html"/>
    <title>Oh HP, you Bucket of Fail</title>
    <updated>2011-08-23T00:00:00+10:00</updated>
    <author>
      <name>Matt Palmer</name>
      <uri>http://hezmatt.org/~mpalmer/blog/</uri>
      <email>mpalmer@hezmatt.org</email>
    </author>
    <content type="html">&lt;p&gt;I recently got given a new printer, a HP LaserJet
&amp;ldquo;Professional&amp;rdquo;&lt;sup id=&quot;fnref:scarequotes&quot;&gt;&lt;a href=&quot;#fn:scarequotes&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; P1102w.  It&amp;rsquo;s fairly loudly touted on HP&amp;rsquo;s
website that this printer has &amp;ldquo;Full&amp;rdquo; support under Linux.&lt;/p&gt;

&lt;p&gt;And yet, it won&amp;rsquo;t work with my Linux-based print server.  Why?  Because it
uses a proprietary driver plugin, and that plugin is only available for x86
and amd64, and my print server is ARM-based.  Well &lt;em&gt;done&lt;/em&gt;, HP.  You&amp;rsquo;ve
managed to revive the old &amp;ldquo;all the world&amp;rsquo;s a VAX&amp;rdquo; philosophy, on an OS that
is more than capable of running on practically anything.  You got that for
free.  Why do you insist on screwing with it?&lt;/p&gt;

&lt;p&gt;As an added bonus, when I try to &amp;ldquo;Ask a Question&amp;rdquo; on the HPLIP website, to
politely (ha!) inquire as to the possibility of an ARM binary, I get sent to
Launchpad, which does nothing more than tell me that there is an &amp;ldquo;Invalid
OpenID transaction&amp;rdquo;.  That&amp;rsquo;s the entire content of the page.  Useful.&lt;/p&gt;

&lt;p&gt;Lies, damned lies, and a double helping of proprietary software fail.  My
day is complete.&lt;/p&gt;
&lt;div class=&quot;footnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:scarequotes&quot;&gt;
      &lt;p&gt;I use scarequotes around &amp;ldquo;Professional&amp;rdquo; because, as far as I
can tell, this is just an entry-level personal laser printer.  There is
nothing particularly professional about it.&lt;a href=&quot;#fnref:scarequotes&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</content>
  </entry>
  
  <entry>
    <id>http://hezmatt.org/~mpalmer/blog/2011/08/21/unintended-consequences-why-evidence-matters</id>
    <link type="text/html" rel="alternate" href="http://hezmatt.org/~mpalmer/blog/2011/08/21/unintended-consequences-why-evidence-matters.html"/>
    <title>Unintended Consequences: Why Evidence Matters</title>
    <updated>2011-08-21T00:00:00+10:00</updated>
    <author>
      <name>Matt Palmer</name>
      <uri>http://hezmatt.org/~mpalmer/blog/</uri>
      <email>mpalmer@hezmatt.org</email>
    </author>
    <content type="html">&lt;p&gt;If you were trying to get rid of hiring discrimination (on grounds
irrelevant to the ability to do the job), you&amp;rsquo;d think a good way to do it
would be to reduce the ability of the hiring manager to discriminate, by
restricting their access to irrelevant (but possibly prejudicial)
information.  It&amp;rsquo;s certainly what I might come up with as an early idea in a
brainstorming session.&lt;/p&gt;

&lt;p&gt;I&amp;rsquo;m not alone: &lt;a href=&quot;http://www.connexionfrance.com/anonymous-cv-compulsory-plan-abandoned-job-discrimination-pilot-scheme-view-article.html&quot;&gt;France had this same idea, and gave it a
go&lt;/a&gt;,
by passing a law requiring companies to anonymise resumes before they got to
any decision makers.&lt;/p&gt;

&lt;p&gt;So far, so average.  But rather than just coming up with an idea and
inflicting it on everyone by a blanket law, they did what should be done
with all new ideas: they trialled it (with 50 large corporations, according
to the report) before making it universal, to make sure that the theory
matched reality.  Then, after giving it a good shake, they examined the
evidence, and found that the idea had some unintended consequences:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Applicants with foreign names, or who lived in under privileged areas were
found to be less likely to be called in for an interview without the
listing of their name and address.  Researchers reasoned that this was
because employers and recruiters made allowances for subpar presentation
or limited French speaking if their performance could be explained by
deprivation or foreign birth.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The icing on the cake is that now the evidence is in, they&amp;rsquo;re now planning
on making it &amp;ldquo;optional&amp;rdquo; (I&amp;rsquo;m not sure how that&amp;rsquo;s different from killing it
entirely, but I guess it&amp;rsquo;s worth the same in the end).&lt;/p&gt;

&lt;p&gt;So we&amp;rsquo;ve got the quinella of decision-making awesome:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;An idea was had&lt;/li&gt;
  &lt;li&gt;A trial was run&lt;/li&gt;
  &lt;li&gt;The evidence was examined&lt;/li&gt;
  &lt;li&gt;When the evidence didn&amp;rsquo;t support the idea, the idea was abandoned&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Far too often, we get far too attached to our ideas, and don&amp;rsquo;t let them go
when reality doesn&amp;rsquo;t fit our preconceptions.  Kudos to the people involved
in this idea for not letting their egos get in the way of good government. 
Let it be an object lesson for us all.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://hezmatt.org/~mpalmer/blog/2011/08/19/stream-of-consciousness</id>
    <link type="text/html" rel="alternate" href="http://hezmatt.org/~mpalmer/blog/2011/08/19/stream-of-consciousness.html"/>
    <title>Stream of Consciousness</title>
    <updated>2011-08-19T00:00:00+10:00</updated>
    <author>
      <name>Matt Palmer</name>
      <uri>http://hezmatt.org/~mpalmer/blog/</uri>
      <email>mpalmer@hezmatt.org</email>
    </author>
    <content type="html">&lt;p&gt;&lt;a href=&quot;http://www.manager-tools.com/forums-3873#comment-57171&quot;&gt;This forum post&lt;/a&gt; on
requiring formal letters of resignation made me smile:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;HR does silly stuff like this all the time.  Somebody&amp;rsquo;s following some
policy that was created because somebody verbally resigned nine years ago
and then wanted to come back and some executive said where&amp;rsquo;s their letter
and HR said we don&amp;rsquo;t have one and the exec said that&amp;rsquo;s not good and we
oughta not be doing stuff to help people leave unless they&amp;rsquo;re really
leaving and HR said okay we&amp;rsquo;ll have a policy and the exec said that&amp;rsquo;s
good.&lt;/p&gt;

  &lt;p&gt;And the exec&amp;rsquo;s not there anymore.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I&amp;rsquo;ll leave everyone to make their own conclusions as to why I was reading
that particular thread.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://hezmatt.org/~mpalmer/blog/2011/08/07/using-a-local-root-zone-with-djbdns</id>
    <link type="text/html" rel="alternate" href="http://hezmatt.org/~mpalmer/blog/2011/08/07/using-a-local-root-zone-with-djbdns.html"/>
    <title>Using a Local Root Zone with djbdns</title>
    <updated>2011-08-07T00:00:00+10:00</updated>
    <author>
      <name>Matt Palmer</name>
      <uri>http://hezmatt.org/~mpalmer/blog/</uri>
      <email>mpalmer@hezmatt.org</email>
    </author>
    <content type="html">&lt;p&gt;In my continuing war on the effects of &lt;a href=&quot;http://hezmatt.org/~mpalmer/blog/2011/07/13/wireless-internet-is-the-future-my-arse.html&quot;&gt;craptastic mobile Internet
connectivity&lt;/a&gt;,
I came across a suggestion to &lt;a href=&quot;http://www.ietf.org/mail-archive/web/dnsop/current/msg00091.html&quot;&gt;host a local copy of the root zone alongside
your local DNS
resolver&lt;/a&gt;. 
It&amp;rsquo;s an interesting idea, so I&amp;rsquo;ve decided to give it a go, despite the
potential problems (I&amp;rsquo;m confident I can manage the risks).&lt;/p&gt;

&lt;p&gt;I was surprised to find that nobody had a guide on setting this up using
djbdns&lt;sup id=&quot;fnref:djbdns&quot;&gt;&lt;a href=&quot;#fn:djbdns&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; so&amp;hellip;  I&amp;rsquo;ve written one.&lt;/p&gt;

&lt;p&gt;If you&amp;rsquo;re thinking of doing this yourself, heed some words of caution: It is
&lt;em&gt;imperative&lt;/em&gt; that you keep your local cache up to date.  If you set this up,
and don&amp;rsquo;t maintain it, you will have a slow, gradual degradation of Internet
service as the live root zone diverges from your local, out-of-date cache. &lt;/p&gt;

&lt;p&gt;If you set this up locally, just for yourself, that&amp;rsquo;s one thing; all you&amp;rsquo;re
doing is breaking your own machine.  If you want to do this for the ISP you
run, though, you&amp;rsquo;re doing your customers a grave disservice if you don&amp;rsquo;t
automate the cache update, and &lt;strong&gt;setup some means of monitoring that your
cache is kept up to date&lt;/strong&gt; (a SOA check against the live roots, or at least
a check to make sure that your &lt;code&gt;data.cdb&lt;/code&gt; file is no more than a couple of
days old).&lt;/p&gt;

&lt;h1 id=&quot;the-design&quot;&gt;The Design&lt;/h1&gt;

&lt;p&gt;For simplicity, I decided to run a dedicated &lt;code&gt;tinydns&lt;/code&gt; instance that &lt;em&gt;only&lt;/em&gt;
serves the root zone.  This makes it easy to periodically refresh the root
zone that I serve with a script, which I run daily, without needing to
integrate with the database of any other &lt;code&gt;tinydns&lt;/code&gt; instances I&amp;rsquo;ve got
running (I have a couple on my laptop for testing).  I&amp;rsquo;ve set this up on an
arbitrary loopback address (&lt;code&gt;127.53.53.53&lt;/code&gt;), so it&amp;rsquo;s inaccessable from
anywhere other than localhost, and so my local &lt;code&gt;dnscache&lt;/code&gt; instance just
forwards root zone requests to it.&lt;/p&gt;

&lt;h1 id=&quot;setup-the-infrastructure&quot;&gt;Setup the infrastructure&lt;/h1&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Install gnupg (make sure you&amp;rsquo;ve also got the &lt;code&gt;gpgv&lt;/code&gt; utility) and the
necessary tools to build a minimal C program (such as &lt;code&gt;build-essential&lt;/code&gt; on
Debian).&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;As the user you&amp;rsquo;re going to run the daily update script as, run the
following:&lt;/p&gt;

    &lt;pre&gt;&lt;code&gt;  gpg --primary-keyring ~/.gnupg/trustedkeys.gpg --recv-keys 20E3C425
&lt;/code&gt;&lt;/pre&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Build/install &lt;code&gt;https://github.com/derat/bind-to-tinydns&lt;/code&gt;, because the root
zone is provided in BIND zonefile format, and&amp;hellip; we don&amp;rsquo;t want that.&lt;/p&gt;

    &lt;pre&gt;&lt;code&gt;  git clone git://github.com/derat/bind-to-tinydns.git btt
  cd btt
  make
  sudo cp bind-to-tinydns /usr/local/bin/
&lt;/code&gt;&lt;/pre&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Setup your local root-zone-only tinydns (these commands assume my local
structure for daemontools-using programs; adapt to suit)&lt;/p&gt;

    &lt;pre&gt;&lt;code&gt;  sudo tinydns-conf tinydns tinydns /var/lib/service/tinydns-root 127.53.53.53
  sudo ln -s /var/lib/service/tinydns-root /etc/service/tinydns-root
&lt;/code&gt;&lt;/pre&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Since some root zone records can be too large for a standard DNS UDP
packet, you&amp;rsquo;ll need to have an &lt;code&gt;axfrdns&lt;/code&gt; running as well; this is
pretty straightforward too:&lt;/p&gt;

    &lt;pre&gt;&lt;code&gt;  sudo axfrdns-conf tinydns tinydns \
      /var/lib/service/axfrdns-root /var/lib/service/tinydns-root 127.53.53.53
  echo 127.0.0.1:allow |sudo tee /var/lib/service/axfrdns-root/tcp
  sudo tcprules /var/lib/service/axfrdns-root/tcp.cdb \
      /var/lib/service/axfrdns-root/tcp.tmp &amp;lt; /var/lib/service/axfrdns-root/tcp
  sudo ln -s /var/lib/service/axfrdns-root /etc/service/axfrdns-root
&lt;/code&gt;&lt;/pre&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Let the user who will be running the daily update script update the
&lt;code&gt;data.cdb&lt;/code&gt; file:&lt;/p&gt;

    &lt;pre&gt;&lt;code&gt;  sudo touch /etc/service/tinydns-root/root/data.cdb
  sudo chown someuser /etc/service/tinydns-root/root/data.cdb
&lt;/code&gt;&lt;/pre&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You&amp;rsquo;ve now got a minimal &lt;code&gt;tinydns&lt;/code&gt; suitable for serving a local cache of the
root zone to anyone on your local machine who asks.  But where&amp;rsquo;s the data?&lt;/p&gt;

&lt;h1 id=&quot;script-the-root-zone-processing&quot;&gt;Script the root zone processing&lt;/h1&gt;

&lt;p&gt;The following script should do the job nicely.  Drop it somewhere useful and
&lt;code&gt;chmod a+x&lt;/code&gt; it.  If you put your &lt;code&gt;tinydns&lt;/code&gt; somewhere else, change the
&lt;code&gt;TINYDNS_DATA&lt;/code&gt; variable at the top.&lt;/p&gt;

&lt;p&gt;Run it once by hand to &amp;ldquo;seed&amp;rdquo; your root cache, then add it to cron for a
nightly update.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/bin/sh

set -e

TINYDNS_DATA=&quot;/etc/service/tinydns-root/root/data.cdb&quot;

###########################################################################

WORKDIR=&quot;$(mktemp -d)&quot;
trap &quot;rm -rf ${WORKDIR}&quot; EXIT

cd &quot;$WORKDIR&quot;

wget -q http://www.internic.net/domain/root.zone.gz
wget -q http://www.internic.net/domain/root.zone.gz.sig

if ! gpgv root.zone.gz.sig root.zone.gz &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then
        echo &quot;Root zone signature validation failed -- this is probably
really bad&quot; &amp;gt;&amp;amp;2
        exit 1
fi

gzip -d root.zone.gz

egrep -v '[[:space:]]IN[[:space:]]+(RRSIG|DNSKEY|DS|NSEC)[[:space:]]' root.zone \
     | /usr/local/bin/bind-to-tinydns . data btttmp

tinydns-data

cp data.cdb &quot;${TINYDNS_DATA}&quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;h1 id=&quot;test&quot;&gt;Test&lt;/h1&gt;

&lt;p&gt;The simplest test, to make sure you&amp;rsquo;ve got everything running, is just to
request something from the root zone:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;dig @127.53.53.53 com IN NS
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If you get something useful (compare against &lt;code&gt;dig com IN NS&lt;/code&gt; for a sanity
check) then everything&amp;rsquo;s probably working well.&lt;/p&gt;

&lt;h1 id=&quot;point-dnscache-to-your-local-root-server&quot;&gt;Point dnscache to your local root server&lt;/h1&gt;

&lt;pre&gt;&lt;code&gt;echo 127.53.53.53 &amp;gt;/etc/service/dnscache/root/servers/@
svc -k /etc/service/dnscache
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And you&amp;rsquo;re away.&lt;/p&gt;
&lt;div class=&quot;footnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:djbdns&quot;&gt;
      &lt;p&gt;For all it&amp;rsquo;s oddities, it&amp;rsquo;s a very tidy piece of software, and
takes up so little resources on a modern system that it&amp;rsquo;s presence is
practically invisible &amp;ndash; it uses less memory than &lt;code&gt;init&lt;/code&gt;.&lt;a href=&quot;#fnref:djbdns&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</content>
  </entry>
  
  <entry>
    <id>http://hezmatt.org/~mpalmer/blog/2011/08/06/why-everyone-needs-https</id>
    <link type="text/html" rel="alternate" href="http://hezmatt.org/~mpalmer/blog/2011/08/06/why-everyone-needs-https.html"/>
    <title>Why Everyone Needs HTTPS</title>
    <updated>2011-08-06T00:00:00+10:00</updated>
    <author>
      <name>Matt Palmer</name>
      <uri>http://hezmatt.org/~mpalmer/blog/</uri>
      <email>mpalmer@hezmatt.org</email>
    </author>
    <content type="html">&lt;p&gt;&amp;ldquo;Everyone&amp;rdquo; knows that if you have people logging into your site, you should
at least be considering providing pervasive HTTPS for your site, so your
users don&amp;rsquo;t &lt;a href=&quot;http://codebutler.com/firesheep&quot;&gt;get pwned by Firesheep&lt;/a&gt;.  Of
course, some people &lt;a href=&quot;http://meta.stackoverflow.com/questions/69171/why-doesnt-the-stack-overflow-team-fix-the-firesheep-style-cookie-theft&quot;&gt;don&amp;rsquo;t worry about their users getting
impersonated&lt;/a&gt;,
but&amp;hellip; yeah.&lt;/p&gt;

&lt;p&gt;But even if you&amp;rsquo;re just a brochureware site, it&amp;rsquo;s time you get the HTTPS
religion.  Because if you don&amp;rsquo;t, you leave your users open to &lt;a href=&quot;http://serverfault.com/q/298277/1375&quot;&gt;ISPs like
this&lt;/a&gt;, who want to modify the HTML you
send to include their own ads and notifications, or &lt;a href=&quot;http://www.newscientist.com/article/dn20768-us-internet-providers-hijacking-users-search-queries.html&quot;&gt;this
bunch&lt;/a&gt;
who thought it might be a good idea to redirect users&amp;rsquo; searches to their own
revenue generating services.&lt;/p&gt;

&lt;p&gt;When you&amp;rsquo;re forking out for the extra expense of HTTPSifying your site (it&amp;rsquo;s
not huge, but it&amp;rsquo;s not likely to be free), thank all those people who have
decided that their need to extract additional profit from the people who
already pay them money for Internet service outweighs their responsibilities
to provide the service they&amp;rsquo;ve been contracted to provide.&lt;/p&gt;
</content>
  </entry>
  
 
</feed>

