<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
 <title>www.nick-andrew.net</title>
 <link>http://www.nick-andrew.net</link>
 <description>Nick Andrew's news</description>
 <pubDate>Fri, 22 Apr 2011 08:00:02 +1000</pubDate>
 <lastBuildDate>Fri, 22 Apr 2011 08:00:02 +1000</lastBuildDate>
 <language>en</language>
 <copyright>Creative Commons Attribution Share Alike (by-sa)</copyright>
 <webMaster>nick@nick-andrew.net</webMaster>
 <docs>http://cyber.law.harvard.edu/rss/rss.html</docs>
 <ttl>360</ttl>

<item>
	<title>No sound after upgrading to Ubuntu 9.10 (Karmic Koala)</title>
	<link>http://www.nick-andrew.net/news/20100425-no-sound-in-ubuntu-karmic.html</link>
	<pubDate>Sun, 25 Apr 2010 17:33:44 +1000</pubDate>
	<guid>No sound after upgrading to Ubuntu 9.10 (Karmic Koala) 1272180824</guid>
	<description>
&lt;h1&gt;2010-04-25 - No sound after upgrading to Ubuntu 9.10 (Karmic Koala)&lt;/h1&gt;

&lt;p&gt;This affected my EEE 901. The symptoms were:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No sound output on the laptop's built-in device (snd-hda-intel)&lt;/li&gt;
&lt;li&gt;When I plugged in a USB sound device (snd-usb-audio), it also didn't produce any sound&lt;/li&gt;
&lt;li&gt;Pulseaudio showed only a "dummy" output device. No hardware devices shown&lt;/li&gt;
&lt;li&gt;"cat /proc/asound/cards" showed the sound cards were recognised by the kernel&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The problem turned out to be with my $HOME/.asoundrc and $HOME/.asoundrc.asoundconf files.
I found this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"alsamixer" failed to run, complaining of problems with the above files&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Solution:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I removed .asoundrc and .asoundrc.asoundconf&lt;/li&gt;
&lt;li&gt;I killed and restarted pulseaudio
&lt;ul&gt;
&lt;li&gt;pulseaudio -k&lt;/li&gt;
&lt;li&gt;pulseaudio --start&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then sound worked. I assume that pulseaudio couldn't get the ALSA device information due
to the problems with the config file(s). It was probably only .asoundrc.asoundconf with
a problem but I had nothing special in the other file so I removed that too.&lt;/p&gt;
	</description>
</item>

<item>
	<title>GPT, Grub and RAID</title>
	<link>http://www.nick-andrew.net/news/20100416-gpt-grub-raid.html</link>
	<pubDate>Sat, 17 Apr 2010 19:46:46 +1000</pubDate>
	<guid>GPT, Grub and RAID 1271497606</guid>
	<description>
&lt;h1&gt;2010-04-16 - GPT, Grub and RAID&lt;/h1&gt;

&lt;p&gt;GPT is the Generalised Partition Table which is a new standard for
partitioning a hard disk. Its advantages over the MSDOS partition
table used since the 1980s are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;larger devices (over 2T)&lt;/li&gt;
&lt;li&gt;more partitions per device&lt;/li&gt;
&lt;li&gt;extended set of partition types&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Grub 2 (versions 1.96 and later) can boot disks which use GPT, but
there are some considerations which are detailed below.&lt;/p&gt;

&lt;h2&gt;What's the MSDOS partition table?&lt;/h2&gt;

&lt;p&gt;The MSDOS partition table was invented when disk drive capacities
were around 5-20 megabytes and sectors were addressed using a (C,H,S)
3-tuple: Cylinder, Head and Sector numbers. This addressing scheme has
been obsolete for a very long time now, and has been kludged several
times to cope. Firstly disk drive capacities increased enormously - and
we started to use geometries with large numbers of heads (63) and
sectors (255) to cope. Secondly disk drives no longer have a fixed
geometry: although the number of heads is fixed (up to twice the number
of physical platters the drive has), there is a varying number of sectors
per track, as more data is stored on the outside of each platter. Disk
drives store an approximately constant amount of data per square millimetre
of disk surface. Thirdly, modern drives provide internal error correction
by relocating sectors away from disk areas with physical defects.&lt;/p&gt;

&lt;p&gt;The MSDOS partition table uses CHS and also provides an LBA representation
of each partition. LBA is a linear numbering of sectors independent of
the physical drive geometry in which sectors are numbered starting from
zero and going to a very high number (depending on device listed capacity)
and we have relied on this for some years now - as the size of devices
exceeded the capacity of CHS to describe, operating systems started ignoring
the CHS values and using only LBA. But LBA's capacity is about to run out;
it has a hard limit of 2 TB (1 terabyte = 2^40 bytes) and we will soon
surpass that capacity.&lt;/p&gt;

&lt;h2&gt;What's GPT?&lt;/h2&gt;

&lt;p&gt;GPT uses an LBA system with a much larger capacity. It has provision for
more partitions per device (although in my experience, with larger device
sizes we make larger partitions, not more partitions). MSDOS was limited
to 4 so-called "primary" partitions and one of these could be used as a
pointer to further "extended" partitions. It was a kludge, and GPT
eliminates this kludge.&lt;/p&gt;

&lt;p&gt;MSDOS also used a single byte to describe the contents of each partition.
This was troublesome as almost all of the 256 possibilities have been
used at various times (the linux fdisk utility contains a list). So
GPT extends that with UUID based partition types - an almost limitless
set.&lt;/p&gt;

&lt;p&gt;Linux supports GPT partition tables (also called disk labels). A tool
called 'gdisk' can create and edit them, and other partitioning tools
have varying levels of support.&lt;/p&gt;

&lt;p&gt;Grub 2 can boot disks partitioned with GPT. But there are some
interactions between Grub, GPT and RAID, which is the reason for
the existence of this article.&lt;/p&gt;

&lt;h2&gt;GPT, Grub2 and RAID considerations&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;GPT partitions can be made with 'gdisk'. Some of the tools are
still immature.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Grub2 can boot GPT partitioned disks, but it needs a so-called
"BIOS Boot Partition" of at least 32 Mbytes. That's where Grub2
stores some of its low level boot code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Grub2 cannot boot off a RAID partition which uses version
1.0, 1.1 or 1.2 metadata. The RAID must have been created using
version 0.90 metadata.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;4K sector disks&lt;/h2&gt;

&lt;p&gt;Storage manufacturers are now shipping 4K sector disks. Why 4K not
the previous standard of 512 bytes?  4K sectors are more efficient
for such large devices: the drive can pick up more data with each
read operation; the number of physical sectors on the device is
reduced by 8 times (which reduces the size of relocation tables,
for instance); 4K matches the page size used in the x86 architecture.
There are a lot of good reasons why.&lt;/p&gt;

&lt;p&gt;The first Western Digital 4K drives were released with a compatibility
mode enabled in which the drive simulates 512 byte sectors. This can
affect performance quite a lot. The installer should ensure that all
partitions are a multiple of 8 sectors in size. This affects GPT
partitioning as well as MSDOS. It's a bit easier to ensure this in GPT
because there's no geometry baggage, unlike MSDOS.&lt;/p&gt;
	</description>
</item>

<item>
	<title>LS-30 GSM interface</title>
	<link>http://www.nick-andrew.net/news/20100409-ls30-gsm.html</link>
	<pubDate>Fri, 09 Apr 2010 15:49:39 +1000</pubDate>
	<guid>LS-30 GSM interface 1270792179</guid>
	<description>
&lt;div class="newsheading"&gt;2010-04-09 - LS-30 GSM interface&lt;/div&gt;
&lt;div class="newsitem"&gt;

&lt;p&gt;
The LS-30 can notify an alert via its internal PSTN interface.
There is also an optional GSM interface (pictured), which takes a SIM
card and can be used instead of or in addition to the PSTN notification.
&lt;/p&gt;

&lt;img src="http://www.nick-andrew.net/LS30/gsm-interface.jpg" alt="LS-30 optional GSM interface" width="100%" /&gt;

&lt;p&gt;
Alerts are notified via SMS message at first, and this is followed by
a voice call. Five numbers can be configured for GSM. The SMS message
looks like this:
&lt;/p&gt;

&lt;pre&gt;
Burglar       01-03 19:19 2010/04/02
&lt;/pre&gt;

&lt;p&gt;
The "01-03" refers to the device which triggered.
&lt;/p&gt;

&lt;p&gt;
My monitoring software can detect a Burglary message and SMS me directly.
I get the impression that it takes a couple of minutes for the LS-30 to
get around to sending an SMS. It may be that the LS-30 takes time to
check the PSTN line for a dial tone. The LS-30 seems to try to alert
via PSTN first, and tries GSM second.
&lt;/p&gt;

&lt;p&gt;
My monitoring system sends an SMS of this form:
&lt;/p&gt;

