<?xml version="1.0"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Blog&amp;#x27;n&amp;#x27;Roll</title>
<link>http://mixinet.net/~sto/blog/</link>
<description>StoWiki</description>
<item>
	
	<title>Static website generators</title>
	
	<guid>http://mixinet.net/~sto/blog/sysadmin/20111001_static_website_generators/</guid>
	<link>http://mixinet.net/~sto/blog/sysadmin/20111001_static_website_generators/</link>
	
	<pubDate></pubDate>
	<description><![CDATA[<p>The last month I was supposed to work on a <a href="http://www.openstack.org/">OpenStack</a> related
project, but for administrative reasons it has been delayed and I've tried to
do small tasks to be able to finish them quickly and start the work on the
main project when the issues get solved.</p>

<p>As the delay has been longer than expected last Wednesday I've realized than
on the last weeks I did a lot of small system administration tasks:</p>

<ul>
<li>With a co-worker I started to work on a GNU/Linux version of our firewall
based on <a href="http://shorewall.net/">Shorewall</a> to handle the rules and
<a href="http://conntrack-tools.netfilter.org/">conntrackd</a> and <a href="http://www.keepalived.org/">keepalived</a> to make it highly
available (I had to stop my work on the 
<a href="http://mixinet.net/~sto/blog/./debian/20101122_The_FreakyWall_Part_1/">Debian GNU/kFreeBSD based firewall</a>
a long time ago, and this summer the old firewalls' hardware started to
fail, so a migration from Linux to Linux makes sense now, as it will be
faster and a future migration will be simpler, as we will have a cleaner set
of rules and better documentation),</li>
<li>I installed and configured an instance of a web based File Exchange server
(<a href="http://fex.rus.uni-stuttgart.de/">F*EX</a>),</li>
<li>I installed and configured an instance of a <a href="http://www.pocoo.org/projects/lodgeit/">pastebin clone</a>,</li>
<li>I installed and configured an instance of <a href="http://proftpd.org/">ProFTPD</a> that works only
as a <a href="http://en.wikipedia.org/wiki/SSH_File_Transfer_Protocol">SFTP</a> server using virtual users (without shell access),</li>
<li>I also installed an instance of a web based event management system called
<a href="http://indico-software.org/">indico</a> that is being used to manage a conference and probably will
be used for other events in the future,</li>
<li>I installed and patched some plugins in our <a href="http://trac.edgewall.org/">Trac</a> servers, </li>
<li>I tried a groupware system called <a href="http://www.sogo.nu/">SOGo</a> that we will probable deploy
in a week or two,</li>
<li>And updated and fixed configurations of some other services,</li>
</ul>

<p>With all the changes I did I noticed that I had to do something with our
Intranet server; it is just a reverse proxy for a lot of different web
services and its main page was one static HTML page with links to them,
nothing else.</p>

<p>In the long term maybe we will replace it with something based on
<a href="http://drupal.org/">Drupal</a> or <a href="http://www.liferay.com/">Lifeay</a>, but for now I just wanted something to
be able to organize the links and provide some information about the services
for the new users without having to write HTML (I really like <a href="http://www.uv.es/sto/charlas/2006_07_V_JornadesPL/">Agile
Documentation Tools</a> that let me focus on the content and forget about
the markup), and started to look at some of them.</p>

<p>My first idea was to use <a href="http://ikiwiki.info/">ikiwiki</a>, as it has all the features I was
looking for: I can use <a href="http://daringfireball.net/projects/markdown/">Markdown</a> or <a href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> to
write the contents, the source pages are easily handled on a <a href="http://en.wikipedia.org/wiki/Revision_control">Version Control
System</a>, it supports the use of templates for the HTML, etc., but it
seemed to me that using <strong>ikiwiki</strong> was like <em>killing flies with a cannon</em>
(that's a Spanish say, I guess it's easy to understand it in English, ¿no?)
and I decided to review other <a href="http://iwantmyname.com/blog/2011/02/list-static-website-generators.html">tools to build static web sites</a>.</p>

<p>To make a long story short, I selected some tools that met my requirements and
looked nice on their demo sites; after my first review I thought that
<a href="http://hyde.github.com/">Hyde</a> was going to be my bet, as it uses technologies I'm already
familiar with, but after trying it I saw that I was going to have a problem
with documentation (the current <strong>Hyde</strong> version lacks it) and it was going to
be more complicated that using <strong>ikiwiki</strong>.</p>

<p>Before giving up I decided to review simpler tools, just in case, and after
looking some of them I ended up using <a href="https://bitbucket.org/obensonne/poole">poole</a>, a simple
<a href="http://python.org/">python</a> script (the source is just one file and it only requires
<a href="http://www.freewisdom.org/projects/python-markdown/">python-markdown</a> to work).</p>

<p>Before moving to the content I tried to adapt a couple of free themes to be
used by the tool, but I didn't liked the result, so I went back to the plain
style provided by the tool and added a logo and a background.</p>

<p>With that simple look and feel I started to work with the content, splitting
it into eight markdown files and a python macro to include a file that has all 
the links used on the site.</p>

<p>While trying to make the main page look good I noticed how little I know about
CSS, but using search engines I was able to build a two column block into the
main page and publish the contents and with the help of some CSS enabled
co-workers I changed the look and feel of the site in about 30 minutes.</p>

<p>In summary, if you want a really simple website, you know a little bit of
python and don't want to spend much time learning how to use a website
generator then <strong>Poole</strong> is a good option. If you want something more complex
I still think that <strong>ikiwiki</strong> is a good option, but YMMV.</p>
]]></description>
</item>
<item>
	
	<title>The FreakyWall (Part 3: Packages)</title>
	
	<guid>http://mixinet.net/~sto/blog/debian/20101130_The_FreakyWall_Part_3/</guid>
	<link>http://mixinet.net/~sto/blog/debian/20101130_The_FreakyWall_Part_3/</link>
	
	<pubDate></pubDate>
	<description><![CDATA[<p>In this post I'll describe the changes made to the kernel and some of the
Squeeze packages for the <em>Freaky Wall</em>.</p>

<p>The plan is to submit whishlist bugs to the BTS on the hope of having all what
is needed for this project available on Debian after the Squeeze release, as
my feeling is that a freeze is not the right time to push this changes... ;)</p>

<p>I'm giving access here to all the changes made to the source packages, but if
anyone wants the binary packages (amd64 only) send me an email and I'll give
you the URL of an apt repository that contains all the modified packages (it's
the one at work, that contains other modified packages) or, if there is
interest, I can put them on people.debian.org.</p>

<h1>Kernel</h1>

<p>To be able to build the firewall we need a kFreeBSD kernel with some options
not compiled on the version distributed with Debian.</p>

<p>To compile the kernel I've followed the procedure described on the following
debian-bsd mailing list post:</p>

<p><a href="http://lists.debian.org/debian-bsd/2010/09/msg00023.html">http://lists.debian.org/debian-bsd/2010/09/msg00023.html</a></p>

<p>Basically I've done the following:</p>

<pre><code>    apt-get build-dep kfreebsd-8
    apt-get source kfreebsd-8
    cd kfreebsd-8-8.1
    cat &gt;&gt; debian/arch/amd64/amd64.config &lt;&lt; EOF

    # Add pflog, pfsync, ALTQ and CARP support
    # ----------------------------------------

    # http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/firewalls-pf.html
    device      pf
    device      pflog
    device      pfsync

    options         ALTQ
    options         ALTQ_CBQ        # Class Bases Queuing (CBQ)
    options         ALTQ_RED        # Random Early Detection (RED)
    options         ALTQ_RIO        # RED In/Out
    options         ALTQ_HFSC       # Hierarchical Packet Scheduler (HFSC)
    options         ALTQ_PRIQ       # Priority Queuing (PRIQ)
    options         ALTQ_NOPCC      # Required for SMP build

    # http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/carp.html
    device      carp
    EOF
    vi debian/changelog 
    dpkg-buildpackage -B -uc
</code></pre>

<p>Once the package was built I installed the new kernel package and rebooted the
machine.</p>

<h1>Utilities</h1>

<p>To be able to use some utilities related to <code>pf</code> I have built patched
versions of three packages:</p>

<ul>
<li><p><code>freebsd-utils</code>: I have included <code>pflogd</code> and <code>ftp-proxy</code> on the package and
have added some options to allow the use of additional interface types with
<code>ifconfig</code> (<code>carp</code>, <code>pfsync</code>, <code>lagg</code>, <code>bridges</code>, ...).</p>

<p>There were a lot of changes needed:</p>

<ol>
<li><p>The <code>pflogd</code> and <code>ftp-proxy</code> Makefiles are missing from the original
tarball, I modified the <code>get-orig-source</code> of the <code>debian/rules</code>, but I build
my packages against the original tarball, with the extra files included
directly on the package .diff.gz.</p></li>
<li><p>The <code>pflogd</code> daemon needs a <code>_pflogd</code> user and group and a
<code>/var/run/_pflogd</code> directory, so I've added the directory and the creation
of the user and group to the package post-install.</p></li>
<li><p>The <code>ftp-proxy</code> daemon uses the <code>proxy</code> user when dropping privileges and
I've modified the code to make it use the <code>/var/run/ftp-proxy</code> directory for
the chroot.</p></li>
<li><p>Some C header files that are not available on <code>-dev</code> packages were
missing and I put them on the packages' debian directory. I've created a
<code>debian/include</code> directory and moved there the original <code>debian/net</code>
directory and added the headers  <code>debian/include/net/if_bridgevar.h</code> and
<code>debian/include/net/if_lagg.h</code> to add bridging support to <code>ifconfig</code> and the
<code>debian/include/pcap-config.h</code> and <code>debian/include/pcap-int.h</code> libpcap
private headers to be able to compile the <code>pflogd</code> binary.</p></li>
</ol>

<p>As I'm not familiar with the way people changes code for kFreeBSD some of
the patches are a little bit dirty, but at least things work; besides,
probably I should also have had to include init.d scripts for <code>pf</code>, <code>pflogd</code>
and <code>ftp-proxy</code>, but I have not done it at the package level yet, as what I
got was enough to work with the tools.</p>

<p>The debdiff against the <code>freebsd-utils-8.1-2</code> source package is available
<a href="http://mixinet.net/~sto/blog/./debian/20101130_The_FreakyWall_Part_3/patches/freebsd-utils-8.1-2_to_2.4.patch">here</a> or
<a href="http://web.iti.upv.es/~sto/kfreebsd/patches/freebsd-utils-8.1-2_to_2.4.patch">here</a>. </p></li>
<li><p><code>libpcap</code>: A test had to be removed in order to be able to support <code>pflog</code>
on the library; the debdiff against the <code>libpcap-1.1.1-2</code> package is
available <a href="http://mixinet.net/~sto/blog/./debian/20101130_The_FreakyWall_Part_3/patches/libpcap-1.1.1-2_to_2.1.patch">here</a> or
<a href="http://web.iti.upv.es/~sto/kfreebsd/patches/libpcap-1.1.1-2_to_2.1.patch">here</a>.</p></li>
<li><p><code>tcpdump</code>: The package also had to be modified to include the code to print
the <code>pflogd</code> entries on the <code>pcap</code> file; the debdiff against
<code>tcpdump_4.1.1-1</code> is available <a href="http://mixinet.net/~sto/blog/./debian/20101130_The_FreakyWall_Part_3/patches/tcpdump_4.1.1-1_to_1.1.patch">here</a> or
<a href="http://web.iti.upv.es/~sto/kfreebsd/patches/tcpdump_4.1.1-1_to_1.1.patch">here</a>.</p></li>
</ul>

<p>On the next post I'll describe how I've configured the system, the network
interfaces and the different utilities patched and compiled on this post.</p>
]]></description>
</item>
<item>
	
	<title>libpcap-1.1.1-2 to 2.1.patch</title>
	
	<guid>http://mixinet.net/~sto/blog/debian/20101130_The_FreakyWall_Part_3/patches/libpcap-1.1.1-2_to_2.1.patch</guid>
	<link>http://mixinet.net/~sto/blog/debian/20101130_The_FreakyWall_Part_3/patches/libpcap-1.1.1-2_to_2.1.patch</link>
	
	<pubDate></pubDate>
	<description><![CDATA[]]></description>
