John Leach

Category: GNU/Linux

Redirecting outgoing mail with Postfix

Created · Last updated · GNU/Linux, Tech · 6 comments

We have a various staging deployments of our systems at Brightbox and need to test that the emails they send are correct. We have a bunch of test accounts registered with various email addresses and we wanted them all to go to our dev team, rather than the original recipient.

Rather than write support for this into our apps, we used Postfix to redirect the mail to our devs.

Continue reading “Redirecting outgoing mail with Postfix” →

LVM snapshot performance

Created · GNU/Linux, Tech · 4 comments

The Linux Logical Volume Manager (LVM) supports creating snapshots of logical volumes (LV) using the device mapper. Device mapper implements snapshots using a copy on write system, so whenever you write to either the source LV or the new snapshot LV, a copy is made first.

So a write to a normal LV is just a write, but a write to a snapshotted LV (or an LV snapshot) involves reading the original data, writing it elsewhere and then writing some metadata about it all.

This quite obviously impacts performance, and due to device mapper having a very basic implementation, it is particularly bad.  My tests show synchronous sequential writes to a snapshotted LV are around 90% slower than writes to a normal LV.

Continue reading “LVM snapshot performance” →

Lighttpd and the wonders of strace

Created · Last updated · GNU/Linux, Tech · 1 comment

I ran Lighttpd under strace today whilst debugging a problem with mod_deflate and I found two mis-configurations just from watching the system calls it was making. In case anyone is interested, this is what I found.

Firstly, I'd enabled the system.use-noatime option but I could see that it was failing to set this mode when opening a file to serve:

Continue reading “Lighttpd and the wonders of strace” →

LUG Radio Live 2007 this weekend!

Created · GNU/Linux, Personal, Tech

Remember, it's LUG Radio Live 2007 this weekend in Wolverhampton, UK.  As you can see from the schedule here, there are some cool talks by some cool people (and also a talk by me :) and a big party Saturday night.

You can pay in on the door (a measly £5).  Details of local hotels to stay in here.

Hope to see you there.

Daemontools and Ruby on Rails

Created · Last updated · GNU/Linux, Ruby on Rails, Tech · 5 comments

Dan J Bernstein's (djb) daemontools is a set of programs to help you manage unix services. It provides a flexible, secure and convenient way of starting, stopping and sending signals to background processes. Combined with his ucspi-tcp tools, it can be used as an awesome replacement to inetd (it's most often used in this way to run qmail, a secure and high-performance mta). It can be fiddly to set up and has a bit of a steep learning curve but I already use daemontools for various other stuff, so it was just natural for me to use it for Ruby on Rails deployment.

Continue reading “Daemontools and Ruby on Rails” →

Top ten quick FOSS games

Created · Last updated · GNU/Linux · 1 comment

Louisa wrote about her top ten favourite quick FOSS games.  All available in Ubuntu universe.  They're all very addictive though, so beware.  My favourite is Frozen Bubble, but Neverball looks awesome so I'll have to give that a go.  Tetrinet is great if you have some friends to play against too.

Maintenance pages status codes and Lighttpd

Created · Last updated · GNU/Linux, Networks and Firewalls, Tech · 1 comment

I've noticed a few very broken maintenance page Lighttpd config examples around, including the one on the mod_magnet documentation page. They all manage to display the maintenance page ok, but they return a HTTP 200 status code to the client, rather than the more appropriate HTTP 503 code.

As with all 500 status codes, the 503 code is an error code but it signifies a temporary error. The client should try again later (in fact you can specify how much later using the Retry-After header).

A 200 code tells the client everything is normal and OK. So the user gets your nice maintenance page telling them of a temporary outage, whereas their browser gets told that everything is fine. Now this might not be a problem for a user, but if the client is a search engine or a caching proxy then it will assume the maintenance page is the new valid content for the request.

If the Google crawler hits your site when you have the maintenance page up, it will update its search index with your "we're down for now" message, rather than your cash prizes blog content. Your page rank will drop, your fat Adsense cheque will diminish and you'll have to go back to your regular nine to five job in the city with people you don't like in clothes you hate wearing.

So, as you can see, it's important to return the correct status code. Here's how to do it with Lighty and mod_magnet:

Continue reading “Maintenance pages status codes and Lighttpd” →

Xen on Ubuntu Edgy broken - Debian to the rescue

Created · Last updated · Debian, GNU/Linux, Tech, Ubuntu

Xen LogoI found a great HOWTO on getting a Xen virtual machine up and running on Ubuntu Edgy. Unfortunately, Xen is pretty broken on Edgy. I managed to get one virtual machine running easily but on starting a second one, Dom0 panics and the whole box freezes. It's been reported on launchpad but as it's in universe I guess it's just not a priority.

Continue reading “Xen on Ubuntu Edgy broken - Debian to the rescue” →

Encrypted partitions with Ubuntu/Debian

Created · Last updated · GNU/Linux, Security, Tech, Ubuntu · 16 comments

I figured out how to set up an encrypted partition on Ubuntu the other day. There are a bunch of ways of doing it but I found this to be the simplest. It should work on Debian too, since all the relevant packages are Debian ones anyway. In my example I'm encrypting an LVM partition (logical volume), but it should work with any device, including removable USB keys (see end notes). UPDATE: This is broken in Edgy but I figured out a simple fix, see below.

Continue reading “Encrypted partitions with Ubuntu/Debian” →

IPSEC VPN problems upgrading to Ubuntu Edgy

Created · Last updated · GNU/Linux, Networks and Firewalls, Tech, Ubuntu · 1 comment

I upgraded my home gateway firewall to Edgy today in the hope of fixing some SATA problems I've been experiencing. The new Edgy kernel might help - we'll see.

Anyway, it went pretty well. Two runs (?) of apt-get dist-upgrade -u, a reboot and there I was.

Unfortunately I had two problems with my Openswan IPSEC VPNs. I'm not so sure if these count as bugs. I'll be investigating further and reporting if so. Anyway, techie details follow...

Continue reading “IPSEC VPN problems upgrading to Ubuntu Edgy” →