&lt;pre&gt;
Burglary at Fri Apr 9 10:48:50 EST 2010 zone 500 group 00
&lt;/pre&gt;

&lt;p&gt;
The zone and group numbers would correspond (on a real burglary) to
the "01-03" shown above.
&lt;/p&gt;

&lt;/div&gt;
	</description>
</item>

<item>
	<title>Reverse-Engineering the LS30</title>
	<link>http://www.nick-andrew.net/news/20100404-ls30.html</link>
	<pubDate>Mon, 05 Apr 2010 11:08:33 +1000</pubDate>
	<guid>Reverse-Engineering the LS30 1270429713</guid>
	<description>
&lt;div class="newsheading"&gt;2010-04-04 - Reverse-Engineering the LS-30&lt;/div&gt;
&lt;div class="newsitem"&gt;

&lt;p&gt;
In February 2010, after long investigation, I purchased an
&lt;a href="http://www.securepro.com.au/index.php?fuseaction=product.search&amp;amp;range=LS-30"&gt;
LS-30 Alarm System&lt;/a&gt;
From
&lt;a href="http://www.securepro.com.au/"&gt;Securepro Security&lt;/a&gt;.
Having moved recently, I needed an alarm system.
I'd had many years experience with the
&lt;a href="http://www.boschsecurity.com.au/content/language1/downloads/Bosch__Sol_16plus__sales.pdf"&gt;Solution 16&lt;/a&gt; (PDF)
range of alarms,
originally designed and manufactured by
&lt;a href="http://web.archive.org/web/19980519193144/http://edm.com.au/"&gt;EDM&lt;/a&gt;
(a
&lt;a href="http://web.archive.org/web/20020225020338/http://www.zeta.org.au/index.html"&gt;Zeta Internet&lt;/a&gt;
customer) and
now owned by
&lt;a href="http://www.boschsecurity.com.au/"&gt;Bosch&lt;/a&gt;.
But I thought perhaps technology has improved
in the meantime, and I wanted something more powerful, configurable,
... more geeky. That's the LS-30.
&lt;/p&gt;

&lt;img src="http://www.nick-andrew.net/LS30/ls30-front.jpg" alt="View of LS-30 from the front" width="100%" /&gt;

&lt;p&gt;
The LS-30 is an alarm system designed for self-installation in a home
or business. It communicates wirelessly with its devices, which include:
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PIR (Passive Infra-Red) burglar sensors&lt;/li&gt;
&lt;li&gt;Remote control key fobs&lt;/li&gt;
&lt;li&gt;Solar powered outdoors siren&lt;/li&gt;
&lt;li&gt;Magnetic reed switch door sensors&lt;/li&gt;
&lt;li&gt;Smoke detectors&lt;/li&gt;
&lt;li&gt;And more.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
It is very configurable, and according to the vendor has "more features than
any other system available". Except perhaps for very expensive commercial
systems. What appealed to me though, was the ethernet interface - I can plug
it into my network and (hopefully) configure it remotely.
&lt;/p&gt;

&lt;p&gt;
I have begun to reverse-engineer the LS-30 communications protocol. Furthermore,
I have released my code under the GNU General Public License (Version 3) so
others in the community can benefit from this effort (and help me finish the
job). See the links in the left column to my GitHub project.
&lt;/p&gt;

&lt;/div&gt;
	</description>
</item>

<item>
	<title>dnscache fixed</title>
	<link>http://www.nick-andrew.net/news/20090613-dnscache-fixed.html</link>
	<pubDate>Sat, 13 Jun 2009 22:05:34 +1000</pubDate>
	<guid>dnscache fixed 1244894734</guid>
	<description>
&lt;div class="newsheading"&gt;2009-06-13 - dnscache fixed&lt;/div&gt;
&lt;div class="newsitem"&gt;

&lt;p&gt;
I was able to solve the problem with dnscache. Basically, before sending
each new request to a nameserver (for a particular query), dnscache would
close the socket used for the &lt;b&gt;last&lt;/b&gt; request. So any late response
would not reach dnscache.
&lt;/p&gt;

&lt;p&gt;
The code flow was roughly this:
&lt;/p&gt;

&lt;pre&gt;
+-&amp;gt;  close socket
|    open socket()
|    bind() local end of socket to random port
|    connect() socket to next destination
|    send() request packet
+-&amp;lt;  poll with timeout for a response
&lt;/pre&gt;

&lt;p&gt;
The fix turned out to be fairly simple. Open a socket before sending the
first request packet for a particular query, do not connect it to the
destination, and use sendto() to specify each destination instead of send().
So the fixed code flow now looks like this:
&lt;/p&gt;

&lt;pre&gt;
     open socket()
     bind() local end of socket to random port
+-&amp;gt;  sendto() request packet to next destination
|
+-&amp;lt;  poll with timeout for a response
     close() socket
&lt;/pre&gt;

&lt;p&gt;
The improvement on performance is extreme. I'm testing on a virtual machine
using the 'netem' module to artificially create network latency of 5000ms.
Before patching, dnscache took 310 seconds to lookup 'A www.telstra.net' -
much longer than I had calculated in the previous post, because in fact
dnscache had to send more requests than expected due to missing nameserver
glue, perhaps for the net domain.
&lt;b&gt;After&lt;/b&gt; patching, dnscache was able to resolve 'www.telstra.net' in only
16 seconds. It sends 6 queries then receives the response to the first, and
closes the socket so subsequent responses are ignored (they're not needed
anyway).
&lt;/p&gt;

&lt;p&gt;
You might think this patch is not necessary because 5000ms network latency
is an extreme test and most internet hosts will have much lower latency
(it's usually a leaf-node problem) but I experienced it on a modern HSDPA
network. Also I have seen saturated dialup and ISDN connections with
very high latencies (over 3000ms for ISDN). Also dnscache's timeouts start
at 1 second so performance will start to degrade as soon as average request
latency exceeds 1000ms. The more nameservers a domain has, the longer it
will take to lookup because dnscache sends a request to every nameserver
with a 1-second timeout before changing to 3 seconds (then 11, then 45).
&lt;/p&gt;

&lt;p&gt;
I've made the patch available on &lt;a href="http://github.com/"&gt;github.com&lt;/a&gt;
in a new repository I made called &lt;b&gt;djbdns&lt;/b&gt;. The url is:
&lt;/p&gt;

&lt;p&gt;
&lt;a href="http://github.com/nickandrew/djbdns/tree/high-latency-patch"&gt;
http://github.com/nickandrew/djbdns/tree/high-latency-patch&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
This repository also contains all public releases of djbdns to date:
version 1.01 through 1.05. DJB has put djbdns into the public domain
so it is OK for me to do this. There are also some patches written
by other people, linked from &lt;a href="http://tinydns.org/"&gt;tinydns.org&lt;/a&gt;.
Feel free to clone, fork and submit further patches to this djbdns
repository on github.
&lt;/p&gt;


&lt;/div&gt;
	</description>
</item>

<item>
	<title>dnscache fails spectacularly on high latency connections</title>
	<link>http://www.nick-andrew.net/news/20090608-dnscache-latency-failure.html</link>
	<pubDate>Mon, 08 Jun 2009 21:21:15 +1000</pubDate>
	<guid>dnscache fails spectacularly on high latency connections 1244460075</guid>
	<description>
&lt;div class="newsheading"&gt;2009-06-08 - dnscache fails spectacularly on high latency connections&lt;/div&gt;
&lt;div class="newsitem"&gt;

&lt;p&gt;
Like most people I use dnscache extensively for name resolution within my
network. All this worked fine until recently when my DSL link broke (with
the telephone line) and I had to use HSDPA for external connectivity.
&lt;/p&gt;

&lt;p&gt;
My HSDPA provider is supposed to provide a maximum speed of at least
1.8 Mbit/sec - of course this can be lower due to network congestion, poor
signal strength, low capacity network links and so on. I don't think I
have ever received the full 1800 kbit/sec from my provider, maybe nothing
over 300 kbit/sec in fact.
&lt;/p&gt;

&lt;p&gt;
Anyway this particular outage was particularly troublesome because I
was getting only 50 kbit/sec through HSDPA ... slower than a dialup modem.
It was slow in another respect too, the packet round-trip time was between
5 and 7 seconds. That's over 200 times more than a typical RTT on DSL of 25 ms.
&lt;/p&gt;

&lt;p&gt;
I don't know what caused the extremely high latency, but I do know what its
effect was. Dnscache failed almost completely. It would send out requests
to nameservers on the internet, and not receiving any response in a reasonable
time, would go on to try the next nameserver, and the next, and so on. The
responses came back at some later time ... after dnscache had given up on the
request (and dnscache would ignore the response). So the net effect was a
storm of DNS packets sent and received, as well as ICMP port-unreachable packets
when responses were received after dnscache had stopped listening.
&lt;/p&gt;

&lt;p&gt;
Now that the DSL is working I am testing dnscache (from djbdns 1.05)
to see the exact nature of this problem and if it can be fixed. I am
using Linux's Traffic Control subsystem (see
&lt;a href="http://lartc.org/"&gt;lartc.org&lt;/a&gt; for documentation) and
specifically the 'netem' queue discipline module to simulate various
amounts of latency to a virtual host.
&lt;/p&gt;

