<?xml version="1.0"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>About System Administration</title>
<link>http://mixinet.net/~sto/blog/sysadmin/</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/sysadmin/../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>Encrypting a Debian GNU/Linux installation (take 3)</title>
	
	<guid>http://mixinet.net/~sto/blog/sysadmin/20090226_macbook_cryptsetup_take_3/</guid>
	<link>http://mixinet.net/~sto/blog/sysadmin/20090226_macbook_cryptsetup_take_3/</link>
	
	<pubDate></pubDate>
	<description><![CDATA[<p>After my <a href="http://mixinet.net/~sto/blog/sysadmin/./20090225_macbook_cryptsetup_followup/">followup</a> to the Tuesday 
<a href="http://mixinet.net/~sto/blog/sysadmin/./20090222_macbook_cryptsetup/">post</a> I've received some additional comments
and I'm writing this entry to close the subject... ;)</p>

<p>One of the comments was from <a href="http://gwolf.org/">Gunnar</a> to tell me that the
<em>followup</em> setup was the same provided by the automatic partitioner of the
<a href="http://www.debian.org/devel/debian-installer/">Debian Installer</a> since 2007.</p>

<p>I was unaware of that because until some weeks ago I never tried to install a
system with encryption support and when I did it on my laptop I used the
manual setup because I wanted to keep the <strong>MacOS X</strong> partitions.</p>

<p>Anyway my <a href="http://mixinet.net/~sto/blog/sysadmin/./20090225_macbook_cryptsetup_followup/">followup</a> blog entry made
sense anyway, as I just wanted to comment my thoughts about the advantages and
disadvantages of each partitioning schema.</p>

<p>I also received a couple of messages proposing the use of three layers to
keep the flexibility of the original setup and the simplicity of the second;
the setup is as follows:</p>

<ul>
<li><em>Layer 1</em>: use LVM on a physical volume,</li>
<li><em>Layer 2</em>: create a logical volume and format it as an encrypted volume,</li>
<li><em>Layer 3</em>: use LVM on top of the encrypted logical volume and put there the
file systems that you want encrypted.</li>
</ul>

<p>With the LVM at the lower level you get the advantages of my setup (mix
encrypted and unencrypted partitions, the crypted volume can use multiple
physical volumes, etc.) and the advantages of the second setup (only one key
for all the encrypted file systems).</p>

<p>I believe that this setup is a little too much for a laptop, but can be a good
option if you need encrypted file systems on a server.</p>
]]></description>
</item>
<item>
	
	<title>Encrypting a Debian GNU/Linux installation (followup)</title>
	
	<guid>http://mixinet.net/~sto/blog/sysadmin/20090225_macbook_cryptsetup_followup/</guid>
	<link>http://mixinet.net/~sto/blog/sysadmin/20090225_macbook_cryptsetup_followup/</link>
	
	<pubDate></pubDate>
	<description><![CDATA[<p>Yesterday I received a mail message from a Debian user called Ekrem Erdem
about my previous <a href="http://mixinet.net/~sto/blog/sysadmin/./20090222_macbook_cryptsetup/">post</a>, proposing a different
partitioning schema that I found interesting.</p>

<p>The basic idea is to swap the order of the technologies, that is, use LVM on
top of an encrypted partition instead of encrypting logical volumes.</p>

<p>I never thought about this schema because I always use LVM on servers and that
is one of the fist things I setup (just after software RAID-1, if the machine
has two hard drives); when I was evaluating how to setup my system for
encryption I started with the LVM setup and never looked back.</p>

<p>The advantage of this setup is that there is only one pass phrase (the one used
to unlock the encrypted partition, <code>sda4</code> in my case), eliminating the need of
derived keys (i. e. my swap setup) or key files (I use them to mount snapshots
of the encrypted partition non interactively).</p>

<p>On the negative side I believe that this setup looses some flexibility:</p>

<ul>
<li><p>On my original model crypted and unencrypted partitions can coexist on the
same volume group, while the new setup requires a different volume group
for unencrypted volumes.</p></li>
<li><p>If the user wants to have multiple partitions each one can use a different
pass phrase or key file.</p></li>
<li><p>If a logical volume is expanded through multiple physical volumes the new
setup requires a key for each physical volume, while the original setup only
needs one key.</p></li>
</ul>

<p>Anyway if the plan is to encrypt all the file systems on a laptop the proposed
setup is simpler and, IMHO, as safe as my configuration (remember that my keys
are related).</p>

<p>I'm not going to change my setup now (it works great), but I'll probably try
this one in the future if I need an encrypted setup on a different machine.</p>
]]></description>
</item>
<item>
	
	<title>Encrypting a Debian GNU/Linux installation on a MacBook</title>
	
	<guid>http://mixinet.net/~sto/blog/sysadmin/20090222_macbook_cryptsetup/</guid>
	<link>http://mixinet.net/~sto/blog/sysadmin/20090222_macbook_cryptsetup/</link>
	
	<pubDate></pubDate>
	<description><![CDATA[<p>A couple of weeks ago I updated my <strong>Debian Sid</strong> setup on the <strong>MacBook</strong> to
use disk encryption; this post is to document what I did for later reference.</p>

<p>The system was configured for dual booting <strong>Debian</strong> or <strong>Mac OS X</strong> using
<code>refit</code> and <code>grub2</code> as documented on the <a href="http://wiki.debian.org/MacBook/">Debian
Wiki</a>; I don't use the <strong>Mac OS X</strong> system
much, but I left it there to be able to test things and be able to answer
questions of <strong>Mac OS X</strong> users when I have to.</p>

<p>The Debian installation was done using two primary partitions, one for <em>swap</em>
(I used a partition to be able to suspend to disk without troubles) and an
<code>ext3</code> file system used as the <em>root</em> file system.</p>

<p>The plan was to use the <strong>Debian Installer</strong> to do the disk setup and recover
the Sid installation from a backup once the encrypted setup was working OK.</p>

<h2>Backup for later recovery</h2>

<p>My first step was to install all the needed packages on the original system;
basically I verified that I had the <code>lvm2</code> and <code>cryptsetup</code> packages
installed.</p>

<p>The second step was to backup the root file system; to do it I changed to
run level 1 and copied the files to an external USB disk using <code>rsync</code>.</p>

<p>My third step was to boot into <strong>Mac OS X</strong> to reduce the space assigned to
it; I had a lot of free space that I didn't plan to use with <strong>Mac OS X</strong> and
I thought that this was the best occasion to reassign it to the Debian
file system.</p>

<h2>Encrypted Lenny installation</h2>

<p>Now the machine was ready for the installer. As I formatted the system a couple
of weeks ago I used a daily build of the <em>Lenny Debian Installer</em>, now that
<strong>Lenny</strong> is out I would have used the official version.</p>

<p>I booted the installer and on the partition disk step I selected the manual
method; I left <code>sda1</code> and <code>sda2</code> as they were (the <strong>Mac OS X</strong> installation
uses them) and set up <code>sda3</code> and <code>sda4</code> as follows:</p>

<ul>
<li><code>sda3</code>: 256 MB, use as <code>ext3</code>, mount point: <code>/boot</code></li>
<li><code>sda4</code>: 86 GB, use as physical volume for LVM</li>
</ul>

<p>Note that I decided to put <code>/boot</code> on a plain <code>ext3</code> partition to be able to
use <strong>grub2</strong> as the boot loader (if we put the kernel on an LVM logical volume
we need to use <code>lilo</code> as the boot loader).</p>

<p>Once <code>sda4</code> was adjusted as LVM I entered on the <code>LVM setup</code> and created a LVM
Volume Group (VG) with the name <code>debian</code>, using <code>sda4</code> as the physical volume.</p>

<p>Once the VG was defined I created a couple of Logical Volumes (LV):</p>

<ul>
<li><code>root</code>: 82 GB</li>
<li><code>swap</code>: 2  GB</li>
</ul>

<p>I left some space unallocated to be able to create LVM snapshots (I use them
to do backups, I'll post about it on the next days).</p>

<p>Once the LV were ready I finished with the LVM setup and went back to the
partitioner to configure the <em>Logical Volumes</em>:</p>

<ul>
<li>debian-root: use as physicals volume for encryption</li>
<li>debian-swap: use as pascal volume for encryption, encryption key: random</li>
</ul>

<p>Once both encrypted volumes were ready I entered on the <em>Configure the
encrypted volumes menu</em> and the installer formatted the volumes for encryption
and asked for the  <code>debian-root</code> pass phrase.</p>

<p>Back on the main partitioning menu I set up the <code>debian-root_crypt</code> encrypted
volume:</p>

<ul>
<li>debian-root_crypt: use as <code>ext3</code>, mount point: <code>/</code>.</li>
</ul>

<p>I didn't need to touch the <code>debian-swap_crypt</code>, it was configured
automatically as <em>swap</em> because I choose a random encryption key.</p>

<p>At this point I was finished with the partitioning; to finish I installed a
minimal system and rebooted to try the system.</p>

<p>As I had changed the disk layout I had to <em>re-sync</em> the partition tables from
<code>refit</code>; once that was done I was able to boot from the newly installed
system.</p>

<h2>Setting up suspend to disk</h2>

<p>I was using <code>s2disk</code> to suspend the system; to test if it still worked with
the new setup I installed the <code>uswsusp</code> package and adjusted the <code>resume
device</code> on the <code>/etc/uswsusp.conf</code> to <code>/dev/mapper/debian-swap_crypt</code>.</p>

<p>After my first try I noticed that the <em>resume</em> step failed with the encrypted
swap partition because it was using a random key, which means that the swap
contents are unrecoverable after a reboot.</p>

<p>Looking at the <code>cryptsetup</code> documentation I found that the solution was to use
a <em>derived key</em> for the swap partition instead of a <em>random</em> one.</p>

<p>The command sequence was as follows:</p>

<pre><code># disable swap
swapoff -a
# close encrypted volume
cryptsetup luksClose debian-swap_crypt
# change the swap partition setup on the /etc/crypttab file
sed -e -i 's%^debian-swap.*%debian-swap_crypt /dev/mapper/debian-swap debian-root_crypt cipher=aes-cbc-essiv:sha256,size=256,swap,hash=sha256,keyscript=/lib/cryptsetup/scripts/decrypt_derived,swap%' /etc/crypttab
# open the encrypted volumes with the new setup
/etc/init.d/cryptdisks start
# enable swap
swapon -a
# update the initrd image
update-initramfs -u
</code></pre>

<p>After executing all those commands the suspend to disk system worked as
expected.</p>

<h2>Recovering the original system</h2>

<p>If I were going to reinstall the system completely I would have finished here,
but in my case I wanted to recover my original system setup (except the
minimal changes required to use the encrypted passions, of course).</p>

<p>To recover my old installation I backed up some files (<code>/etc/fstab</code>,
<code>/etc/crypttab</code>, <code>/etc/uswsusp.conf</code> and the current <code>/boot</code> contents to be
able to boot in case of failure with my old kernel) from the current
installation, after that I recovered all the files from the initial backup
(except the ones just saved) using <code>rsync</code> again and regenerated the initrd
images of my old kernels:</p>

<pre><code>update-initramfs -u -k all
</code></pre>

<p>After that I rebooted and everything worked as on my original installation
(except for the disk encryption, of course).</p>
]]></description>
</item>
<item>
	
	<title>Redmine</title>
	
	<guid>http://mixinet.net/~sto/blog/sysadmin/20080301_redmine/</guid>
	<link>http://mixinet.net/~sto/blog/sysadmin/20080301_redmine/</link>
	
	<pubDate></pubDate>
	<description><![CDATA[<p>I've been using <a href="http://subversion.tigris.org/">Subversion</a> and
<a href="http://trac.edgewall.org/">Trac</a> for some years now, and I have encouraged
its use at work since the last couple of years, with the undesired effect of
having to maintain four different <code>Trac</code> installations with different database
systems (<code>SQLite3</code> and <code>PostgreSQL</code>), plugins (more than 15 on the big
servers), authentication systems (<code>htpass</code> files, <code>LDAP</code> and a database based
system) and tons of projects published (two internal servers have 64 and 16
projects, one of the client system has 33 projects and there is only one
single project installation, but it is living at a client's system).</p>

<p>Yesterday night, while reading <a href="http://planet.debian.org/">Planet Debian</a> I
found a <a href="http://changelog.complete.org/posts/694-Trac-Git.html">post</a> from
John Goerzen about tools to replace <a href="http://trac.edgewall.org/">Trac</a>,
including the option to use <a href="http://git.or.cz/">Git</a> as the project
<a href="http://en.wikipedia.org/wiki/Version_control_system">VCS</a>.</p>

<p>In the post he talks about different options, mainly projects that I would
categorize as <em>issue tracking systems</em> (<em>mantis</em>, <em>roundup</em>, etc.), but it
also talks about <a href="http://www.redmine.org/">Redmine</a>, a project management
system implemented using the <a href="http://www.rubyonrails.org/">Ruby on Rails</a>
framework that is similar to <code>Trac</code>.</p>

<p>As it looked interesting I downloaded, installed and executed an instance in
about 15 minutes (I love the systems that support
<a href="http://www.sqlite.org/">sqlite3</a> for this quick tests, not having to touch
real database servers speeds up simple tests a lot).</p>

<p>I played a little bit with the system and I believe that I will spend some
more time testing it at work next week, as it looks quite promising; the
standard version has almost all the features I'm interested in without the
need to install additional plugins and it can do most of the things I was
missing from <code>Trac</code> to do lightweight <em>project management</em>.</p>

<p>I evaluated <a href="http://project-open.org">]project-open[</a> to use it together with
<code>Trac</code> for our internal <em>project management</em> tasks, mainly because we miss
important features from <code>Trac</code>, like having clean systems to view the tasks of
a user in all projects or a clean way to do the project planning using
<em>tickets</em> and <em>gantt charts</em>. Of course there are ways to do it, but the
plugins I've tried are not as good and simple as I would like.</p>

<p>The problem with the use of <code>]project-open[</code> is that I don't really like it
for us, as it has tons of features that I feel we don't need nor will use and,
on a first try, the system seemed difficult to deploy and maintain, probably
because my lack of knowledge about <a href="http://openacs.org/">OpenACS</a> and
<a href="http://www.tcl.tk/">TCL</a>.</p>

<p>In fact we still don't have <code>]po[</code> running at work because I was unable to to
integrate the authentication system with our LDAP server on my first tries
and have had no time to investigate further since then.</p>

<p>The good thing about trying <code>Redmine</code> is that if we don't end up using it at
least I can take the most of this opportunity by looking at <code>Ruby on Rails</code>
and the <a href="http://www.ruby-lang.org/en/">Ruby Programming Language</a>, at least
from the administration side, as I have never looked at it seriously.</p>
]]></description>
</item>

</channel>
</rss>

