Hacking m0n0wall cdrom to get configs from a usb drive

From Section6wiki

Jump to: navigation, search

The default for the m0n0wall cd is to store configs in a floppy drive. For those of us who hate floppies, but want the security and ease of use booting from a cdrom can bring here's how to make it so your configs are stored on a usb pen drive (or thumb drive if you prefer).

For this example we're going to use the directory /root/m0n0wall. Feel free to change this to the directory of your choice.

Contents

Download and rip

Download the cdrom iso from [m0n0wall's site]

Now we'll mount the cdrom and copy its contents:

mdconfig -a -t vnode -f cdrom-1.11.iso
mount -t cd9660 /dev/md0 /mnt
mkdir /root/m0n0wall
cd /mnt
cp -rp boot kernel.gz mfsroot.gz /root/m0n0wall
cd /root/m0n0wall
umount /mnt
mdconfig -d -u /dev/md0
gunzip mfsroot.gz

Mount and change

Mount the mfsroot and edit it:

mdconfig -a -t vnode -f mfsroot
mount /dev/md0 /mnt
vi /mnt/etc/inc/config.inc

On about line 52 you should see this:

  $cfgdevice = $cfgpartition = "fd0";

change it to:

  $cfgdevice = $cfgpartition = "da0";

Umount and burn

Now lets unmount the mfsroot and make an image:

umount /mnt
mdconfig -d -u /dev/md0
gzip -9 mfsroot
rm boot/boot.catalog
cd /root
mkisofs -b "boot/cdboot" -no-emul-boot -A "m0n0wall CD-ROM image" \
        -c "boot/boot.catalog" -d -r -publisher "example.com" \
        -p "Your Name" -V "m0n0wall_cd" -o "m0n0wall.iso" \
        /root/m0n0wall

Burn the image to a cdrom and you'll have a cdrom that reads off of the 1st usb device it finds instead of a floppy!

Resources

Personal tools