Making Firefox 3 module
From OWASP Live CD 2008
Get the binary for Firefox 3
Go to the Mozilla website and there's usually a link to download Firefox on the front page. We'll need the latest one for Linux which is firefox-3.0.5.tar.bz2 currently.
Do an install inside a running OWASP Live CD
This is the easy part. First, get a list of what the file system looks like before the install, then put the Firefox directory where we want to since its self-contained:
# tar -xjvf firefox-3.0.5.tar.bz2 # find / > pre-ff # mv firefox firefox3 # mv firefox3 /opt/owasp # cd /opt/owasp/firefox3 # ./firefox
Not only will that test that Firefox is working but it will create any directories needed by Firefox that don't exist after a fresh install.
# find / > post-ff
# diff pre-ff post-ff > diff-ff
# cat diff-ff | grep changes | grep -v "/root/firefox" > install-firefox
# vi ff-install
[remove any cruft and modify to copy the installed files to /root/fakeroot]
# cat ff-install
mkdir -p /root/fakeroot/opt/owasp
cp -a /opt/owasp/firefox3 /root/fakeroot/opt/owasp
mkdir -p /root/fakeroot/root
cp -a /root/.mozilla /root/fakeroot/root
# chmod u+x install-ff
# ./install-ff
Now we have a good start for the module.
Create the needed directories in fakeroot
Eventually, we'll use dir2lzm to make the module, so lets get the directories created that we need:
# mkdir -p ./fakeroot/usr/bin # mkdir -p ./fakeroot/usr/share/aplications
Create and put the module's files into the fakeroot directory
Next, well need a script to start Firefox in fakeroot/usr/bin. This one is very easy:
# vi fakeroot/usr/bin/firefox [create script] # cat fakeroot/usr/bin/firefox #!/bin/sh cd /opt/owasp/firefox3 ./firefox "$@"
Now we need to create a menu item for Firefox:
# vi fakeroot/usr/share/applications/firefox3.desktop [create the file] $ cat fakeroot/usr/share/applications/firefox3.desktop [Desktop Entry] Categories=Application;Network Comment=Firefox Encoding=UTF-8 Exec=firefox GenericName=Firefox 3 Icon=/usr/share/pixmaps/firefox3-icon.png MimeType= Name=Nice web browser Type=Application X-KDE-StartupNotify=True X-KDE-SubstituteUID=false
The icon came with the install so lets move it to where we want it:
# cp /opt/owasp/firefox3/icons/mozicon128.png fakeroot/usr/share/pixmaps/firefox3-icon.png
Nows the time to add any extra little bits. I like to set the home page to OWASP and set a few bookmarks. All these changes will be made in /root/.mozilla so you just have to move that into fakeroot/
# rm -rf fakeroot/root/.mozilla # cp -a /root/.mozilla fakeroot/root/
Everything is in place to create the modules, a quick final check:
find fakeroot fakeroot/ fakeroot/opt fakeroot/opt/owasp fakeroot/opt/owasp/firefox3 ...
Generate the .lzm module
This is the easy part.
$ ./dir2lzm ./fakeroot firefox-3.0.5.lzm
Add the modules to the ISO build directory
Also cake
$ cp -i firefox-3.0.5.lzm ../contents/slax/base/ $ chmod 775 ../contents/slax/base/firefox-3.0.5.lzm
Test the new module
I like scp'ing the new modules into a running Live CD and using the Module Manager to Add modules to a running system. I typically have the Live CD running in a VM while I create modules so its already up and ready.
You can also gen a new ISO and run it in a VM of your choice.
$ cd ../contents/slax/ $ ./make_iso.sh /home/mtesauro/isos/new-owasp.iso
If anything doesn't work as expected, make the changes needed to ./fakeroot and try again.
Clean up and archive
Once you've got a working module, lets clean up a bit.
$ $ mkdir ./completed_modules/firefox $ mv firefox-3.0.5.lzm ./completed_modules/firefox/ $ mv temp/firefox-3.0.5.tar.bz2 ./completed_modules/firefox/ $ rm -rf ./temp/*
I usually delete anything under ./fakeroot also.
$ rm -rf ./fakeroot/*