</item>
<item>
	
	<title>tcpdump 4.1.1-1 to 1.1.patch</title>
	
	<guid>http://mixinet.net/~sto/blog/debian/20101130_The_FreakyWall_Part_3/patches/tcpdump_4.1.1-1_to_1.1.patch</guid>
	<link>http://mixinet.net/~sto/blog/debian/20101130_The_FreakyWall_Part_3/patches/tcpdump_4.1.1-1_to_1.1.patch</link>
	
	<pubDate></pubDate>
	<description><![CDATA[]]></description>
</item>
<item>
	
	<title>freebsd-utils-8.1-2 to 2.4.patch</title>
	
	<guid>http://mixinet.net/~sto/blog/debian/20101130_The_FreakyWall_Part_3/patches/freebsd-utils-8.1-2_to_2.4.patch</guid>
	<link>http://mixinet.net/~sto/blog/debian/20101130_The_FreakyWall_Part_3/patches/freebsd-utils-8.1-2_to_2.4.patch</link>
	
	<pubDate></pubDate>
	<description><![CDATA[]]></description>
</item>
<item>
	
	<title>The Freaky Wall (Part 2: Initial Installation)</title>
	
	<guid>http://mixinet.net/~sto/blog/debian/20101124_The_FreakyWall_Part_2/</guid>
	<link>http://mixinet.net/~sto/blog/debian/20101124_The_FreakyWall_Part_2/</link>
	
	<pubDate></pubDate>
	<description><![CDATA[<p>For the <strong>Freaky Wall</strong> I have installed a <strong>Debian GNU/kFreeBSD</strong> system
using the installer with ZFS support announced on:</p>

<p><a href="http://robertmh.wordpress.com/2010/09/06/debian-installer-with-zfs/">http://robertmh.wordpress.com/2010/09/06/debian-installer-with-zfs/</a></p>

<p>I used the <code>mini.iso</code> found on:</p>

<p><a href="http://people.debian.org/~rmh/zfs/kfreebsd-amd64/monolithic/mini.iso">http://people.debian.org/~rmh/zfs/kfreebsd-amd64/monolithic/mini.iso</a></p>

<p>the 12th of October of 2010; as I had some problems and reported them to
Robert is possible that the current image solves part of them.</p>

<h1>Installation plan</h1>

<p>I did a standard installation on a machine with two hard disks, but only used
the first one from the installer.</p>

<p>The plan was to use ZFS with RAID-1, but current versions of <code>grub</code> do not
support booting from a ZFS + RAID file system, so I had to use the same
technique used for Linux for a long time; three partitions: a swap partition,
a small <code>/boot</code> partition and a big partition for <code>/</code>; <code>/</code> and <code>/boot</code> were
formated to use ZFS.</p>

<h1>First reboot</h1>

<p>After the installation the system failed to boot because of a bug when
building the <code>/boot/grub/grub.cfg</code> (some paths were missing a <code>//@</code> prefix);
to be able to boot Iwe edited the config on the grub prompt and later fixed
the file:</p>

<pre><code>    --- grub.cfg.orig       2010-10-13 16:40:39.000000000 +0200
    +++ grub.cfg    2010-10-13 18:38:47.535436766 +0200
    @@ -64,7 +64,7 @@
            set root='(hd0,1)'
            search --no-floppy --fs-uuid --set a371979bb836d1fe
            echo                    'Loading kernel of FreeBSD 8.1-1-amd64 ...'
    -       kfreebsd                /kfreebsd-8.1-1-amd64.gz
    +       kfreebsd                //@/kfreebsd-8.1-1-amd64.gz
            insmod part_msdos
            insmod zfs
            set root='(hd0,3)'
    @@ -75,7 +75,7 @@
            insmod zfs
            set root='(hd0,1)'
            search --no-floppy --fs-uuid --set a371979bb836d1fe
    -       kfreebsd_module         /zfs/zpool.cache type=/boot/zfs/zpool.cache
    +       kfreebsd_module         //@/zfs/zpool.cache type=/boot/zfs/zpool.cache
            set kFreeBSD.vfs.root.mountfrom=zfs:dkfbf1-ad4s3
            set kFreeBSD.vfs.root.mountfrom.options=rw
     }
</code></pre>

<p>I haven't tested the installer since that day, but I believe that the current
ZFS installer was fixed by Robert to deal with that problem.</p>

<p>Once the system was booted I had to fix a couple of things:</p>

<ul>
<li><p>The keyboard configuration was wrong, but it was easy to fix the Debian Way:</p>

<pre><code>dpkg-reconfigure kbdcontrol
</code></pre></li>
<li><p>The <code>/boot</code> partition was mounted on <code>/target/boot</code>, as that was what was
 recorded on the ZFS file system; to fix it I executed the following commands:</p>

<pre><code> # zfs set mountpoint=/     dkfbf1-ad4s3
 # zfs set mountpoint=/boot dkfbf1-ad4s1
</code></pre>

<p>Where <code>dkfbf1-ad4s3</code> is the root file system and <code>dkfbf1-ad4s1</code> is the
 original <code>/boot</code>.</p>

<p>I reported that to Robert also and I believe it is fixed on the ZFS
 installer now.</p></li>
</ul>

<h1>Adjusting ZFS to do RAID-1</h1>

<p>On the second disk I created the same partitions as the ones on the first disk
using <code>parted</code>; the final result was:</p>

<pre><code>    # parted -l     
    Model: ST3250620NS/3BKS (ide)
    Disk /dev/ad6: 250GB
    Sector size (logical/physical): 512B/512B
    Partition Table: msdos

    Number  Start   End     Size    Type     File system  Flags
     1      1049kB  256MB   255MB   primary
     2      256MB   4256MB  4000MB  primary
     3      4256MB  250GB   246GB   primary

    Model: ST3250620NS/3BKS (ide)
    Disk /dev/ad4: 250GB
    Sector size (logical/physical): 512B/512B
    Partition Table: msdos

    Number  Start   End     Size    Type     File system     Flags
      1      1049kB  256MB   255MB   primary
      2      256MB   4256MB  4000MB  primary  linux-swap(v1)
      3      4256MB  250GB   246GB   primary
</code></pre>

<p>To use the second partition of both disks as swap I added the following to
<code>/etc/fstab</code>:</p>

<pre><code>    /dev/ad4s2      none            swap    sw              0       0
    /dev/ad6s2      none            swap    sw              0       0
</code></pre>

<p>To configure the mirroring for the root file system I did the following:</p>

<pre><code>    zpool attach dkfbf1-ad4s3 ad4s3 ad6s3
</code></pre>

<p>As the <code>/boot</code> can't work as a replica I adjusted it to make two copies of
every file:</p>

<pre><code>    zfs   set copies=2     dkfbf1-ad4s1
</code></pre>

<p>Leaving the second disk copy alone, although my plan is to configure it to
hold a copy of the <code>/boot</code> partition synchronized with <code>rsync</code> each night.</p>

<p>After all those changes the system didn't boot, as the <code>grub-pc</code> generates a
buggy <code>/boot/grub/grub.cfg</code>; the problem is on the <code>/etc/grub.d/10_kfreebsd</code>
section:</p>

<pre><code>    ### BEGIN /etc/grub.d/10_kfreebsd ###
    menuentry 'Debian GNU/kFreeBSD, with kFreeBSD 8.1-1-amd64' --class debian \
      --class gnu-kfreebsd --class gnu --class os {
          insmod part_msdos
          insmod zfs
          set root='(hd0,1)'
          search --no-floppy --fs-uuid --set a371979bb836d1fe
          echo 'Loading kernel of FreeBSD 8.1-1-amd64 ...'
          kfreebsd /kfreebsd-8.1-1-amd64.gz
          set kFreeBSD.vfs.root.mountfrom=unknown:/dev/ad4s3
          set kFreeBSD.vfs.root.mountfrom.options=rw
    }
    ### END /etc/grub.d/10_kfreebsd ###
</code></pre>

<p>To fix it there has to be a copy of the modules for ZFS on the boot partition
(in my case I moved the <code>/lib/modules</code> directory to <code>/boot</code> and created a
link on the root partition to the new directory):</p>

<pre><code>    cd /boot
    mkdir lib
    mv /lib/modules lib
    cd /lib
    ln -s ../boot/lib/modules
</code></pre>

<p>And instead of fixing the <code>/etc/grub.d/10_kfreebsd</code> code I wrote a new
script (<code>/etc/grub.d/09_zfs_kfreebsd</code>) that creates the right config for my
current configuration on the <code>grub.cfg</code> file:</p>

<pre><code>    #!/bin/sh
    prefix=/usr
    exec_prefix=&#036;{prefix}
    bindir=&#036;{exec_prefix}/bin
    libdir=&#036;{exec_prefix}/lib
    . &#036;{libdir}/grub/grub-mkconfig_lib

    prepare_boot_cache="&#036;(prepare_grub_to_access_device &#036;{GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
    kfreebsd_versions="&#036;(ls /lib/modules/)"
    zfs_root_device="&#036;(zfs list | awk '/\/&#036;/ { print &#036;1 }' | head -1)"

    for kversion in &#036;kfreebsd_versions; do
      cat &lt;&lt; EOF
    # Entry when using ZFS (we have issues with /etc/grub.d/10_kfreebsd)
    menuentry 'Debian GNU/kFreeBSD, with kFreeBSD &#036;kversion and ZFS' --class debian --class gnu-kfreebsd --class gnu --class os {
    &#036;{prepare_boot_cache}
          echo                    'Loading kernel of FreeBSD &#036;kversion ...'
          kfreebsd                //@/kfreebsd-&#036;kversion.gz
          kfreebsd_module_elf     //@/lib/modules/&#036;kversion/opensolaris.ko
          kfreebsd_module_elf     //@/lib/modules/&#036;kversion/zfs.ko
          kfreebsd_module         //@/zfs/zpool.cache type=/boot/zfs/zpool.cache
          set kFreeBSD.vfs.root.mountfrom=zfs:&#036;zfs_root_device
          set kFreeBSD.vfs.root.mountfrom.options=rw
    }
    EOF
    done
</code></pre>

<p>I solved the problem this way to have a working solution that does not break
with squeeze upgrades, assuming that a future <code>grub-pc</code> package will deal well
with my config and I'll be able to remove this script, but I guess I'll have
to install it from backports.</p>

<p>The entry generated by the script when called from <code>update-grub</code> will be
similar to:</p>

<pre><code>    ### BEGIN /etc/grub.d/09_zfs-kfreebsd ###
    # Entry when using ZFS (we have issues with /etc/grub.d/10_kfreebsd)
    menuentry 'Debian GNU/kFreeBSD, with kFreeBSD 8.1-1-amd64 @ ITI' --class debian --class gnu-kfreebsd --class gnu --class os {
          insmod part_msdos
          insmod zfs
          set root='(hd0,1)'
          search --no-floppy --fs-uuid --set a371979bb836d1fe
          echo                    'Loading kernel of FreeBSD 8.1-1-amd64 ...'
          kfreebsd                //@/kfreebsd-8.1-1-amd64.gz
          kfreebsd_module_elf     //@/lib/modules/8.1-1-amd64/opensolaris.ko
          kfreebsd_module_elf     //@/lib/modules/8.1-1-amd64/zfs.ko
          kfreebsd_module         //@/zfs/zpool.cache type=/boot/zfs/zpool.cache
          set kFreeBSD.vfs.root.mountfrom=zfs:dkfbf1-ad4s3
          set kFreeBSD.vfs.root.mountfrom.options=rw
    }
    ### END /etc/grub.d/10_iti-kfreebsd ###
</code></pre>

<p>And after rebooting the machine with this new configuration the system boots
OK.</p>

<p>On my next post I'll continue explaining how to compile a kernel that supports
the use of the OpenBSD Packet Filter and related technologies (CARP, pflog,
etc.).</p>
]]></description>
</item>
<item>
	
	<title>The Freaky Wall (Part 1: Why?)</title>
	
	<guid>http://mixinet.net/~sto/blog/debian/20101122_The_FreakyWall_Part_1/</guid>
	<link>http://mixinet.net/~sto/blog/debian/20101122_The_FreakyWall_Part_1/</link>
	
	<pubDate></pubDate>
	<description><![CDATA[<p>This post and the next to come are about a project I'm doing at work that I've
called <em>The Freaky Wall</em>.</p>

<p>The project has its origins on the idea that using multiples technologies is
better for security; almost all the servers I use are running <strong>Debian
GNU/Linux</strong> and use <code>iptables</code> locally, so when I decided that we had to build
new firewalls at work I thought it was a good idea to look at different
technologies, that is, a different kernel and firewalling tools.</p>

<p>As I wanted to avoid <code>iptables</code> and the Linux kernel my first idea was to go
after the free BSD systems (<a href="http://www.freebsd.org/">FreeBSD</a>,
<a href="http://www.openbsd.org">OpenBSD</a> or <a href="http://www.netbsd.org/">NetBSD</a>), and
soon realized that <a href="http://www.openbsd.org/faq/pf/">pf</a> (the <em>OpenBSD Packet
Filter</em>) was the way to go; it has a clean syntax and includes advanced
features like <a href="http://www.openbsd.org/faq/pf/carp.html">CARP and <code>pfsync</code></a>
that allow me to build redundant firewalls. </p>

<p>Before going after the standard systems I looked at
<a href="http://www.pfsense.org/">pfSense</a> a firewall appliance built on top of
<strong>FreeBSD</strong> that uses a PHP interface to do everything.</p>

<p>At first it seemed that it was going to be a good option, but soon I felt that
I wasn't in control of what the system was doing and I had to change the PHP
code to do trivial things (I wanted to configure IP aliases on a CARP
interface and it was not possible with the web interface, while it is trivial
to do using the standard system configuration files), so I left the idea of
using it.</p>

<p>The second option was to use <strong>OpenBSD</strong> directly, as it is the system were
<code>pf</code> has been developed. Soon I saw that I was going to be able to do what I
wanted with the system, but I missed the Debian's way of installing and
upgrading the system and the list of packages available.</p>

<p>For different reasons the firewall project was left in a limbo for a little
while and when I went back to it I already had to upgrade my test systems to a
new OpenBSD release; after reading a little bit about how to upgrade and not
liking the idea of doing it I remembered that <a href="http://oskuro.net/">jordi</a>
suggested that if we only want the kernel and the firewall tools the <a href="http://www.debian.org/ports/kfreebsd-gnu/">Debian
GNU/kFreeBSD port</a> could be an
option instead of <strong>OpenBSD</strong> or <strong>FreeBSD</strong>.</p>

<p>Before trying to install the <strong>Debian GNU/kFreeBSD</strong> system I saw <a href="http://robertmh.wordpress.com/2010/09/06/debian-installer-with-zfs/">Robert's
post</a>
about a <em>Debian installer with ZFS support</em> and I decided to start with it, as
the use of <a href="http://en.wikipedia.org/wiki/ZFS">ZFS</a> will allow us to use
software RAID-1 and snapshots, something we have on almost all our Linux
servers (we use software RAID for redundancy and LVM snapshots to be able
to do our backups at any time of the day with consistent data, but that is for
another post).</p>

<p>On my next post I'll explain how I did the initial installation with
ZFS, and after that I'll explain the changes I did to the kernel and some of
the packages to be able to build a firewall as described on the <a href="http://home.nuug.no/~peter/pf/">Firewalling
with PF</a> document (that is, I needed <code>pfctl</code>,
<code>pflogd</code>, a <code>tcpdump</code> with <code>pflog</code> support, the <code>pf</code>'s <code>ftp-proxy</code>, etc.) and
on the last document I'll explain how I've configured the firewalls <em>The
Debian Way</em>™.</p>
]]></description>
</item>
<item>
	
	<title>Debian Squeeze, PowerPC and the Linux Containers</title>
	
	<guid>http://mixinet.net/~sto/blog/debian/20101026_squeeze_and_lxc/</guid>
	<link>http://mixinet.net/~sto/blog/debian/20101026_squeeze_and_lxc/</link>
	
	<pubDate></pubDate>
	<description><![CDATA[<p>Two kids, their really busy mother and my paid job leave me without much time
to blog or do <strong>Debian</strong> related work lately (well, at least on my free time,
I do Debian related things at work, but mostly as a user, not as a developer).</p>

<p>Anyway, a couple of weeks ago I decided it was time to upgrade my home servers
to <strong>Squeeze</strong> and I did it, but it was harder than expected.</p>

<p>At home I'm using two old laptops as servers, an old Aluminium PowerBook and
an Asus EeePC; the Asus was installed to replace an older PowerBook (a really
old one, BTW) that I was using as home server since my father gave it to me.</p>

<p>The plan was to use <a href="http://wiki.openvz.org/">OpenVZ</a> on the Asus to move all
the PowerPC services to a couple of <em>Virtual Environments</em>, but as I wanted to
migrate and change almost all the services I never got enough free time to
finish the job and when the old PowerBook hardware failed I replaced it with
another PowerBook that I wasn't using anymore, but instead of reinstalling the
machine I did a clean <strong>Lenny</strong> install using a kernel with support for
<a href="http://linux-vserver.org/">linux-vserver</a> (<em>OpenVZ</em> does not work on PowerPC)
and transformed the old machine installation (it was an Etch installation at
the time) into a <em>Virtual Private Server</em> that run on the new hardware.</p>

<p>Having both systems running I upgraded the VPS to <em>Lenny</em> and, as usually
happens, left the things as they were without consolidating the services into
only one machine, as I initially planned.</p>

<p>With this state of affairs I upgraded the <em>Asus</em> to Squeeze without much
trouble (in fact I installed a kernel without <em>OpenVZ</em> support, as the
services I use from this laptop were running on the host and not on a VE) and
did the same with the PowerPC host, but to my surprise the <em>linux-vserver</em> VPS
failed to start with a message that seemed to imply that the <em>VServer</em> support
was not enabled.</p>

<p>I should have filled a bug on the BTS then, but as I looked into how to solve
the issue I found bugs saying that the meaning of the message was that I had
no support for <em>linux-vserver</em> and I needed to start the VPS ASAP, as it was
the machine that runs my SMTP server.</p>

<p>Before doing a restore of my last backup I did some digging and found a lot of
messages recommending to move <em>OpenVZ</em> and <em>Linux-VServer</em> virtual machines to
<a href="http://lxc.sourceforge.net/">LXC</a> and decided to give it a try.</p>

<p>First I built a container on the <em>Asus</em> and it worked OK, after that I did the
same on the PowerPC, but the script failed; luckily the patch was trivial, the
problem was on the <code>/usr/lib/lxc/templates/lxc-debian</code> script; it uses <code>arch</code>
to get the <em>Debian</em> architecture, but for <code>powerpc</code> it gives <code>ppc</code> instead of
<code>powerpc</code>, so it needs to be fixed on the script (Note to self: I have to
submit bug + patch to the lxc package to fix it).</p>

<p>After creating this container and trying it I tried to boot my old VPS with a
LXC configuration:</p>

<ul>
<li><p>For the network I used a <code>veth</code> device attached to a bridge (I was already
using a local bridge and the <code>/etc/network/interfaces</code> file on the container
was right, as it was the one that I copied from the old <em>real</em> machine).</p></li>
<li><p>I also reviewed the containers' <code>/etc/rc*.d</code> contents, disabling the
hardware related services (to do that I just followed the template script
actions).</p></li>
</ul>

<p>After a couple of tries I noticed that the system was not booting because it
was missing the devices files needed; to fix it I copied the <code>/dev</code> directory
of my first LXC test and using a <code>chroot</code> I also removed the <code>udev</code> packages
from the container.</p>

<p>After that last changes the machine booted as expected and all services were
running OK.</p>

<p>To summarize, I decided to do the move to LXC and fixed the configuration to
boot the virtual machines on each restart:</p>

<ul>
<li><p>First I moved the machines to <code>/var/lib/lxc/</code>, putting each container in a
sub directory that includes the machine's <code>config</code> file and its <code>rootfs</code>.</p></li>
<li><p>Once I had that I linked the <code>/var/lib/lxc/&#036;CONTAINER/config</code> files of the
machines I want to boot on each host restart with names of the form
<code>/etc/lxc/&#036;CONTAINER.conf</code> and adjusted the <code>/etc/default/lxc</code> file
accordingly:</p></li>
<li><p>To try everything I rebooted the machine and all worked fine.</p></li>
</ul>

<p>I know that LXC is still missing some functionality (I hate the way the
container stop function kills everything instead of doing a run-level change, I
guess I'll be using <em>hacks</em> until I move to a newer kernel with the proper
support enters into <strong>Debian</strong>), but having the code on the mainline kernel is
a great bonus and the user level utilities are good enough for my home
needs... and I hope they'll arrive to a point where we'll be able to migrate
the <em>OpenVZ</em> containers at work (we are using <strong>Proxmox</strong> and the support of
the <em>OpenVZ</em> patchset is starting to worry us).</p>

<p>On my next post:</p>

<p><em>The Freak Firewall</em> or <em>The Story of a HA Firewall based on OpenBSD's pf
  running on Debian GNU/kFreeBSD hosts</em>.</p>
]]></description>
</item>
<item>
	
	<title>Debian Signs @ DebConf 9</title>
	
	<guid>http://mixinet.net/~sto/blog/debian/20090728_debian_signs/</guid>
	<link>http://mixinet.net/~sto/blog/debian/20090728_debian_signs/</link>
	
	<pubDate></pubDate>
	<description><![CDATA[<p>I have not blogged about until now, but I'm in Cáceres since last Thursday,
where <a href="http://oskuro.net/blog">jordi</a> and I came by car from Valencia to
attend the <a href="http://debconf9.debconf.org/">DebConf 9</a>.</p>

<p>I'm not doing any Debian work here, but I'm having a good time socializing
meeting and talking with a lot of people and attending some of the talks and
BOFs.</p>

<p>Yesterday we went to the <em>Valle del Jerte</em> for the Day Trip, where we did a
short walk and got to <em>Los Pilones</em>, where we saw a lot of natural pools
between the mountains where we swimmed (I loved a small cascade that was like
a natural <em>hydro massage</em> system) and stayed there for a couple of hours until
we had to go back to the bus to visit another natural pool on the village of
Jerte, that time a big one built inside the river that was also very nice.</p>

<p>Anyway, what I wanted to say is that yesterday's Day Trip was another good
example of how the Debian Project helps its users and developers; when we were
walking back from the mountains to pick the bus we found Debian people on a
cross road telling us what was the right way and after a little while we found
a Debian Sign on the floor:</p>

<p><img class="centered" src="http://mixinet.net/~sto/images/DebConf9_DayTrip_Go.jpg" alt="Day Trip Go" /></p>

<p>We followed the advice and we confirmed that it was a shortcut in our way down,
obviously installed there by someone from the Debian Project.</p>
]]></description>
</item>
<item>
	
	<title>Free Software Summer</title>
	
	<guid>http://mixinet.net/~sto/blog/free-sw/20090617_free_software_summer/</guid>
	<link>http://mixinet.net/~sto/blog/free-sw/20090617_free_software_summer/</link>
	
	<pubDate></pubDate>
	<description><![CDATA[<p>On recent years I've only been in one or two free software related conferences
per year, usually because I've been invited to go for a day or two and give a
talk.</p>

<p>The truth is that my day to day activities don't leave me enough time to
contribute or participate a little bit more in free software projects, but
this year I decided (and negotiated) that I had to go to <a href="http://debconf9.debconf.org/">Debconf</a>,
as it is the best opportunity to go to a Debian conference that I'm going to
have in the near future.</p>

<p>So this summer it is going to be a <em>free software summer</em>, the 3rd of July
I'll be giving a talk at the <a href="http://www.jornadespl.org/">Jornades de Programari Lliure</a> in Barcelona
and from the 23th to the 30th or 31th I'll be at <a href="http://debconf9.debconf.org/">Debconf 9</a> in
Cáceres.</p>

<p>In Barcelona I will talk about building IT infrastructures using free
software, explaining which programs I use, why I've choosen them and how I
configure things depending on my needs and in Cáceres I will be just listening
and exchanging gpg keys.</p>
]]></description>
</item>

</channel>
</rss>
