Saturday, December 16, 2006

OpenBSD LiveCD Firewall

Over the past couple of weeks all of my research and experimentation has been leading towards a project. I have been learning how to create my own livecd firewall. Currently I am preparing an environment to create this livecd in.

First I installed a basic version of OpenBSD 4.0. Then I Downloaded the source code using cvsup:
# export PKG_PATH=
# pkg_add -v cvsup-16.1h-no_x11.tgz
# vi /root/.configs/cvsup-file


# Defaults that apply to all the collections
*default release=cvs
*default delete use-rel-suffix
*default umask=002
*default base=/usr
*default prefix=/usr
*default tag=OPENBSD_4_0
# If your network link is a T1 or faster, comment out the following line.
*default compress
# cvsup -g -L 2 cvsup-file

Once I had done that I made a partition in which to create the livecd in. First I edited the disklabel, then formatted the new partition:
# disklabel -e wd0
# newfs /dev/wd0h

Now create the directory to mount on the new partition:
# mkdir /bootcd
then edit /etc/fstab so that the partition would be mounted at boot time:
# vi /etc/fstab
/dev/wd0h /bootcd ffs rw 1 2
then rebooted

Once the system had rebooted and everything was OK I cd into /bootcd and downloaded base40.tgz and etc40.tgz and unpacked them into /bootcd:
# cd /bootcd
# tar -xZf base40.tgz
# tar -xZf etc40.tgz

At the moment I am waiting for my new kernel to compile with my needed options:
# cd /usr/src/sys/arch/i386/conf/

commented out this line:
#config bsd root on rd0a swap on rd0b and wd0b and sd0b
added this line:
config bsd root on cd0a
# config BOOTCD
# cd ../compile/BOOTCD/
# make clean && make depend && make

I can't wait to see how it works. This is so exciting. I am such a geek...