&lt;p&gt;
I setup the variable latency using this script:
&lt;/p&gt;

&lt;pre style="border-style:solid; background-color: #F0E0E0"&gt;
#!/bin/bash
#
#  Setup network delay for testing dnscache on high latency links
#  Outbound traffic on eth0 is delayed by several seconds if
#    - ip dst is 192.168.1.75

set -x

tc qdisc del dev eth0 root 2&amp;gt;/dev/null

# Setup root class and base rates
tc qdisc add dev eth0 root handle 1: htb default 99

tc class add dev eth0 parent 1: classid 1:1 htb rate 100mbit
# all traffic
tc class add dev eth0 parent 1:1 classid 1:10 htb rate 100mbit
# delayed traffic
tc class add dev eth0 parent 1:1 classid 1:11 htb rate 2mbit
# default
tc class add dev eth0 parent 1:1 classid 1:99 htb rate 3500kbit

tc qdisc add dev eth0 parent 1:10 handle 10: sfq
tc qdisc add dev eth0 parent 1:11 handle 11: netem delay 5000ms
tc qdisc add dev eth0 parent 1:99 handle 99: sfq

# Move selected traffic into 1:11
tc filter add dev eth0 parent 1: protocol ip prio 1 u32 match ip dst 192.168.1.75 flowid 1:11
&lt;/pre&gt;

&lt;p&gt;
This script is run on my gateway and it uses the HTB queue discipline
on device eth0 and some classes beneath that to filter outbound packets
on that interface.  Packets sent to 192.168.1.75 are delayed (by the
'netem' qdisc) by exactly 5000 msec, which is more than enough time to
give dnscache a headache.
&lt;/p&gt;

&lt;p&gt;
Next up I hacked dnscache to (a) run as an ordinary user, (b) listen on
port 5300, and (c) show
me what it is doing. Dnscache implements exponential timeouts on sent
requests for 1, 3, 11 and 45 seconds. I don't know why djb chose those
particular numbers. I started the server and sent a single request to
lookup an 'A' record for telstra.net:
&lt;/p&gt;

&lt;pre style="border-style:solid; background-color: #F0E0E0"&gt;
dig -p 5300 @127.0.0.1 A telstra.net +tries=1
&lt;/pre&gt;

&lt;p&gt;
This is what dnscache output at first:
&lt;/p&gt;

&lt;pre style="border-style:solid; background-color: #F0E0E0"&gt;
$ ./dnscache
starting
query 1 7f000001:e4d2:6114 1 telstra.net.
tx 0 1 telstra.net. . 803f0235 c03a801e c0249411 c6290004 c707532a 80080a5a c0702404 c0cbe60a ca0c1b21 c0e44fc9 c00505f1 c021040c c1000e81
dns_transmit to 128.63.2.53, timeout set to 1
dns_transmit to 192.58.128.30, timeout set to 1
dns_transmit to 192.36.148.17, timeout set to 1
dns_transmit to 198.41.0.4, timeout set to 1
dns_transmit to 199.7.83.42, timeout set to 1
dns_transmit to 128.8.10.90, timeout set to 1
dns_transmit to 192.112.36.4, timeout set to 1
dns_transmit to 192.203.230.10, timeout set to 1
dns_transmit to 202.12.27.33, timeout set to 1
dns_transmit to 192.228.79.201, timeout set to 1
dns_transmit to 192.5.5.241, timeout set to 1
dns_transmit to 192.33.4.12, timeout set to 1
dns_transmit to 193.0.14.129, timeout set to 1
&lt;/pre&gt;

&lt;p&gt;
What seems to be happening here is that dnscache is looking up the root
nameservers ('.') for 'telstra.net'. The hex numbers are the IPv4 addresses
of each root nameserver. Dnscache tries them in order (at least, in the
same order as they appear on the 'tx' line). There are 13 root nameservers
and these requests appear to be issued once per second - so this process
has taken 13 seconds so far. With a 5000 msec delay on the interface, 8
of those 13 requests have been replied-to, but dnscache apparently stops
listening for a response as soon as its timeout expires (1 second here)
and it sends the next request.
&lt;/p&gt;

&lt;p&gt;
Continuing on:
&lt;/p&gt;

&lt;pre style="border-style:solid; background-color: #F0E0E0"&gt;
dns_transmit to 128.63.2.53, timeout set to 3
dns_transmit to 192.58.128.30, timeout set to 3
dns_transmit to 192.36.148.17, timeout set to 3
dns_transmit to 198.41.0.4, timeout set to 3
dns_transmit to 199.7.83.42, timeout set to 3
dns_transmit to 128.8.10.90, timeout set to 3
dns_transmit to 192.112.36.4, timeout set to 3
dns_transmit to 192.203.230.10, timeout set to 3
dns_transmit to 202.12.27.33, timeout set to 3
dns_transmit to 192.228.79.201, timeout set to 3
dns_transmit to 192.5.5.241, timeout set to 3
dns_transmit to 192.33.4.12, timeout set to 3
dns_transmit to 193.0.14.129, timeout set to 3
&lt;/pre&gt;

&lt;p&gt;
Dnscache sends to the same set of 13 nameservers, but with a 3 second
timeout on each. That takes 39 seconds (for a total time spent so far
of 52 seconds, and we still don't know what are the nameservers for
telstra.net). Continuing:
&lt;/p&gt;

&lt;pre style="border-style:solid; background-color: #F0E0E0"&gt;
dns_transmit to 128.63.2.53, timeout set to 11
rr 803f0235 172800 1 a.gtld-servers.net. c005061e
rr 803f0235 172800 1 b.gtld-servers.net. c0210e1e
rr 803f0235 172800 1 c.gtld-servers.net. c01a5c1e
rr 803f0235 172800 1 d.gtld-servers.net. c01f501e
rr 803f0235 172800 1 e.gtld-servers.net. c00c5e1e
rr 803f0235 172800 1 f.gtld-servers.net. c023331e
rr 803f0235 172800 1 g.gtld-servers.net. c02a5d1e
rr 803f0235 172800 1 h.gtld-servers.net. c036701e
rr 803f0235 172800 1 i.gtld-servers.net. c02bac1e
rr 803f0235 172800 1 j.gtld-servers.net. c0304f1e
rr 803f0235 172800 1 k.gtld-servers.net. c034b21e
rr 803f0235 172800 1 l.gtld-servers.net. c029a21e
rr 803f0235 172800 1 m.gtld-servers.net. c037531e
rr 803f0235 172800 ns net. a.gtld-servers.net.
rr 803f0235 172800 ns net. b.gtld-servers.net.
rr 803f0235 172800 ns net. c.gtld-servers.net.
rr 803f0235 172800 ns net. d.gtld-servers.net.
rr 803f0235 172800 ns net. e.gtld-servers.net.
rr 803f0235 172800 ns net. f.gtld-servers.net.
rr 803f0235 172800 ns net. g.gtld-servers.net.
rr 803f0235 172800 ns net. h.gtld-servers.net.
rr 803f0235 172800 ns net. i.gtld-servers.net.
rr 803f0235 172800 ns net. j.gtld-servers.net.
rr 803f0235 172800 ns net. k.gtld-servers.net.
rr 803f0235 172800 ns net. l.gtld-servers.net.
rr 803f0235 172800 ns net. m.gtld-servers.net.
rr 803f0235 172800 28 a.gtld-servers.net. 20010503a83e00000000000000020030
stats 1 945 1 0
cached 1 a.gtld-servers.net.
cached 1 b.gtld-servers.net.
cached 1 c.gtld-servers.net.
cached 1 d.gtld-servers.net.
cached 1 e.gtld-servers.net.
cached 1 f.gtld-servers.net.
cached 1 g.gtld-servers.net.
cached 1 h.gtld-servers.net.
cached 1 i.gtld-servers.net.
cached 1 j.gtld-servers.net.
cached 1 k.gtld-servers.net.
cached 1 l.gtld-servers.net.
cached 1 m.gtld-servers.net.
&lt;/pre&gt;

&lt;p&gt;
Dnscache has finally increased its timeout to 11 and after another 5
seconds (total time elapsed now 57 seconds) it receives a response.
Now it knows the nameservers for the 'net' top-level domain. There
are 13 of them and so it's going to take another 57 seconds before
it learns the 4 nameservers for 'telstra.net', and then another 21
seconds to learn that there is actually no 'A' record for
'telstra.net'. That's 135 seconds total time. I don't know how long
clients typically wait for a response but it's a lot less than that.
&lt;/p&gt;

