Monday, September 24, 2007

OpenBSD 4.1 Live CD

OpenBSD is an excellent choice for debugging and troubleshooting network problems as it offers a wealth of advanced functionality right out of the box:

  1. support for most hardware
  2. Layer 2 functionality: bridging, trunking, 802.1Q VLANs
  3. Layer 3 functionality: static routing, OSPF, BGP
  4. pf and altq for firewalling and QoS
  5. user land servers: dhcp, dns, httpd
I created an OpenBSD Live CD that I could just drop into any x86 computer (compatible with the GENERIC kernel) and enjoy a basic install of an OpenBSD system. I simply did a basic install of OpenBSD in my hard disk using the bsd, bsd.mp, bsd.rd, base, etc, man file sets (note no x11), and copied them to the CDROM. Minimal modification was required to ensure that /dev, /etc, /var and /usr/local were writeable. Other than this, the Live CD is identical to a real OpenBSD 4.1 install.

Steps to use this OpenBSD 4.1 Live CD:
  1. Download from: primary site, md5 (please contact me if you can help by mirroring)
  2. Decompress the obsd41_livecd.7z file using 7-Zip and burn the ISO to a CDROM. The uncompressed ISO is 183MB.
  3. Boot the target PC using the Live CD.
  4. The kernel will automatically boot with the -a flag and will prompt you for the root device location. This allows you to mount the root filesystem from any device (another reason this step exists is because there's no reliably way of auto detecting the CD you booted from). If you are booting from your first CDROM drive enter cd0a at the kernel prompt.
  5. Once booting is complete, you can login with the root account. The root account has a blank password (yes, this is intentional) so just press Enter and you'll be dropped into a root shell.
  6. Only the lo0 interface is automatically configured on boot, and all other network interfaces must be configured manually.
Features/limitations of this Live CD:
  1. The Live CD works only on x86 hardware.
  2. The Live CD contains a installation of the bsd, bsd.mp, bsd.rd, base, etc, and man file sets.
  3. The compilers, games, X11, source code, etc file sets are not installed.
  4. You cannot remove the Live CD from the CDROM drive while the Live CD is in use as the root file system is mounted directly from the CD.
  5. The Live CD has no persistent storage, so any changes you make to the system will be lost when you shutdown the system. You need to handle persistence manually.
  6. After the Live CD boots, /dev, /tmp, /var and /usr/local are mounted on writeable MFS file systems. You can use pkg_add and temporarily install packages in /usr/local. /tmp is mounted without the noexec/nosuid flags, so you can run binaries from these locations.
  7. Unlike other Live CDs, you do not have the option to install OpenBSD to your hard disk from within the Live CD. Note that however, there's nothing stopping you from formatting your disk and going through the installation process manually.
  8. The only way of customizing this Live CD, is by building your own! OpenBSD makes it really simple affair to roll your own Live CDs, and I'll be documenting this process in another blog post in the future.
Bugs:
  1. Despite all my efforts with mkhybrid, TRANS.TBL files are not hidden
  2. File permissions in the CD filesystem are wonky (dirs 555, files 444, binaries 555), but has not broken anything so far. SSH keys in /etc/ssh escape this limitation with only a warning, and this is because /etc is moved to mfs early in the boot process.

Sunday, September 09, 2007

Pavarotti dies

On 6th September 2007 Luciano Pavarotti rests in peace forever. Here is Pavarotti performing Nessun Dorma (Let no one sleep) in Paris in 1998. Bravo! Bravo!

Tuesday, July 03, 2007

Using mairix through procmail

My email provider Dream Host runs the Courier IMAP server and I primarily use Mozilla Thunderbird as my mail client. I've had numerous problems with Thunderbird's off-line IMAP support and email search that I've started looking for other solutions.

When I was using mutt as my email client, I also used mairix to index and search my emails. Mairix is a brilliant program that offers GMail like full text search of your emails. I've missed that functionality ever since, so I started thinking on how to integrate Thunderbird and mairix. After some delusional ideas about building Thunderbird extensions and wrapping mairix in a cgi script, I finally hit on the obvious: run mairix through procmail.

So I wrote a procmail rule that invokes mairix and dumps the search results in predefined IMAP folder. To search my emails in Thunderbird, I simply send myself an email with a special subject line that triggers mairix. Mairix then populates the "search" folder with search results which I access from Thunderbird.

If you have already used mairix and procmail, implementing this is a trivial task. Here is my setup in case you need some help:

Mairix:

  1. I periodically run mairix indexing from cron so that the mairix db is up to date. You can also trigger the mairix indexing process whenever an email is delivered by using a procmail recipie. If you receive a huge quantity of email the later method is not recommended as it can increase server load.
  2. Mairix supports incremental indexing, so periodically running mairix is fast. Mairix always uses the index to return search results, so having an up to date index is crucial. My 500MB of mail boxes has a 2MB mairix index database.
  3. Please read the mairix documentation for an explanation of the mairixrc file
# ~/.mairixrc
base=~/Maildir
database=~/Maildir/mairixdb
maildir=.Inbox:.Archived
mfolder=.search

Procmail:
  1. you'll need to change ME@MYDOMAIN with your own email ID so that mairix is not accidentally triggered when someone else sends you an email.
  2. subject line of the email you send needs be of the form [search] needle. Everything after [search] is passed to mairix on the command line. Please refer to the mairix documentation for a list of search terms that can be used.

# ~/.procmailrc
MAILDIR=$HOME/Maildir

SHELL=/bin/sh
# no procmail_log

# enable mairix searches through email
:0:hw
* ^From:.*ME@MYDOMAIN\.com
* ^Subject: .*\[search\] \/.*
| ~/bin/mairix $MATCH

# catch all for inbox
:0
$HOME/Maildir/

Wednesday, June 13, 2007

Clinton's at Harvard Uni Class Day

Open Culture has an interesting video of Bill Clinton speaking at Harvard University's Class Day event. A quote from the article:

... it reminds us that there may be again a day when we can look to the White House for leadership and inspiration.

Update: oculture.com link is broken. Youtube carries the same videos in 3 parts - part 1, part 2 and part 3.

I'm a huge supporter of Clinton's current humanitarian work in building a better world. Incidentally, he won the 2007 TED prize and his acceptance speech is also worth watching.

In the same way, I hope that our own President Abdul Kalam will also reach greater heights once his term in office is over and he's free of political incumbents.