<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>syst.eng. Anders Larsen</title><link href="/" rel="alternate"></link><link href="http://www.alarsen.net/feeds/all.atom.xml" rel="self"></link><id>/</id><updated>2013-03-30T20:23:00+01:00</updated><entry><title>Looking for a Blog platform</title><link href="/posts/blog-platform.html" rel="alternate"></link><published>2013-03-30T20:23:00+01:00</published><updated>2013-03-30T20:23:00+01:00</updated><author><name>Anders Larsen</name></author><id>tag:None,2013-03-30:/posts/blog-platform.html</id><summary type="html">&lt;p class="first last"&gt;Looking for a Blog platform&lt;/p&gt;
</summary><content type="html">&lt;p&gt;Some time ago I decided to join the blogosphere, having read
&lt;a class="reference external" href="http://www.stevemcconnell.com/"&gt;Steve McConnell&lt;/a&gt;'s &lt;a class="reference external" href="http://www.stevemcconnell.com/ieeesoftware/bp10.htm"&gt;Call to Action&lt;/a&gt; (at the bottom of the page):
&amp;quot;If you are actively developing software, I urge you to write about your insights. If you have worked on a project that taught you valuable lessons, share them.&amp;quot;&lt;/p&gt;
&lt;p&gt;Unfortunately (I thought at the time), all user-ids similar to my preferred id
were already in use on the public blog hosts
(although many of them seemed abandoned), so I dropped the idea again.&lt;/p&gt;
&lt;p&gt;After my web-hoster &lt;a class="reference external" href="/posts/server-outage.html"&gt;went south last month&lt;/a&gt;,
I quickly set up &lt;a class="reference external" href="//www.apache.org/"&gt;Apache&lt;/a&gt; to host my old home pages and noticed that
those pages hadn't had a decent update for almost a decade, so
I decided to ditch them and instead host the blog myself
and started looking for a suitable platform.&lt;/p&gt;
&lt;p&gt;I soon found that most &amp;quot;mainstream&amp;quot; blogging platforms were either
using &lt;a class="reference external" href="//www.mysql.com/"&gt;MySQL&lt;/a&gt;, coded in &lt;a class="reference external" href="//php.net/"&gt;PHP&lt;/a&gt;, or both.&lt;/p&gt;
&lt;p&gt;My preferred database is &lt;a class="reference external" href="//www.postgresql.org/"&gt;PostgreSQL&lt;/a&gt; (which scores higher on the performance
benchmarks and feature comparisons I've seen so far), and PHP is certainly
&lt;a class="reference external" href="http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/"&gt;not my first choice&lt;/a&gt; of programming language.&lt;/p&gt;
&lt;p&gt;So I started looking for blogging platforms written in &lt;a class="reference external" href="//www.python.org/"&gt;Python&lt;/a&gt; and quickly
came across a &lt;a class="reference external" href="//www.pydanny.com/choosing-a-new-python-based-blog-engine.html"&gt;post&lt;/a&gt; on &lt;a class="reference external" href="//www.pydanny.com/"&gt;Daniel &amp;quot;PyDanny&amp;quot; Greenfeld&lt;/a&gt;'s blog - Daniel had
already thoroughly researched the subject and had found an interesting
solution: &lt;a class="reference external" href="http://docs.getpelican.com/en/latest/"&gt;Pelican&lt;/a&gt;.&lt;/p&gt;
&lt;div class="section" id="pelican"&gt;
&lt;h2&gt;Pelican&lt;/h2&gt;
&lt;p&gt;Pelican creates static pages from &lt;a class="reference external" href="//daringfireball.net/projects/markdown/"&gt;Markdown&lt;/a&gt; or &lt;a class="reference external" href="http://docutils.sourceforge.net/rst.html"&gt;reStructuredText&lt;/a&gt; input -
this eliminates the need for a database backend and even allows a very
minimalistic web-server to host the pages
(thereby eliminating several security risks).&lt;/p&gt;
&lt;p&gt;As an added benefit, I can keep my input pages locally in &lt;a class="reference external" href="//git-scm.com/"&gt;Git&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Setting up Pelican was fairly straight-forward, as the documentation is
detailed and complete - the hard part was to pick a theme among
the available lot...&lt;/p&gt;
&lt;p&gt;Pelican even sports an integrated web-server and can generate HTML output
on the fly as soon as it detects that an input file was modified -
this enables you to check the result of your edits practically in real time.&lt;/p&gt;
&lt;/div&gt;
</content><category term="blogging"></category><category term="python"></category></entry><entry><title>Port-based routing</title><link href="/posts/port-based-routing.html" rel="alternate"></link><published>2013-03-23T20:14:00+01:00</published><updated>2013-03-23T20:14:00+01:00</updated><author><name>Anders Larsen</name></author><id>tag:None,2013-03-23:/posts/port-based-routing.html</id><summary type="html">&lt;p class="first last"&gt;Port-based routing&lt;/p&gt;
</summary><content type="html">&lt;p&gt;My current network setup looks somewhat like this:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
                         ________     \            /     ________
          __________    |        |    /            \    |        |
_________|          |___| ADSL-  |____\  Internet  /____| root   |
  LAN    | firewall |   | router |    /            \    | server |
         |__________|   |________|    \            /    |________|
             ^                        /            \        ^
             :..............................................:
                              OpenVPN tunnel
&lt;/pre&gt;
&lt;p&gt;My local Internet connection (left-hand side)
does not have a fixed IPv4 address,
so I used to send outgoing e-mails through my mail-hosting provider,
who unfortunately &lt;a class="reference external" href="/posts/server-outage.html"&gt;went south last month&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The root-server on the right-hand side,
which hosts some virtual machines,
has a fixed, global IPv4 address, and since I control the DNS zone file,
I decided to have it handle outgoing as well as incoming e-mail traffic.&lt;/p&gt;
&lt;p&gt;One of the virtual machines on the root-server hosts a &lt;a class="reference external" href="http://www.postfix.org/"&gt;Postfix&lt;/a&gt; mail-server,
another hosts an &lt;a class="reference external" href="//www.apache.org/"&gt;Apache&lt;/a&gt; web-server.&lt;/p&gt;
&lt;p&gt;The easy part was to route incoming traffic to those VMs
using &lt;em&gt;iptables&lt;/em&gt; on the root-server:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
# iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 25 -j DNAT --to-destination &amp;quot;IP of Postfix VM&amp;quot;
# iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT --to-destination &amp;quot;IP of Apache VM&amp;quot;
# iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to-source &amp;quot;global IP of root-server&amp;quot;
&lt;/pre&gt;
&lt;p&gt;Now, routing outgoing e-mail traffic from my LAN through the root-server
without passing &lt;em&gt;all&lt;/em&gt; traffic through the VPN tunnel was a bit more tricky.&lt;/p&gt;
&lt;p&gt;First, declare a new routing table for &lt;a class="reference external" href="//wiki.linuxfoundation.org/networking/iproute2"&gt;iproute2&lt;/a&gt; on the firewall;
let's call it &amp;quot;smtp&amp;quot; and assign it the (arbitrary) number 25:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
# echo &amp;quot;25 smtp&amp;quot; &amp;gt;&amp;gt; /etc/iproute2/rt_tables
&lt;/pre&gt;
&lt;p&gt;Next, when the VPN tunnel comes up,
add a default route using the new table &lt;em&gt;smtp&lt;/em&gt;
and force marked packets through that route:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
# ip route add default via &amp;quot;root-server IP on VPN&amp;quot; table smtp
# ip rule add fwmark 0x01 lookup smtp
&lt;/pre&gt;
&lt;p&gt;(the above two commands could be placed in the &lt;a class="reference external" href="//openvpn.net/"&gt;OpenVPN&lt;/a&gt; &amp;quot;up&amp;quot; script).&lt;/p&gt;
&lt;p&gt;Finally, mark outgoing SMTP packets using &lt;em&gt;iptables&lt;/em&gt; on the firewall:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
# iptables -t mangle -A OUTPUT -p tcp --dport 25 -j MARK --set-mark 0x01
&lt;/pre&gt;
&lt;p&gt;Et voilà - SMTP packets originating on the firewall
(which queues outgoing e-mails using Postfix)
are routed through the VPN tunnel and exit from the root-server
(using its global IP address).&lt;/p&gt;
&lt;p&gt;With outgoing e-mail traffic originating from a fixed IP address,
configuring &lt;a class="reference external" href="http://www.dkim.org/"&gt;DKIM&lt;/a&gt; and &lt;a class="reference external" href="http://www.openspf.org/"&gt;SPF&lt;/a&gt; is now possible.&lt;/p&gt;
</content><category term="linux"></category><category term="networking"></category></entry><entry><title>Server outage</title><link href="/posts/server-outage.html" rel="alternate"></link><published>2013-03-04T22:01:00+01:00</published><updated>2013-03-04T22:01:00+01:00</updated><author><name>Anders Larsen</name></author><id>tag:None,2013-03-04:/posts/server-outage.html</id><summary type="html">&lt;p class="first last"&gt;Server outage&lt;/p&gt;
</summary><content type="html">&lt;p&gt;For the past twelve years my domain has been hosted by a regional company
(separate from my ISP),
but although problems have been few and far between
(and were always solved swiftly),
I was forced to take over and handle it myself.&lt;/p&gt;
&lt;p&gt;Here's a record of my ordeal:&lt;/p&gt;
&lt;div class="section" id="tue-2013-02-05-day-one"&gt;
&lt;h2&gt;Tue 2013-02-05, day one&lt;/h2&gt;
&lt;p&gt;At 09:15 UTC the lights suddently went out at my hoster's data center (but
I didn't notice until the next day).&lt;/p&gt;
&lt;p&gt;My logs show that my local server successfully fetched a batch of e-mails
at 09:13 UTC, but two minutes later
&lt;a class="reference external" href="http://www.fetchmail.info/"&gt;fetchmail&lt;/a&gt; stopped in the middle of the next batch.&lt;/p&gt;
&lt;p&gt;Since then, all connection attempts timed out.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="wed-2013-02-06-day-two"&gt;
&lt;h2&gt;Wed 2013-02-06, day two&lt;/h2&gt;
&lt;p&gt;I wondered why I hadn't received any e-mails (not even the occational SPAM)
for the past day and took a look at my server logs.&lt;/p&gt;
&lt;p&gt;Having noticed the timeouts I tried to contact the hosting company, but their
land lines (VoIP) were dead.
I couldn't reach their home-page either, so I wondered if perhaps their
backbone was damaged.&lt;/p&gt;
&lt;p&gt;Not knowing what was going on or even if the problem was transient or not,
I patiently waited.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="thu-2013-02-07-day-three"&gt;
&lt;h2&gt;Thu 2013-02-07, day three&lt;/h2&gt;
&lt;p&gt;Still no connectivity to the hoster and no news whatsoever about the
incident, so I started preparing for the worst.&lt;/p&gt;
&lt;p&gt;As the hoster was located in my region (less than 20 km away)
I decided to drive by after work and have a look at the surroundings.&lt;/p&gt;
&lt;p&gt;I got there about half an hour before the end of their office hours,
but I could not spot neither light nor any other sign of life in the
entire building, so I decided to act.&lt;/p&gt;
&lt;p&gt;At the advice of a knowledgeable collegue I opened an account with
the domain registration robot of the German hoster
&lt;a class="reference external" href="//www.hetzner.de/"&gt;Hetzner Online AG&lt;/a&gt; in order to move my domain elsewhere.&lt;/p&gt;
&lt;p&gt;I placed the order rather late in the evening, so I just had to wait
until the next day.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="fri-2013-02-08-day-four"&gt;
&lt;h2&gt;Fri 2013-02-08, day four&lt;/h2&gt;
&lt;p&gt;I received the access code to the domain registration robot in the morning
and immediately initiated a domain transfer.&lt;/p&gt;
&lt;p&gt;Alas, my request was rejected; it turned out I had to provide an authorisation
code which the domain registrar is supposed to provide.&lt;/p&gt;
&lt;p&gt;Now things threatened to get out of hand - the old hoster
(still unreachable) was &lt;em&gt;also&lt;/em&gt; the registrar,
so I had to quickly learn how the Internet works (organisationally, that is).&lt;/p&gt;
&lt;p&gt;My hoster was a member of &lt;a class="reference external" href="http://www.corenic.org/"&gt;CORE Internet Council of Registrars&lt;/a&gt; in Geneva,
so I emailed them that my hoster/registrar was Missing In Action and
asked for help.&lt;/p&gt;
&lt;p&gt;The person from the CORE secretariat was friendly and helpful; after having
cleared some formalities regarding proof of identity I was handed the precious
authorisation code, only two hours after the first contact.&lt;/p&gt;
&lt;p&gt;With the authorisation code at hand,
the robot finally accepted the domain transfer request.&lt;/p&gt;
&lt;p&gt;The confimation stated that the actual transfer would only take place after
five days (unless the previous registrar would ACK the transaction earlier,
but alas he was still unreachable).&lt;/p&gt;
&lt;p&gt;I guess I could have expedited the transfer (by contacting CORE again),
but as it was now friday afternoon and
I still hadn't decided where to host my domain, I instead started searching
for a new hoster.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="sat-2013-02-09-day-five"&gt;
&lt;h2&gt;Sat 2013-02-09, day five&lt;/h2&gt;
&lt;p&gt;I spent an hour or two looking for and comparing virtual servers
and root servers, since by now I had more-or-less abandoned the possibility of
selecting a new web-hoster but instead decided to regain complete control
by renting a server and configuring the web- and email-services myself.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="sun-2013-02-10-day-six"&gt;
&lt;h2&gt;Sun 2013-02-10, day six&lt;/h2&gt;
&lt;p&gt;I decided to rent the smallest (read: cheapest) root-server from Hetzner,
still a fairly powerful box (i7 quad-core, 16 GiB RAM and 2 x 3 TB disk drives),
suitably for hosting a handful of virtual machines.&lt;/p&gt;
&lt;p&gt;My plan was to compartmentalise the services (e-mail, web, whatever), each in
its own VM.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="mon-2013-02-11-day-seven"&gt;
&lt;h2&gt;Mon 2013-02-11, day seven&lt;/h2&gt;
&lt;p&gt;The server was ready, complete with a Ubuntu 12.04 minimal installation.&lt;/p&gt;
&lt;p&gt;Having restricted access according to my wishes
the next step was to install and configure &lt;a class="reference external" href="//openvpn.net/"&gt;OpenVPN&lt;/a&gt; on the server
to get a comfortable routing to and from my LAN.&lt;/p&gt;
&lt;p&gt;Next I installed &lt;em&gt;qemu-kvm&lt;/em&gt; and prepared a 'template'-VM,
also with Ubuntu 12.04.&lt;/p&gt;
&lt;p&gt;I then cloned the template and configured my new mail-server.&lt;/p&gt;
&lt;p&gt;Since my domain was still lingering awaiting transfer, I could only test that
&lt;em&gt;local&lt;/em&gt; emails were handled correctly, though.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="tue-2013-02-12-day-eight"&gt;
&lt;h2&gt;Tue 2013-02-12, day eight&lt;/h2&gt;
&lt;p&gt;I configured the next VM as a web-server and uploaded the backed-up content
of my home-page.&lt;/p&gt;
&lt;p&gt;Using &lt;em&gt;iptables&lt;/em&gt; I redirected incoming traffic on port 25 to the mail-VM
and port 80 to the web-VM, then verified the connectivity.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="wed-2013-02-13-day-nine"&gt;
&lt;h2&gt;Wed 2013-02-13, day nine&lt;/h2&gt;
&lt;p&gt;Early in the afternoon I got the longed for message that my domain
was finally transferred, so I configured DNS, logged into the
mail-VM and let &lt;em&gt;/var/log/mail.log&lt;/em&gt; run by.&lt;/p&gt;
&lt;p&gt;Less than a minute after having submitted my DNS zone file, the first
e-mail arrived: &lt;strong&gt;SPAM&lt;/strong&gt;...&lt;/p&gt;
&lt;p&gt;At any rate, it meant that after nine days I was now up-and-running again.&lt;/p&gt;
&lt;p&gt;Oh, just noticed that my new server came with a global /64 IPv6 subnet!
Hmmm...&lt;/p&gt;
&lt;/div&gt;
</content><category term="networking"></category></entry><entry><title>The QNX4 file-system in Linux</title><link href="/posts/qnx4fs.html" rel="alternate"></link><published>2004-02-03T21:01:00+01:00</published><updated>2004-02-03T21:01:00+01:00</updated><author><name>Anders Larsen</name></author><id>tag:None,2004-02-03:/posts/qnx4fs.html</id><summary type="html">&lt;p class="first last"&gt;The QNX4 file-system in Linux&lt;/p&gt;
</summary><content type="html">&lt;p&gt;The QNX4 file-system option in Linux allows you to mount QNX4/QNX6-formatted
floppies and hard-disk partitions on your Linux box and access
the files as if they were on your native file-system.&lt;/p&gt;
&lt;p&gt;It was originally written by Richard A. Frowÿn and Frank Denis, who -
due to lack of time - passed the maintainership on to me in december 1999.&lt;/p&gt;
&lt;p&gt;I fixed the last severe bugs in Kernels 2.2.15 and 2.3.35;
previous versions were quite buggy and did not support fragmented files at all.&lt;/p&gt;
&lt;p&gt;Starting with Kernel 2.4.19 it is possible to mount partitions created
with QNX version 6.1 and above.&lt;/p&gt;
&lt;p&gt;A bug that got exposed by subtle changes to the Virtual File System can cause
a &lt;strong&gt;complete system hang&lt;/strong&gt; when using the QNX4 file-system in Kernel 2.4.8
and 2.4.9 - the solution is to comment out line 399 of fs/qnx4/inode.c
(the problem was fixed in Kernel 2.4.10)&lt;/p&gt;
&lt;p&gt;There's an alternative implementation which supports writing to the QNX
partition at &lt;a class="reference external" href="http://qnxfs.narod.ru/"&gt;http://qnxfs.narod.ru/&lt;/a&gt;, but I don't use it myself and cannot
guarantee that it will work for you.&lt;/p&gt;
&lt;div class="section" id="related-software"&gt;
&lt;h2&gt;Related software&lt;/h2&gt;
&lt;p&gt;Peter Waechtler (formerly of QSSL Germany) wrote a &lt;tt class="docutils literal"&gt;dinit&lt;/tt&gt;-like utility
to initialize the QNX4 file-system from within Linux; you can get a copy here:
&lt;a class="reference external" href="/files/dinit.tgz"&gt;dinit.tgz&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you are familiar with QNX and its Send/Receive/Reply IPC paradigm and would
like to use a similar mechanism with Linux, check the
S.I.M.P.L. project at &lt;a class="reference external" href="http://www.icanprogram.com/simpl/"&gt;http://www.icanprogram.com/simpl/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;A light-weight library implemented by Sam Roberts was available
at &lt;a class="reference external" href="http://www.cogent.ca/Software/SRR.html"&gt;http://www.cogent.ca/Software/SRR.html&lt;/a&gt;, but that link is dead now.&lt;/p&gt;
&lt;p&gt;You may wish to see the QNX community portal at &lt;a class="reference external" href="http://www.openqnx.com/"&gt;http://www.openqnx.com/&lt;/a&gt;
for news, explanations, FAQ, forums, newsgroups, mailing lists,
software downloads, weblinks, tech reviews, searches, fun, tips,
online live support around QNX4 and QNX6.&lt;/p&gt;
&lt;/div&gt;
</content><category term="linux"></category><category term="qnx4"></category><category term="qnx4fs"></category></entry><entry><title>mkQNXnbi</title><link href="/posts/mkqnxnbi.html" rel="alternate"></link><published>2003-12-29T22:41:00+01:00</published><updated>2003-12-29T22:41:00+01:00</updated><author><name>Anders Larsen</name></author><id>tag:None,2003-12-29:/posts/mkqnxnbi.html</id><summary type="html">&lt;p class="first last"&gt;boot QNX4 over Ethernet&lt;/p&gt;
</summary><content type="html">&lt;p&gt;I wrote &lt;em&gt;mkQNXnbi&lt;/em&gt;, a utility to allow net-booting QNX4 using
&lt;a class="reference external" href="http://etherboot.org/"&gt;Etherboot&lt;/a&gt; - a versatile, open-source dhcp/bootp Ethernet boot-ROM package.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;mkQNXnbi&lt;/em&gt; is included with the Etherboot-distribution tarball
(look into the directory &lt;tt class="docutils literal"&gt;/contrib/mkQNXnbi/&lt;/tt&gt;).&lt;/p&gt;
&lt;div class="section" id="related-software"&gt;
&lt;h2&gt;Related software&lt;/h2&gt;
&lt;p&gt;You may wish to see the QNX community portal at &lt;a class="reference external" href="http://www.openqnx.com/"&gt;http://www.openqnx.com/&lt;/a&gt;
for news, explanations, FAQ, forums, newsgroups, mailing lists,
software downloads, weblinks, tech reviews, searches, fun, tips,
online live support around QNX4 and QNX6.&lt;/p&gt;
&lt;/div&gt;
</content><category term="bootloaders"></category><category term="networking"></category><category term="qnx4"></category></entry><entry><title>Booting Linux on a WindowsCE device</title><link href="/posts/amd-elan.html" rel="alternate"></link><published>2001-03-13T20:23:00+01:00</published><updated>2001-03-13T20:23:00+01:00</updated><author><name>Anders Larsen</name></author><id>tag:None,2001-03-13:/posts/amd-elan.html</id><summary type="html">&lt;p class="first last"&gt;Booting Linux on a WindowsCE device&lt;/p&gt;
</summary><content type="html">&lt;p&gt;I've written a &lt;a class="reference external" href="/files/LinuxCE.tar.gz"&gt;utility&lt;/a&gt;
to boot Linux 2.2.x via the WinCE loader on the credit-card size PC
&amp;quot;DIMM-PC EC&amp;quot; (manufactured by the German company &lt;a class="reference external" href="http://www.gesytec.de/uk/"&gt;Gesytec GmbH&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This module utilizes an AMD Élan SC410 PC-on-a-chip, which,
unfortunately, has some peculiarities.&lt;/p&gt;
&lt;p&gt;The company &lt;a class="reference external" href="http://www.pengutronix.de/index_en.html"&gt;Pengutronix&lt;/a&gt; provides &lt;a class="reference external" href="http://www.pengutronix.de/software/elan/index_en.html"&gt;patches&lt;/a&gt; against 2.4.13 .. 2.4.17
which fixes a clock drift problem
and provides a work-around for a nasty serial interface bug.&lt;/p&gt;
&lt;p&gt;The patches were merged into 2.4.18,
so you probably don't need them separately, though.&lt;/p&gt;
</content><category term="bootloaders"></category><category term="linux"></category></entry></feed>