&lt;p&gt;
Clearly dnscache should implement two timeouts per request: one for
sending a second request (to another nameserver) for the same
information, and one to give up waiting for a response from the
first request. The 2nd timeout should be much longer than the first.
&lt;/p&gt;

&lt;p&gt;
If dnscache was modified to wait up to 10 seconds for a response but
try each successive nameserver after 1 second, then it should be
possible for dnscache to answer the query within 15 seconds, which is
reasonable in this context. In these calculations I'm assuming that
dnscache has no existing cache (other than the list of root nameservers)
because that makes dnscache's behaviour predictable, and it shows us
the worst case performance.
&lt;/p&gt;

&lt;p&gt;
The next step for me is to work out if dnscache can have multiple
outstanding requests to nameservers for the same client request. Obviously
dnscache can handle multiple concurrent client requests and must query
many different nameservers concurrently, but the question is whether it
can query multiple nameservers for the same information, at more or less
the same time, and use the first response that is received.
&lt;/p&gt;


&lt;/div&gt;
	</description>
</item>

<item>
	<title>Configuring IPv6 using AARNet's free broker</title>
	<link>http://www.nick-andrew.net/news/20080825-ipv6-over-aarnet.html</link>
	<pubDate>Mon, 05 Apr 2010 11:08:33 +1000</pubDate>
	<guid>Configuring IPv6 using AARNet's free broker 1270429713</guid>
	<description>
&lt;div class="newsheading"&gt;2008-08-25 - Configuring IPv6 using AARNet's free broker&lt;/div&gt;
&lt;div class="newsitem"&gt;

&lt;p&gt;
You can obtain IPv6 connectivity in Australia using the
&lt;a href="http://broker.aarnet.net.au/"&gt;AARNet IPv6 Migration Broker&lt;/a&gt;
if your ISP does not already provide IPv6. As at August 2008, only
&lt;a href="http://www.internode.on.net/"&gt;Internode&lt;/a&gt; is known to
provide
&lt;a href="http://ipv6.internode.on.net/"&gt;consumer level IPv6 access&lt;/a&gt;.
&lt;/p&gt;

&lt;p&gt;
For Australian users who cannot obtain IPv6 through your ISP, the AARNet
IPv6 tunnel is probably the next lowest latency choice. These instructions
describe setting up IPv6 with linux over a consumer DSL connection with
a dynamic IPv4 address (i.e. every time you connect you get a different
IP address) and NAT (Network Address Translation) on the DSL modem.
&lt;/p&gt;

&lt;p&gt;
With IPv6 you can get a static address (well, 2^64 or more static
addresses) and it's quite useful if you run a home network and want to
provide access to devices within the network, from outside. That is,
so long as the outside client has IPv6 (the chicken-and-egg problem).
&lt;/p&gt;

&lt;p&gt;
Certain assumptions are made in this document - like installed software
or an IPv6 enabled kernel. If these instructions don't work for you,
drop me an email at &lt;b&gt;nick&lt;/b&gt; at &lt;b&gt;nick-andrew.net&lt;/b&gt;.
&lt;/p&gt;


&lt;h2&gt;Preparation - Kernel and Software&lt;/h2&gt;

&lt;p&gt;
Make sure your kernel has IPv6 support. Do "ifconfig eth0" and check
for a line like this in the output:
&lt;/p&gt;

&lt;pre&gt;
          inet6 addr: fe80::212:34ff:fe56:789a/64 Scope:Link
&lt;/pre&gt;

&lt;p&gt;
You may need to load the "ipv6" module.
&lt;/p&gt;

&lt;p&gt;
Check that you have the commands "ip6tables" and "ip".
&lt;/p&gt;


&lt;h2&gt;Preparation - Firewall&lt;/h2&gt;

It's good for security to setup the IPv6 firewall before you even
start configuring it. Although you may have an IPv4 firewall already
in place, that won't stop any IPv6 packets. I'll assume you want to
make connections out, but block all connections in, which is the
standard functionality you get with NAT, and useful for a client.
For a server you will need to allow connections in for the server
ports.

&lt;h3&gt;ip6tables setup&lt;/h3&gt;

I use a shell script with a function alias, to set the firewall.

&lt;pre style="border-style:solid; background-color: #F0E0E0"&gt;
#!/bin/bash
#    Simple IPv6 firewall rules

doCmd6() {
        /sbin/ip6tables $*
        rc=$?
        if [ $rc != 0 ] ; then
                echo Error $rc doing ip6tables $*
        fi
}

doCmd6 -P INPUT DROP
doCmd6 -P FORWARD DROP

doCmd6 -F
doCmd6 -X

doCmd6 -N 6_log_drop
doCmd6 -N 6_icmp
doCmd6 -N 6_tcp

doCmd6 -A 6_log_drop -j LOG --log-prefix "ipv6:"
doCmd6 -A 6_log_drop -j DROP

#enable ssh in   doCmd6 -A 6_tcp -p tcp -d ::/0 --dport 22 -j ACCEPT
doCmd6 -A 6_tcp -j 6_log_drop

doCmd6 -F 6_icmp
doCmd6 -A 6_icmp -j ACCEPT


doCmd6 -A INPUT -i lo -j ACCEPT
doCmd6 -A INPUT -p ALL -m state --state ESTABLISHED,RELATED -j ACCEPT
doCmd6 -A INPUT -p icmpv6 -j 6_icmp
doCmd6 -A INPUT -p tcp -j 6_tcp
doCmd6 -A INPUT -j 6_log_drop
&lt;/pre&gt;

&lt;p&gt;
This set of rules will allow you to make outbound IPv6 connections and
will block inbound except for ICMP (your address can be pinged) and
you can uncomment a line to enable ssh connections in.
&lt;/p&gt;


&lt;h2&gt;Preparation - DSL modem&lt;/h2&gt;

&lt;p&gt;
Assuming your DSL modem has a firewall, you will need to enable two
things:
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Outbound UDP connections to port 3653&lt;/li&gt;
&lt;li&gt;Protocol 41 inbound/outbound&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;UDP port 3653 is used by the AARNet tunnel broker. Protocol 41 is
used by 6to4 tunneling, which I will describe now.
&lt;/p&gt;


&lt;h2&gt;Alternate access - 6to4 tunnel&lt;/h2&gt;

&lt;p&gt;
Although this document is about obtaining IPv6 through AARNet's
migration broker, there's a quicker way to get started on IPv6
using your dynamic IPv4 address. You will need the "curl" command
installed. Run this script:
&lt;/p&gt;

&lt;pre style="border-style:solid; background-color: #F0E0E0"&gt;
#!/bin/bash
#  Sets up an ipv6 tunnel through the nearest public gateway.
#  Automatically learns current ipv4 address.

