Latest entries
After my followup to the Tuesday post I've received some additional comments and I'm writing this entry to close the subject... ;)
One of the comments was from Gunnar to tell me that the followup setup was the same provided by the automatic partitioner of the Debian Installer since 2007.
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 MacOS X partitions.
Anyway my followup blog entry made sense anyway, as I just wanted to comment my thoughts about the advantages and disadvantages of each partitioning schema.
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:
- Layer 1: use LVM on a physical volume,
- Layer 2: create a logical volume and format it as an encrypted volume,
- Layer 3: use LVM on top of the encrypted logical volume and put there the file systems that you want encrypted.
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).
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.
Posted Thu 26 Feb 2009 08:30:16 CETYesterday I received a mail message from a Debian user called Ekrem Erdem about my previous post, proposing a different partitioning schema that I found interesting.
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.
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.
The advantage of this setup is that there is only one pass phrase (the one used
to unlock the encrypted partition, sda4 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).
On the negative side I believe that this setup looses some flexibility:
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.
If the user wants to have multiple partitions each one can use a different pass phrase or key file.
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.
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).
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.
Posted Wed 25 Feb 2009 00:42:30 CETA couple of weeks ago I updated my Debian Sid setup on the MacBook to use disk encryption; this post is to document what I did for later reference.
The system was configured for dual booting Debian or Mac OS X using
refit and grub2 as documented on the Debian
Wiki; I don't use the Mac OS X system
much, but I left it there to be able to test things and be able to answer
questions of Mac OS X users when I have to.
The Debian installation was done using two primary partitions, one for swap
(I used a partition to be able to suspend to disk without troubles) and an
ext3 file system used as the root file system.
The plan was to use the Debian Installer to do the disk setup and recover the Sid installation from a backup once the encrypted setup was working OK.
Backup for later recovery
My first step was to install all the needed packages on the original system;
basically I verified that I had the lvm2 and cryptsetup packages
installed.
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 rsync.
My third step was to boot into Mac OS X to reduce the space assigned to it; I had a lot of free space that I didn't plan to use with Mac OS X and I thought that this was the best occasion to reassign it to the Debian file system.
Encrypted Lenny installation
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 Lenny Debian Installer, now that Lenny is out I would have used the official version.
I booted the installer and on the partition disk step I selected the manual
method; I left sda1 and sda2 as they were (the Mac OS X installation
uses them) and set up sda3 and sda4 as follows:
sda3: 256 MB, use asext3, mount point:/bootsda4: 86 GB, use as physical volume for LVM
Note that I decided to put /boot on a plain ext3 partition to be able to
use grub2 as the boot loader (if we put the kernel on an LVM logical volume
we need to use lilo as the boot loader).
Once sda4 was adjusted as LVM I entered on the LVM setup and created a LVM
Volume Group (VG) with the name debian, using sda4 as the physical volume.
Once the VG was defined I created a couple of Logical Volumes (LV):
root: 82 GBswap: 2 GB
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).
Once the LV were ready I finished with the LVM setup and went back to the partitioner to configure the Logical Volumes:
- debian-root: use as physicals volume for encryption
- debian-swap: use as pascal volume for encryption, encryption key: random
Once both encrypted volumes were ready I entered on the Configure the
encrypted volumes menu and the installer formatted the volumes for encryption
and asked for the debian-root pass phrase.
Back on the main partitioning menu I set up the debian-root_crypt encrypted
volume:
- debian-root_crypt: use as
ext3, mount point:/.
I didn't need to touch the debian-swap_crypt, it was configured
automatically as swap because I choose a random encryption key.
At this point I was finished with the partitioning; to finish I installed a minimal system and rebooted to try the system.
As I had changed the disk layout I had to re-sync the partition tables from
refit; once that was done I was able to boot from the newly installed
system.
Setting up suspend to disk
I was using s2disk to suspend the system; to test if it still worked with
the new setup I installed the uswsusp package and adjusted the resume
device on the /etc/uswsusp.conf to /dev/mapper/debian-swap_crypt.
After my first try I noticed that the resume 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.
Looking at the cryptsetup documentation I found that the solution was to use
a derived key for the swap partition instead of a random one.
The command sequence was as follows:
# 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
After executing all those commands the suspend to disk system worked as expected.
Recovering the original system
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).
To recover my old installation I backed up some files (/etc/fstab,
/etc/crypttab, /etc/uswsusp.conf and the current /boot 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 rsync again and regenerated the initrd
images of my old kernels:
update-initramfs -u -k all
After that I rebooted and everything worked as on my original installation (except for the disk encryption, of course).
Posted Sun 22 Feb 2009 00:11:52 CETI've been using Subversion and
Trac 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 Trac installations with different database
systems (SQLite3 and PostgreSQL), plugins (more than 15 on the big
servers), authentication systems (htpass files, LDAP 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).
Yesterday night, while reading Planet Debian I found a post from John Goerzen about tools to replace Trac, including the option to use Git as the project VCS.
In the post he talks about different options, mainly projects that I would
categorize as issue tracking systems (mantis, roundup, etc.), but it
also talks about Redmine, a project management
system implemented using the Ruby on Rails
framework that is similar to Trac.
As it looked interesting I downloaded, installed and executed an instance in about 15 minutes (I love the systems that support sqlite3 for this quick tests, not having to touch real database servers speeds up simple tests a lot).
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 Trac to do lightweight project management.
I evaluated ]project-open[ to use it together with
Trac for our internal project management tasks, mainly because we miss
important features from Trac, like having clean systems to view the tasks of
a user in all projects or a clean way to do the project planning using
tickets and gantt charts. Of course there are ways to do it, but the
plugins I've tried are not as good and simple as I would like.
The problem with the use of ]project-open[ 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 OpenACS and
TCL.
In fact we still don't have ]po[ 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.
The good thing about trying Redmine is that if we don't end up using it at
least I can take the most of this opportunity by looking at Ruby on Rails
and the Ruby Programming Language, at least
from the administration side, as I have never looked at it seriously.
The problem
On a couple of Debian Etch systems we have a plone-site that is published using a backport of the nginx web server.
The Zope instance is running on the standard port and serves the Plone
contents under the /plone path.
Initially we were publishing the site to the external world using an https
site served by nginx using the following entry on the configuration:
location /plone/ {
proxy_pass http://plone:9673;
include /etc/nginx/proxy.conf;
}
The proxy.conf contents are quite standard:
# proxy.conf
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 0;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
With this settings we see the /plone contents using the same path that is
used by the Zope instance, but after testing we have decided to change the
/plone path and server the contents under the /web path.
The Wrong Solution
The fist option I though about was quite simple, rename the Zope's plone object to web.
Seems reasonable and simple for someone without Zope experience (I don't administer the internals of the Zope/Plone site), but now I know that it is a very big mistake, because renaming objects in Zope in not cheap, as it implies that the server has to modify all the contents of the renamed object and the operation can take a very long time.
With my ignorance I tried to rename the plone object using the Zope
administrative interface and after a minute or so I cancelled the page
loading that was running on my browser, thinking that I had cancelled the
rename operation.
To make a long story short I'll tell you that the operation was still running and after several hours the folder was renamed (in fact I noticed when the good solution broke, as I had already solved the problem using the next method), but something went wrong and part of the site functionality was broken... the final solution to the debacle has been to recover a backup of the Zope instance older than the rename operation and continue from that copy.
The Right Solution (TM)
It seems that Zope has a couple of systems to do Virtual
Hosting
and the best option is the use of the product called Virtual Host Monster,
a weird and confusing system (IMHO, of course), that does the job once the
right configuration settings are in place.
The best solution to our problem was to modify the requests done by the
reverse proxy without touching anything on the Plone site (the original one
already had a Virtual Host Monster object installed and that was the only
thing that we needed to add).
The nginx configuration for the new /web path is the following:
location /web/ {
proxy_pass http://plone:9673/plone/VirtualHostRoot/_vh_web/;
include /etc/nginx/proxy.conf;
}
With this change, when the user asks for anything under the /web/ path the
Zope server gets the contents traversing the /plone object and adding to
it the elements that appear after the VirtualHostRoot component, ignoring
components that start with the _vh_ prefix (the protocol and host name of
the requests are not modified, as we did not touched that).
Once the object is found, the server rewrites the URLs included on the HTML
files using the path components that appear after the VirtualHostRoot one,
including the suffix of the components that start with the prefix _vh_.
For example, when the Zope server receives a request for an URL like:
http://plone:9673/plone/VirtualHostRoot/_vh_web/home
it publishes the content found on:
http://plone:9673/plone/home
but the HTML files returned assume that their base URL is:
http://plone:9673/web/home
Posted Thu 28 Feb 2008 03:11:38 CET
List of all entries
Encrypting a Debian GNU/Linux installation (take 3)
Posted Thu 26 Feb 2009 08:30:16 CET
Encrypting a Debian GNU/Linux installation (followup)
Posted Wed 25 Feb 2009 00:42:30 CET
Encrypting a Debian GNU/Linux installation on a MacBook
Posted Sun 22 Feb 2009 00:11:52 CET
Redmine
Posted Sat 01 Mar 2008 09:59:45 CET
Tips & Tricks: plone, nginx and path rewriting
Posted Thu 28 Feb 2008 03:11:38 CET
Pending sysadmin posts
Posted Fri 15 Jun 2007 00:55:32 CEST
Spammers
Posted Fri 11 Aug 2006 08:42:40 CEST
Moved to ikiwiki
Posted Wed 09 Aug 2006 22:51:54 CEST
ikiwiki
Posted Mon 15 May 2006 11:25:00 CEST
Desktop Environments and Window Managers
Posted Tue 25 Oct 2005 15:02:15 CEST
zsh and baz
Posted Fri 19 Aug 2005 12:25:55 CEST
Comments re-enabled
Posted Sat 28 May 2005 21:09:31 CEST
shfs and hardware detection
Posted Fri 07 Jan 2005 00:44:00 CET
New year, new server
Posted Wed 05 Jan 2005 01:20:03 CET
Going Wireless
Posted Wed 14 Jul 2004 14:30:31 CEST