ipv4=$(curl -s http://www.whatismyip.com/automation/n09230945.asp)
ipv6=$(printf "2002:%02x%02x:%02x%02x::1" $(echo $ipv4 | tr "." " " ) )

echo ipv4 is $ipv4 and ipv6 is $ipv6

ifconfig sit0 up
ifconfig sit0 add $ipv6/16
route -A inet6 add 2000::/3 gw ::192.88.99.1 dev sit0
&lt;/pre&gt;

&lt;p&gt;
192.88.99.1 is an address which routes to the nearest public
IPv6 gateway. Unfortunately for us Australians, that's probably
in the USA. But it's easy to setup, as you can see.
&lt;/p&gt;

&lt;p&gt;
This technique has some advantages and disadvantages. On the positive
side, you have 2^80 addresses to use. That should be enough for anyone.
On the negative side, these addresses are as dynamic as your IPv4
address because they are derived from it. Also, you may be able to
make outbound connections but not accept inbound connections, depending
on what functionality your DSL modem provides. My DSL modem allows me
to open up protocol 41 traffic, but it doesn't provide a configuration
option to forward all incoming protocol 41 connections to my linux box.
So my box can only accept inbound connections while there's a working
outbound connection (this is standard NAT functionality).
&lt;/p&gt;

&lt;p&gt;
So 6to4 is a good technique to get started with IPv6 if you want to,
say, browse ipv6 websites. But it's not so useful for servers.
&lt;/p&gt;

&lt;h2&gt;Testing - IPv6 using commands&lt;/h2&gt;

&lt;p&gt;"ping6" and "telnet" are your friends.
&lt;/p&gt;

&lt;pre&gt;
$ ping6 ipv6.l.google.com
PING ipv6.l.google.com(2001:4860:0:2001::68) 56 data bytes
64 bytes from 2001:4860:0:2001::68: icmp_seq=1 ttl=52 time=308 ms
64 bytes from 2001:4860:0:2001::68: icmp_seq=2 ttl=52 time=335 ms
64 bytes from 2001:4860:0:2001::68: icmp_seq=3 ttl=52 time=321 ms
&lt;/pre&gt;

&lt;pre&gt;
$ telnet luyer.net 80
Trying 2001:470:1f05:14d::1...
Connected to luyer.net.
Escape character is '^]'.
GET / HTTP/1.0

HTTP/1.1 200 OK
Date: Mon, 25 Aug 2008 00:38:50 GMT
Server: Apache/2.2.3 (Debian) PHP/4.4.4-8+etch6 mod_ssl/2.2.3
OpenSSL/0.9.8c
[ ... etc ... ]
&lt;/pre&gt;

&lt;p&gt;
You can also install the netcat6 package (the command is "nc6")
to connect out or listen for incoming connections.
To test if your web browser is using IPv6 correctly, try these
sites:
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://www.kame.net/"&gt;www.kame.net&lt;/a&gt;
- on IPv6 you will see a swimming turtle, on IPv4 the turtle will
not move
&lt;/li&gt;

&lt;li&gt;
&lt;a href="http://luyer.net/"&gt;luyer.net&lt;/a&gt; and it will tell you
if you connected through IPv4 or IPv6
&lt;/li&gt;

&lt;li&gt;
&lt;a href="http://www.sixxs.net/main/"&gt;www.sixxs.net&lt;/a&gt;
will show your originating address and protocol at the bottom of
the page.
&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;Registering with AARNet&lt;/h2&gt;

&lt;p&gt;
You'll need to create a username on the
&lt;a href="http://broker.aarnet.net.au/"&gt;AARNet IPv6 Migration Broker&lt;/a&gt;
and then associate that username with a tunnel.
&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="http://broker.aarnet.net.au/usercreate.html"&gt;Create User Account&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://broker.aarnet.net.au/tunnelreq.html"&gt;Request Tunnel&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;
The "Request Tunnel" CGI hangs for me, I don't know why. I assume it
created a tunnel correctly because I'm getting one.
&lt;/p&gt;

&lt;h2&gt;Installation of TSPC&lt;/h2&gt;

&lt;p&gt;
Install the "tspc" package. I'm using Debian, so it's just
"apt-get install tspc".
&lt;/p&gt;

&lt;p&gt;
When Debian installs tspc, it automatically configures it to obtain
an anonymous IPv6 tunnel from freenet6.net. Although that's great and
easy, it's not what we need in Australia. So after installation, stop
the daemon with "/etc/init.d/tspc stop".
&lt;/p&gt;

&lt;h2&gt;Configuring the AARNet tunnel broker&lt;/h2&gt;

&lt;p&gt;
To be continued ... no time to write the rest of the document today.
&lt;/p&gt;

&lt;p&gt;
In brief, you need to use the v6udpv4 method and all traffic will
be tunneled through a UDP connection. 30 second keepalive messages
(I believe it's an ipv6 ping?) will keep NAT working. Your config
file should look like this:
&lt;/p&gt;

&lt;pre style="border-style:solid; background-color: #F0E0E0"&gt;
auth_method=any
userid=YOURUSERID
passwd=YOURPASSWORD

server=broker.aarnet.net.au
tunnel_mode=v6udpv4
host_type=router
prefixlen=64

client_v4=auto
if_prefix=eth0
if_tunnel_v6udpv4=tun
if_tunnel_v6v4=sit1

keepalive_interval=30
keepalive=yes

proxy_client=no
retry_delay=30
template=setup
&lt;/pre&gt;

&lt;p&gt;
Note that AARNet assigns a /56 even though this config asks for a /64.
&lt;/p&gt;

&lt;h2&gt;Monitoring the IPv6 tunnel&lt;/h2&gt;

&lt;p&gt;
AARNet's broker seems a bit flaky. It sometimes ignores the UDP packets
so you may need to start the daemon a few times before it connects
properly. As I mentioned, the CGI to request a tunnel hangs for me.
If it doesn't hang, it may return a shell script, which you can ignore.
&lt;/p&gt;

&lt;p&gt;
It's possible you don't even need to use the "Request Tunnel" CGI,
maybe it will assign a permanent tunnel when tspc connects for the
first time.
&lt;/p&gt;

&lt;p&gt;
Also AARNet reboot the server at 03:00 every morning.
The tspc daemon will try to reconnect if the tunnel fails, but
perhaps not forever.
&lt;/p&gt;

&lt;p&gt;
In any case, you want IPv6 to be always available, which means
monitoring it. If the tspc daemon stops, you will need to restart
it manually. I wrote this simple perl script which just logs
whenever IPv6 stops working. It doesn't monitor the process or
interface at all (you'd want to monitor the process itself if
you change the script to restart a failed process).
&lt;/p&gt;

&lt;pre style="border-style:solid; background-color: #F0E0E0"&gt;
#!/usr/bin/perl -w
#       @(#) $Id$
#       vim:sw=4:ts=4:

use Date::Format qw(time2str);
use Getopt::Std qw(getopts);

use vars qw($opt_h);

$| = 1;
getopts('h:');

$opt_h || die "Need option -h hostname";

# Initial and current state
my $state = 'down';

while (1) {
        my $now = time();
        my $newstate = getPingState($opt_h);

        if ($newstate ne $state) {
                open(OF, "&gt;&gt;ipv6-state.log");
                my $ts = time2str('%Y-%m-%d %T', $now);
                print OF "$ts $opt_h $newstate\n";
                close(OF);

                $state = $newstate;
        }

        my $to_wait = 60 - ($now % 60);
        print '.';
        sleep($to_wait);
}

# NOTREACHED
exit(0);

# ------------------------------------------------------------------------
# ping6 a host, and figure out if it is up
# ------------------------------------------------------------------------

sub getPingState {
        my $host = shift;

        my $rc = system("ping6 -c 2 -q -W 8 $host &gt;/dev/null");
        if ($rc == 0) {
                return 'up';
        }

        return 'down';
}
&lt;/pre&gt;

&lt;p&gt;
I just run it like this: "check-ipv6.pl ipv6.l.google.com" and it pings
once a minute (on the minute) and logs whenever the calculated state
of the IPv6 connectivity changes.
&lt;/p&gt;

&lt;p&gt;
For production use you'd want to change the 'sleep' to sleep(60) since
it's not friendly to google for many sites to ping in synchronisation
(i.e. always at :00). Of course you could always ping6 to
broker.aarnet.net.au instead ...
&lt;/p&gt;

&lt;pre&gt;
64 bytes from 2001:388:1:5001:2a0:a5ff:fe4b:ae3: icmp_seq=1 ttl=64 time=52.8 ms
64 bytes from 2001:388:1:5001:2a0:a5ff:fe4b:ae3: icmp_seq=2 ttl=64 time=51.6 ms
64 bytes from 2001:388:1:5001:2a0:a5ff:fe4b:ae3: icmp_seq=3 ttl=64 time=51.1 ms
&lt;/pre&gt;

&lt;/div&gt;
	</description>
</item>

<item>
	<title>Forcing NFS to use consistent port numbers</title>
	<link>http://www.nick-andrew.net/news/20080824-nfs-iptables.html</link>
	<pubDate>Mon, 05 Apr 2010 11:08:33 +1000</pubDate>
	<guid>Forcing NFS to use consistent port numbers 1270429713</guid>
	<description>
&lt;div class="newsheading"&gt;2008-08-24 - Forcing NFS to use consistent port numbers&lt;/div&gt;
&lt;div class="newsitem"&gt;

&lt;p&gt;
NFS servers don't play nice with iptables when the daemons use random
port numbers (which is the default in debian).
&lt;/p&gt;

&lt;p&gt;
To force consistent port numbers upon NFS (when using nfs-kernel-server),
set the following in /etc/default/nfs-kernel-server.
This will force mountd to use port 4002 for both TCP and UDP.
&lt;/p&gt;

&lt;pre&gt;
RPCMOUNTDOPTS="--port 4002"
&lt;/pre&gt;

&lt;p&gt;
For lockd,
add the following into /etc/modules (you need to build lockd as a module
for this) ...
&lt;/p&gt;

&lt;pre&gt;
lockd    nlm_udpport=33000 nlm_tcpport=42049
&lt;/pre&gt;

&lt;p&gt;
Next, you can force statd to use port 4000 and port 4001 by
setting this in /etc/default/nfs-common:
&lt;/p&gt;

&lt;pre&gt;
STATDOPTS="--port 4000 --outgoing-port 4001"
&lt;/pre&gt;

&lt;p&gt;
Finally, add iptables rules:
&lt;/p&gt;

&lt;pre&gt;
iptables -F nfs_server
iptables -A nfs_server -p TCP --dport 2049 -j ACCEPT # nfs
iptables -A nfs_server -p TCP --dport 4000:4001 -j ACCEPT # statd
iptables -A nfs_server -p TCP --dport 4002 -j ACCEPT # mountd
iptables -A nfs_server -p UDP --destination-port 4002 -j ACCEPT # mountd
iptables -A nfs_server -p UDP --destination-port 33000 -j ACCEPT # lockd
iptables -A nfs_server -p TCP --dport 42049 -j ACCEPT # lockd
&lt;/pre&gt;

&lt;p&gt;
Be sure that only packets from client IP addresses are directed through
the nfs_server table.
&lt;/p&gt;

&lt;/div&gt;
	</description>
</item>

<item>
	<title>NameVirtualHost *:80 has no VirtualHosts</title>
	<link>http://www.nick-andrew.net/news/20080716-namevirtualhost.html</link>
	<pubDate>Mon, 05 Apr 2010 11:08:33 +1000</pubDate>
	<guid>NameVirtualHost *:80 has no VirtualHosts 1270429713</guid>
	<description>
&lt;div class="newsheading"&gt;2008-07-16 - NameVirtualHost *:80 has no VirtualHosts&lt;/div&gt;
&lt;div class="newsitem"&gt;

&lt;p&gt;
Have you seen this error?
&lt;/p&gt;

&lt;pre style="background-color: #FF8080"&gt;
[Wed Jul 16 10:18:17 2008] [warn] NameVirtualHost *:80 has no VirtualHosts
&lt;/pre&gt;

&lt;p&gt;
This is a particularly annoying message because there are many questions
about it on many forums and no definitive answers.
&lt;/p&gt;

&lt;p&gt;
Quoting from
&lt;a href="http://lists.debian.org/debian-user/2004/04/msg00856.html"&gt;
apache2 &amp;lt;perl&amp;gt; sections: "*:80 has no VirtualHosts" error
&lt;/a&gt; ...
&lt;/p&gt;

&lt;blockquote&gt;
&lt;pre&gt;
In short, the following is an example that will produce the error
message quoted above :
    NameVirtualHosts    *:80
    &amp;lt;VirtualHost foo:80&amp;gt;
    &amp;lt;/VirtualHost&amp;gt;

In other words, if you have 'NameVirtualHosts BLAH' and you do not
have a '&amp;lt;VirtualHost BLAH&amp;gt;' directive, you get that error.
&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;
But that's not the end of the story. The following configuration also
causes that error message (on "apache2 -f test.conf -S") ...
&lt;/p&gt;

&lt;pre style="border-style:solid; background-color: #F0E0E0"&gt;
Listen 80
NameVirtualHost *:80


&amp;lt;VirtualHost *:80&amp;gt;
        ServerName      name1.tull.net
        DocumentRoot    /var/www/
&amp;lt;/VirtualHost&amp;gt;


&amp;lt;VirtualHost *:80&amp;gt;
        ServerName      name2.tull.net
        DocumentRoot    /var/www/
&amp;lt;/VirtualHost&amp;gt;


&amp;lt;VirtualHost *:80&amp;gt;
        ServerName      name4.tull.net
        DocumentRoot    /var/www/
&amp;lt;/VirtualHost&amp;gt;


&amp;lt;VirtualHost *&amp;gt;
        ServerName      name4.tull.net
        DocumentRoot    var/www/
&amp;lt;/VirtualHost&amp;gt;
&lt;/pre&gt;

&lt;p&gt;
The errors are:
&lt;/p&gt;

&lt;pre style="border-style:solid; background-color: #F0E0E0"&gt;
[Wed Jul 16 10:24:47 2008] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Wed Jul 16 10:24:47 2008] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Wed Jul 16 10:24:47 2008] [warn] NameVirtualHost *:80 has no VirtualHosts
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80                   name1.tull.net (/etc/apache2/strip.conf:4)
*:80                   name2.tull.net (/etc/apache2/strip.conf:10)
*:80                   name4.tull.net (/etc/apache2/strip.conf:16)
*:*                    name4.tull.net (/etc/apache2/strip.conf:21)
&lt;/pre&gt;

&lt;p&gt;
In this configuration there &lt;b&gt;are&lt;/b&gt; corresponding "VirtualHost *:80"
definitions. What's confusing apache2 is the last definition which is
"VirtualHost *", and it's reporting a warning with the wrong directive
(NameVirtualHost).
&lt;/p&gt;

&lt;p&gt;
Furthermore, the "VirtualHost overlap on port 80" warnings are being
generated for &lt;b&gt;correct&lt;/b&gt; directives, and no warning about the
incorrect directive.
&lt;/p&gt;

&lt;p&gt;
So the fix, at least for this scenario, is to ensure that all "VirtualHost"
directives use the same value as specified in "NameVirtualHost".
&lt;/p&gt;

&lt;p&gt;
&lt;b&gt;Update 2008-07-18 ...&lt;/b&gt; also you don't want to have two
"NameVirtualHost *:80" directives in the configuration. Multiple
directives with the same arguments are not treated as one!
&lt;/p&gt;

&lt;/div&gt;
	</description>
</item>

<item>
	<title>Scan and update ssh keys</title>
	<link>http://www.nick-andrew.net/news/20080519-scan-ssh.html</link>
	<pubDate>Mon, 05 Apr 2010 11:08:33 +1000</pubDate>
	<guid>Scan and update ssh keys 1270429713</guid>
	<description>
&lt;div class="newsheading"&gt;2008-05-19 - Scan and update ssh keys&lt;/div&gt;
&lt;div class="newsitem"&gt;

&lt;p&gt;
Due to the recently exposed ssh key generation vulnerability, many
ssh keys may need to be deleted and recreated. This tool may help with that.
&lt;/p&gt;

&lt;p&gt;
What it does is find all the ssh keys existing on several hosts and
where those keys appear in .ssh/authorized_keys files. It collates
the results from all hosts and writes a directed graph for the 'graphviz'
tool, which helps to visualise which keys are providing access to which
users.
&lt;/p&gt;

&lt;p&gt;
The scan tool works by connecting to each specified host using ssh and
executing a host script. The host script examines the user's
.ssh directory and sends a report to STDOUT, which is received by
the scan tool. The host script can also iterate through /etc/passwd
and examine every user's .ssh directory.
&lt;/p&gt;

&lt;p&gt;
Use graphviz to visualise the graph. How to use: firstly make a
file 'host-list' of all hosts you have access to, one line per
hostname. Include any hosts you have root access to just as the
hostname, and if you have only user access, use "user@hostname".
You need to run the scan tool from a place which can ssh to
all these hosts -- as root for all hostnames listed in your
'host-list' file which are not qualified with a username.
&lt;/p&gt;

&lt;pre&gt;
scan-ssh-keys.pl $(cat host-list) &gt; output.dot
dot -Txlib output.dot
&lt;/pre&gt;

&lt;p&gt;
Use the mouse wheel to zoom in/out of the graph image. Use the mouse
middle button to pan the image. You can also use 'dot' to write various
output files such as JPEG or SVG.
&lt;/p&gt;

&lt;p&gt;
Here is a sample graph produced by the scan tool. The graph resolution
is deliberately reduced (to make the node labels unreadable) for security
reasons. Also my full ssh key graph is somewhat larger than this :-)
&lt;/p&gt;

&lt;img src="http://www.nick-andrew.net/Misc/Pics/sample-ssh-scan.jpg" alt="Sample output from ssh key scan tool" width="100%" /&gt;

&lt;p&gt;
Later on I expect to enhance the scan tool to assist with adding and
deleting ssh keys.
&lt;/p&gt;

&lt;p&gt;
To download from my Mercurial repository, see:
&lt;a href="http://www.nick-andrew.net/hg/nick-src-regen-ssh-keys"&gt;nick-src-regen-ssh-keys&lt;/a&gt;.
&lt;/p&gt;

&lt;/div&gt;
	</description>
</item>

<item>
	<title>Distributed SCM</title>
	<link>http://www.nick-andrew.net/news/20080425-mercurial.html</link>
	<pubDate>Mon, 05 Apr 2010 11:08:33 +1000</pubDate>
	<guid>Distributed SCM 1270429713</guid>
	<description>
&lt;div class="newsheading"&gt;2008-04-25 - Distributed SCM&lt;/div&gt;
&lt;div class="newsitem"&gt;

&lt;p&gt;
I've become a recent convert to distributed SCM systems, particularly
&lt;a href="http://www.selenic.com/mercurial/"&gt;Mercurial&lt;/a&gt;
and
&lt;a href="http://git.or.cz/"&gt;Git&lt;/a&gt;.
&lt;/p&gt;

&lt;p&gt;
Use of a distributed SCM is a much more sensible way to release open
source software than the traditional tarfile, or even having a
public CVS or SVN repository. In particular:
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It makes it easy for users of the software to feed back their local
changes, which encourages more participation and development of the
code
&lt;/li&gt;
&lt;li&gt;It helps users maintain their own local changes in an SCM
&lt;/li&gt;
&lt;li&gt;It helps users upgrade to newer releases (without wiping out their
local changes, for instance).
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
Having a public CVS or SVN repository solves only the problem of
giving users quick access to the latest version of the software.
CVS and SVN don't help with feedback or maintenance of local changes.
They can help with upgrades - but it's of little practical benefit
when local changes can't be committed into the repository.
&lt;/p&gt;

&lt;p&gt;
I was in the process of converting my CVS repositories to SVN (it
takes a long time) when I discovered the virtues of Distributed
SCMs. I'm using both Git and Mercurial. Git is perhaps more
powerful but Mercurial is more user-friendly. So I have halted
all conversion to SVN and I'll be converting remaining repositories
to Mercurial. I'll be converting most of my SVN repositories over
to Mercurial too. Ultimately the only code/data remaining in SVN
will be that which I particularly need to be centralised (it might
end up being none at all).
&lt;/p&gt;

&lt;p&gt;
I have started to put some repositories of my public source
code online already. The full list is available at:
&lt;a href="http://www.nick-andrew.net/hg"&gt;http://www.nick-andrew.net/hg&lt;/a&gt;
and individual repositories which are currently online are:
&lt;/p&gt;

&lt;table border="1" cellpadding="2" cellspacing="0" style="background-color: #c0f8f8"&gt;

&lt;tr&gt;
&lt;td&gt;&lt;a href="/hg/develooper.com-src-qpsmtpd"&gt;develooper.com-src-qpsmtpd&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;
I use qpsmtpd on the mail servers here primarily for spam entrapment;
for example to refuse emails addressed to nonexistent users at my domains.
I get quite a lot of spam due to my long history with USENET.
This repository contains the qpsmptd 0.26, 0.32 and 0.40 releases
as downloaded from tarballs plus my local changes (mostly against 0.26
so far).
&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;&lt;a href="/hg/nick-pub-src-minix-ar"&gt;nick-pub-src-minix-ar&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;
To extract my old stuff (circa 1990) successfully, I need a V7-compatible
'ar' program. This is the original 'ar' program from Minix 1.x, modified
to work on a modern machine (32-bit, with prototypes, etc).
&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;&lt;a href="/hg/nick-src-apt-cacher"&gt;nick-src-apt-cacher&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;
This is the original apt-cacher program (versions 0.1 through 0.4)
before being picked up by Jon Oxer and packaged into Debian. Don't
use this code; the repository is here merely for historical
purposes.
&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;&lt;a href="/hg/nick-src-backup-cdr"&gt;nick-src-backup-cdr&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;
I wrote this system to do encrypted incremental backups of modified
files - first to CDR, then to DVD. I need something to do size
limited incremental backups since the total amount of backup is
many times the capacity of a DVD. This system regulates the quantity
of backup per day.
&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;&lt;a href="/hg/nick-src-direct"&gt;nick-src-direct&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;
This is a perl implementation of the 'direct' program I used in the
TRS-80 days, to pack several files together into 2 (!) structured
files, a 'DIR' and a 'DAT' file. Think of it as like a zipfile
without any compression. Anyway when I restored my old TRS-80 software
I needed to extract data from some of these structured file pairs
so I wrote it in perl - a language which was not available back in
the mid-1980s. It was trivial to do in perl, heh.
&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;&lt;a href="/hg/nick-src-distributed-filesystem"&gt;nick-src-distributed-filesystem&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;
This repository contains my 2003 ruminations on distributed filesystems.
Useful if nothing else for the pointers to various designs people
may have implemented.
&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;&lt;a href="/hg/nick-src-incremental-tar"&gt;nick-src-incremental-tar&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;
This C program replicates the function of Gnu TAR and optionally compresses
its output on the fly. The point is that you can feed it with a (possibly
infinite) list of files to be archived, and an output size limit, and
it will ensure that its output size does not exceed the limit. It is
useful for incremental backup - you give it a list of all your modified
files, and a size (say 699 MBytes) and it will cram as many of those
files in compressed form as can fit in 699 megs.
&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;&lt;a href="/hg/nick-src-misc-https-proxy"&gt;nick-src-misc-https-proxy&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;
This perl program listens on localhost port 80 and when it receives
a connection, makes an SSL connection to a specified server on
port 443 and forwards the data in both directions. This allows
logging or debugging of an HTTPS data stream by using HTTP at
the browser end.
&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;&lt;a href="/hg/nick-src-misc-logrun"&gt;nick-src-misc-logrun&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;
This cute little program reopens STDOUT and STDERR to files in a
logging directory and runs the program. If the program exits with
a non-zero code, the log files are moved to a 'bad' directory,
otherwise they are moved to an 'ok' directory.
&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;&lt;a href="/hg/nick-src-misc-showdns"&gt;nick-src-misc-showdns&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;
This program does several DNS lookups on a specified domain name,
and possibly filters the output. The aim is to quickly find the
nameservers, web servers etc for a domain name and particularly
to find those which are _not_ served by a specified nameserver.
&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;&lt;a href="/hg/nick-src-trs80"&gt;nick-src-trs80&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;
This is all my old TRS-80 source code in a single repository,
rather than having to download many tarfiles. Again, it's for
historical purposes. Unless you like Z80 assembler a lot.
&lt;/td&gt;
&lt;/tr&gt;

&lt;/table&gt;
&lt;br /&gt;


&lt;/div&gt;
	</description>
</item>

<item>
	<title>Linux vsplice export fix for OpenVZ</title>
	<link>http://www.nick-andrew.net/news/20080216-linux-vsplice-exploit-fix.html</link>
	<pubDate>Thu, 18 Sep 2008 12:16:46 +1000</pubDate>
	<guid>Linux vsplice export fix for OpenVZ 1221704206</guid>
	<description>
&lt;div class="newsheading"&gt;2008-02-16 - Linux vsplice export fix for OpenVZ&lt;/div&gt;
&lt;div class="newsitem"&gt;

&lt;p&gt;
Here's a patch which I believe solves the recent linux local root
problems, for the latest stable OpenVZ kernel (2.6.18-028stab053).
&lt;/p&gt;

&lt;div style="text-align: center; margin-bottom: 1em"&gt;
&lt;a href="/Patches/20080213-openvz-2.6.18-stab053-security.patch"&gt;
20080213-openvz-2.6.18-stab053-security.patch
&lt;/a&gt;
&lt;/div&gt;

&lt;/div&gt;
	</description>
</item>

<item>
	<title>OpenVZ virtualisation</title>
	<link>http://www.nick-andrew.net/news/20080214-openvz.html</link>
	<pubDate>Mon, 05 Apr 2010 11:08:33 +1000</pubDate>
	<guid>OpenVZ virtualisation 1270429713</guid>
	<description>
&lt;div class="newsheading"&gt;2008-02-14 - OpenVZ virtualisation&lt;/div&gt;
&lt;div class="newsitem"&gt;

&lt;p&gt;
To run linux guests I can highly recommend OpenVZ. It's a 
container system - you run only the host kernel which is 
modified to implement isolation between containers and 
each other, and the host. Processes in the containers run 
as processes on the host, with a container-specific root 
directory.
&lt;/p&gt;

&lt;p&gt;
The upshot of all this is that overhead is almost zero; 
each guest runs at almost native speed. There are various 
other benefits too, such as:
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The guest root filesystem is a directory on the host, 
so the host has full visibility to the guest files. It 
isn't necessary to preallocate space to each guest, so 
there's no wasted space and each guest can grow 
dynamically.&lt;/li&gt;
&lt;li&gt;Resource utilisation limits are enforced and can be 
modified on the fly.&lt;/li&gt;
&lt;li&gt;Guests can be minimal because they don't have to 
support hardware. A typical guest, before installing 
additional software, may be running only these processes: 
init, syslogd, sshd and cron. 4 processes - and you don't 
even need cron.&lt;/li&gt;
&lt;li&gt;Networking is very easy to get going (unlike 
user-mode-linux).&lt;/li&gt;
&lt;li&gt;Using templates, you can have a new guest installed 
and running in under 2 minutes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
There are some caveats though:
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The host kernel is modified in many places. The latest 
stable patch is over 4M.&lt;/li&gt;
&lt;li&gt;Not every linux kernel version is supported. The 
latest stable, supported patch is against 2.6.18 or you 
can use a development level patch against 2.6.22&lt;/li&gt;
&lt;li&gt;You can see all the guest processes on the host; it 
can be tricky to know which guest a given process is 
running on.&lt;/li&gt;
&lt;li&gt;Some kernel functions are restricted, such as 
kernel-space NFS server (use the userspace one 
instead).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
Overall OpenVZ is very stable and functional. I haven't 
had any kernel crashes related to OpenVZ. I would like 
them to support newer kernels - specifically 2.6.23 and 
above, since there are features in 2.6.23 that I want to 
use. But the patch is quite extensive and so I can't 
really blame them for picking a version and sticking with 
it for a long time. OpenVZ patch developers have 
contributed many security and stability fixes back to 
Linus. One day, much of OpenVZ will be integrated into the 
mainline kernel. Already 2.6.24 supports PID namespaces 
(in which process IDs are unique to each guest, not the 
host) and further OpenVZ functionality will move into the 
mainline kernel over time.
&lt;/p&gt;

&lt;/div&gt;
	</description>
</item>

<item>
	<title>The bank, a law unto itself</title>
	<link>http://www.nick-andrew.net/news/20080209-bank.html</link>
	<pubDate>Thu, 18 Sep 2008 12:16:46 +1000</pubDate>
	<guid>The bank, a law unto itself 1221704206</guid>
	<description>
&lt;div class="newsheading"&gt;2008-02-09 - The bank, a law unto itself&lt;/div&gt;
&lt;div class="newsitem"&gt;

&lt;p&gt;
Importing my bank account history today from a CSV file exported by the
bank's website, as I do every month, and the import failed. The reason
was that the bank changed the dates on several transactions made
from December
2007 to as early as April 2006. The dates were changed from 17th or 16th
to 15th in each case.
&lt;/p&gt;

&lt;p&gt;
What is it about banks that they can arbitrarily change transaction
dates, even 12+ months after the transaction occurs?  This could
have been legally problematic for me, say if I had to transfer
money by a certain date (and did that) and sometime later the
bank's "official" record of the transaction has changed.
&lt;/p&gt;

&lt;p&gt;
What has happened is that my financial records now no longer agree
with those of the bank, for no good reason, and I have to adjust
mine accordingly, or else there will forever be a discrepancy.
&lt;/p&gt;

&lt;/div&gt;
	</description>
</item>

<item>
	<title>LifeView TV Walker Twin</title>
	<link>http://www.nick-andrew.net/news/20070320-lifeview.html</link>
	<pubDate>Thu, 18 Sep 2008 12:16:46 +1000</pubDate>
	<guid>LifeView TV Walker Twin 1221704206</guid>
	<description>
&lt;div class="newsheading"&gt;2007-03-20 - LifeView TV Walker Twin&lt;/div&gt;
&lt;div class="newsitem"&gt;

&lt;img src="http://www.nick-andrew.net/Misc/Pics/pic-20070508-205708-2.jpg" width="100%" /&gt;
&lt;p&gt;
Firmware for the LifeView TV Walker Twin (DVB-T USB digital TV receiver)
can be found here at &lt;a href="LifeView/dvb-usb-tvwalkert.fw"&gt;dvb-usb-tvwalkert.fw&lt;/a&gt;.
Copy the file (without renaming it) into /usr/lib/hotplug/firmware/.
This is needed to make the device work in linux.
&lt;/p&gt;

&lt;p&gt;
I'm working on a driver and it will be merged into the linux-dvb project
repository in a few days.
&lt;/p&gt;
&lt;br clear="all" /&gt;

&lt;/div&gt;
	</description>
</item>

<item>
	<title>pwned again!</title>
	<link>http://www.nick-andrew.net/news/20070225-aacs.html</link>
	<pubDate>Thu, 18 Sep 2008 12:16:46 +1000</pubDate>
	<guid>pwned again! 1221704206</guid>
	<description>
&lt;div class="newsheading"&gt;2007-02-25 - pwned again!&lt;/div&gt;
&lt;div class="newsitem"&gt;

&lt;p&gt;
AA 85 6A 1B A8 14 AB 99 FF DE BA 6A EF BE 1C 04
&lt;/p&gt;

&lt;/div&gt;
	</description>
</item>

<item>
	<title>raid1 superblock version</title>
	<link>http://www.nick-andrew.net/news/20070217-raid1.html</link>
	<pubDate>Thu, 18 Sep 2008 12:16:46 +1000</pubDate>
	<guid>raid1 superblock version 1221704206</guid>
	<description>
&lt;div class="newsheading"&gt;2007-02-17 - raid1 superblock version&lt;/div&gt;
&lt;div class="newsitem"&gt;

&lt;p&gt;
It seems that the software raid1 superblock version 1.0 is not fully supported
by linux. I created two raid1 arrays, one with a version 0.90 superblock
and the other with version 1.0. During kernel boot, the md autoconfiguration
found the 0.90 superblock array, but said it could not find a superblock
for the other array.
&lt;/p&gt;

&lt;p&gt;
Furthermore, LILO refuses to install onto a raid1 array with a version
1.0 superblock. As soon as I converted it to version 0.90, LILO worked
fine.
&lt;/p&gt;

&lt;p&gt;
Lastly, the manpage for &lt;b&gt;pivot_root(2)&lt;/b&gt; fails to note that the
system call cannot be used to move away an initramfs. I dug into the
kernel source code and it's clearly noted in a comment above the
function definition.
&lt;/p&gt;

&lt;/div&gt;
	</description>
</item>

<item>
	<title>Random numbers</title>
	<link>http://www.nick-andrew.net/news/20070214-aacs.html</link>
	<pubDate>Mon, 05 Apr 2010 14:27:59 +1000</pubDate>
	<guid>Random numbers 1270441679</guid>
	<description>
&lt;div class="newsheading"&gt;2007-02-14 - Random numbers&lt;/div&gt;
&lt;div class="newsitem"&gt;

&lt;p&gt;
09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0
&lt;/p&gt;

&lt;/div&gt;
	</description>
</item>

<item>
	<title>Euphemisms for share price movements</title>
	<link>http://www.nick-andrew.net/news/20061108-test.html</link>
	<pubDate>Thu, 18 Sep 2008 12:16:46 +1000</pubDate>
	<guid>Euphemisms for share price movements 1221704206</guid>
	<description>
&lt;div class="newsheading"&gt;2006-11-08 - Euphemisms for share price movements&lt;/div&gt;
&lt;div class="newsitem"&gt;
&lt;p&gt;
In
&lt;a href="http://theaustralian.news.com.au/story/0,20867,20721842-1702,00.html"&gt;
Market catches breath after record pace&lt;/a&gt;
I can see a huge variety of euphemisms for share price rises and falls.
&lt;/p&gt;
&lt;p&gt;
Let's categorise them ...
&lt;/p&gt;

&lt;b&gt;Falls&lt;/b&gt;
&lt;ol&gt;
&lt;li&gt;fell x 2&lt;/li&gt;
&lt;li&gt;dropped&lt;/li&gt;
&lt;li&gt;reversed x 3&lt;/li&gt;
&lt;li&gt;dumped x 2&lt;/li&gt;
&lt;li&gt;gave away&lt;/li&gt;
&lt;li&gt;backtracked&lt;/li&gt;
&lt;li&gt;sagged&lt;/li&gt;
&lt;li&gt;eased&lt;/li&gt;
&lt;li&gt;off&lt;/li&gt;
&lt;li&gt;descended&lt;/li&gt;
&lt;li&gt;poorer&lt;/li&gt;
&lt;li&gt;stepped back&lt;/li&gt;
&lt;/ol&gt;

&lt;b&gt;Rises&lt;/b&gt;
&lt;ol&gt;
&lt;li&gt;jumped x 2&lt;/li&gt;
&lt;li&gt;rose x 2&lt;/li&gt;
&lt;li&gt;firmed&lt;/li&gt;
&lt;li&gt;heavier&lt;/li&gt;
&lt;li&gt;surged&lt;/li&gt;
&lt;li&gt;up&lt;/li&gt;
&lt;/ol&gt;

&lt;b&gt;Unchanged&lt;/b&gt;
&lt;ol&gt;
&lt;li&gt;steady x 2&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;
That's quite a swag of terms. Each one holds some connotations -
like "reversed" would imply that the stock price had gone down soon
after a rise. But ultimately aren't these words all talking about
the same thing - the share price dropped?  I wonder if there's
any meaning in those words or if the author simply has a list of
synonyms and chooses them at random, for variety.
&lt;/p&gt;

&lt;p&gt;
The whole article could have been written much more compactly with
a 4-column table: the share name, the closing price, the number of
cents up or down, and the surmised reason for the change, if any.
&lt;/p&gt;
&lt;/div&gt;
	</description>
</item>

<item>
	<title>Cleaning up the inbox</title>
	<link>http://www.nick-andrew.net/news/20060903-cleaning-up-the-inbox.html</link>
	<pubDate>Thu, 18 Sep 2008 12:16:46 +1000</pubDate>
	<guid>Cleaning up the inbox 1221704206</guid>
	<description>
&lt;div class="newsheading"&gt;2006-09-03 - Cleaning up the inbox&lt;/div&gt;
&lt;div class="newsitem"&gt;
&lt;p&gt;
I started refiling my inbox. It is too full!
I've moved most of them to vertical files in my desk drawer, neatly
labeled. My goal is to eliminate paper from my desk.
&lt;/p&gt;
Related links:
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.davidbrunelle.com/2006/08/24/at-least-im-trying-to-keep-my-desk-organized/"&gt;At Least I'm Trying to Keep my Desk Organized&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.lifeclever.com/2006/08/21/10-tips-for-keeping-your-desk-clean-and-tidy/"&gt;10 tips for keeping your desk clean and tidy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.43folders.com/2006/08/23/tidy-desk/"&gt;Life Clever: Secrets of the Tidy Desk&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
	</description>
</item>

</channel>
</rss>
