The REAL roots of Nagios

That’s why i love flickr


Nagios & Ethan


Nagios & Ethan

No Comment :)

· 2008/02/21 01:29 · Thomas Halinka

Howto Gain Access to blocked Sites

Are you tired of being blocked by your school or office or are you just sitting in Germany like mine and want to access www.google.com?

This proxy will help you get past any blocked sites at school or blocked sites at work and allow you to surf wherever you want.

To use it, simply go to

TrollProxy

and type in the URL of the blocked site, and it will now allow you to access the site.

Howto create your own Meta.deb-Package

I hate the kind of howto that shows you steps you can blindly follow. I’d rather help you to learn. But I’ll compromise and so you can blindly follow this howto 8-)

Since .debs are, essentially, snapshots of the installed program as seen from the root directory in an .ar archive with a little metadata, you can start by making an empty package jail with

  mkdir -p package/DEBIAN

package/ is the root of the jail; DEBIAN/ is a directory that contains any information the Debian packaging tools will need to produce the package. For a metapackage, you’ll need only one file: control.
Since Ubuntu has something called “ubuntu-xen-server” we will produce our own Meta-Package for etch.

Package: xenserver
Essential: no
Priority: extra
Section: metapackages
Maintainer: Thomas Halinka <thohal@linuxfellaz.net>
Architecture: i386
Version: 1
Depends: xen-linux-system-2.6.18-6-xen-vserver-686, xen-tools, libc6-xen, bridge-utils, pciutls
Description: One Step 2 XEN
 This is just a product of lazyness

Once you’ve written your control file, use the command

  dpkg-deb -b package xen-server.deb

To build the metapackage. dpkg-deb comes standard with Ubuntu and Debian, so don’t worry about fetching that package. You can find more information about building packages with

man dpkg-deb

After creating your first package just install it with the following command

dpkg -i xenserver.deb

Have Fun creating your own packages and upload them to Packages.LinuxFellaz.net

Howto create your own Multi-boot DVD

If you’re a IT expert, you can’t rest in peace unless you have the right set of tools and know how to use them to assess your IT Assett. So i am providing a little Step-by-Step Howto to create a custom multi-boot DVD with this issue. In the end you can just pop it into your DVD drive and set up your BIOS to boot from it. You’ll get a menu from which you can choose to run any of them, namely Auditor, grml, inset oder any other Linux-Live-Distro.

Sounds exciting, doesn’t it? So try it out yourself.

Prerequisites

You need a machine running Linux with at least 10 GB of free disk space, a DVD writer to burn the final DVD ISO, and ISO images of all the Live Linux distros that you want to compile on the DVD. For creating this DVD we won’t use any third-party or paid applications such as MagicISO or EasyBoot. Instead we will use the standard, GNU tool called isolinux.

First create a folder for each live distro you have. For instance, if you are creating a DVD for Auditor, grml, and Inset, create three folders with the name auditor, grml and inset. Then mount the ISOs of the live distros to these folders by issuing:

# mount -o loop /live-distro.iso /blank-folder 

So if your are mounting the ISO of grml to a blank folder named grml, you have to run:

# mount -o loop grml_1.0.iso /grml

This should make all content of the ISOs available to those blank folders. As most CDs are based either on Knoppix or one of its derivatives, you will find the structure of the CDs very similar. You will find two folders-isolinux and KNOPPIX. The folder name KNOPPIX can vary and if it does, it is good because it will reduce some of your work. Now lets try to understand what these folders have.

isolinux: This folder contains all files that are needed for booting the distro. For instance, it will surely have the following four files-isolinux.bin (the bootloader binary file), isolinux.cfg (the file which contains all the configurations and settings), miniroot.gz (this file has a preliminary ramfs image which has the file called linuxrc that is responsible for the ‘init’ process), and vmlinuz (the Linux kernel file). We’ll primarily deal with these four files only.

KNOPPIX: It contains the actual file system image that you will see when the system boots up. The image file is generally called knoppix and is an ramfs file system.

Creating the DVD structure

Let’s start building our DVD. For this, you first have to create a blank folder and name it dvdroot. Now ‘cd’ into the folder and create a folder called isolinux inside it. Copy isolinux. bin, boot.msg and isolinux.cfg from any of the distros here. Next, one by one copy the miniroot and vmlinuz file from each distro’s isolinux folder to the /dvdroot/isolinux folder and rename them so that you can identify which miniroot.gz and vmlinuz file belongs to which distro. So for example, if you are copying the files from auditor, rename miniroot.gz as miniaud.gz and vmlinuz as vmlinux.aud. You can call it whatever you want but remember that the name should not exceed eight characters and the extension should not exceed three characters else isolinux won’t be able to recognize the files while booting. Now after you have copied all files, you should have as many vmlinuz and miniroot.gz into your /dvdroot/isolinux folder as many Live distros you are planning to combine into the DVD.

Modifying the isolinux.cfg

Now open the /dvdroot/isolinux/isolinux.cfg file into any word processor and add the boot parameters for all the distros. The boot parameter should look something like this.

LABEL auditor
KERNEL vmlinuz.aud
APPEND ramdisk_size=100000 init=/etc/init lang=de apm=power-off vga=791 initrd=miniaud.gz nomce quiet  
BOOT_IMAGE=knoppix

You’ll get this screen after booting from the multi-boot DVD. Type the name of the distro you want to boot into and hit Enter

Here LABEL defines the name you will pass to call the distro from the boot option of the DVD. KERNEL defines the name of the kernel it will be using for the distro, and ‘initrd’ specifies the name of the miniroot.gz file, which in this case (auditor) is miniaud.gz. If the following set of parameters causes any problem and doesn’t let the distro boot, go to the folder where you have mounted the actual ISO of the distro and open the /isolinux/isolinux.cfg file. Copy the default parameter from there and paste it to the isolinux.cfg file.

Copying the ramfs

Now you have to copy all the main file system images for each and every live distro to your dvdroot folder. But there will be one problem you will face. In most cases, the name of the file system image and the folder where it resides will be same and that will be /KNOPPIX/knoppix. But, you can’t have more than one file with the same name in a folder. So create a folder for each distro in your dvdroot. For example, if you are adding grml then create a folder grml into your /dvdroot/ folder. Now copy the file system image file mostly called ‘knoppix’ from each distro’s /KNOPPIX folder to the folders you have created for them. Say for grml, you have to copy its /KNOPPIX/knoppix file to the /dvdroot/grml.

Modifying miniroot

Now that you have renamed the folder that contains the file system image, open and modify the linuxrc file for each and every distro. That is, you have to unzip, mount, modify, unmount and gzip all the miniroot.gz files. How is this done? We assume that we are going to modify the miniroot file of Auditor. So the commands will look something like this.

# cd /dvdroot/isolinux
# gunzip miniaud.gz
# mkdir /testmount
# mount -o loop miniaud /testmount

Now go to the /testmount folder and open up the file called linuxrc and search for the line that says

KNOPPIX_DIR="KNOPPIX"

Replace “KNOPPIX” with the folder name, which you have given for the distro. For Auditor, the line will be:

KNOPPIX_DIR="Auditor"

Now save the file and exit and run the following commands to recreate the miniroot.gz file.

# cd /
# umount /testmount
# cd /dvdroot/isolinux
# gzip miniaud

And you are done with the major task and you are just left to give some finishing touch before you create the ISO of the DVD. By this, we mean that you have to modify the boot.msg file so that it can reflect the labels for booting the distros at the DVD boot prompt. For this, open the boot.msg and enter the text labels that you want on the screen. For example, you should have something like this in your boot.msg file-“Type auditor at the boot prompt to boot the machine with Auditor”.

Making the ISO

The command syntax needed to start the ISO making process is pretty long. To run the command, first go to the /dvdroot folder and type in

# mkisofs –r –N –ldots –d –D –J –V “Multiboot DVD” -b isolinux/isolinux.bin –c isolinux/boot.cat –no-emul-boot –boot-load-size 4 –boot-info-table –x lost+found –o /multiboot.iso .

Now use any of your favourite DVD burning program to burn the ISO and enjoy.

How-To to make a diskless Debian Etch workstation

This how-to assumes the client and server are already set up with Debian Etch, with the client set up on a single root partition. In this example, 192.168.178.4 is the server, while 192.168.178.1 is the router.

First we need to install the following packages on the server:

# apt-get install dhcp3-server tftp-hpa syslinux nfs-kernel-server initramfs-tools pxe atftpd

Set up tftp boot

Create the /tftpboot and start populating it with something like:

# mkdir -p /tftpboot/pxelinux.cfg
# cp /usr/lib/syslinux/pxelinux.0 /tftpboot/
# cp /boot/vmlinuz-2.6.18-5-686 /tftpboot/

Replace vmlinuz-2.6.18-5-686 with the kernel you’re using.

Configure the tftp service to provide access to /tftpboot by editing /etc/inetd.conf. Make sure the line starting with “tftp” ends with "/tftpboot”.

# vim /etc/inetd.conf

It should look something like:

tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tft pd /tftpboot

Next we need to restart the tftp service with:

# /etc/init.d/inetd restart

and create a net-bootable initrd image with:

cd /etc/initramfs-tools/
cp initramfs.conf initramfs.conf.originalbackup
vi initramfs.conf
mkinitramfs -o initrd.img.netboot
mv initrd.img.netboot /tftpboot/

When editing initramfs.conf, you want to change the BOOT line from “BOOT=local” to “BOOT=nfs”. After creating this image, you may change the BOOT line back to local.

Create a PXE config file /tftpboot/pxelinux.cfg/default. If you know the workstation’s MAC address, name the file 01-aa-bb-cc-dd-ee-ff where aabbccddeeff is the MAC address. (You’ll need to name the files like this or by IP address in hex if you’re setting up more than one diskless workstation.) Here’s an example:

LABEL linux
KERNEL vmlinuz-2.6.18-5-686
APPEND root=/dev/nfs initrd=initrd.img.netboot nfsroot=192.168.178.4:/mnt/hda5/thohal ip=dhcp rw

You’ll want to put your server’s IP address in and your desired location of the workstation’s OS.

Setting up DHCP-Service

First, deactivate any DHCP service on your Network. Then configure DHCP service (dhcpd) on your server with:

# vim /etc/dhcp3/dhcpd.conf
# /etc/init.d/dhcp3-server restart

Make sure to include this line at the top:

# next-server 192.168.178.4;

Without this line, the client will hang on trying to load the pxe config file.

You’ll need to insert lines to the file to configure assigned addresses. This entry will set up dynamic addresses:

default-lease-time 600;
max-lease-time 7200;

option domain-name "mylan";
option domain-name-servers 192.168.178.1;
option routers 192.168.178.1;
subnet 192.168.178.0 netmask 255.255.255.0 {
range 192.168.178.100 192.168.178.199;
  filename "/tftpboot/pxelinux.0";
}

This entry will set up a static address. You’ll need to know the MAC address–for example, by booting up a liveCD and running “ifconfig -a” as root.

host thohal {
  hardware ethernet 00:14:2a:ef:ea:07;
  fixed-address thohal.mylan;
  filename "/tftpboot/pxelinux.0";
}

Note that this assumes the address of thohal.mylan is defined in /etc/hosts. You can replace it with a numerical IP address.

Setting up NFS

Create the nfs share on the server with:

# mkdir /mnt/hda5/thohal
# vim /etc/exports
# exportfs -rv

When editing /etc/exports, you want to create this entry:

/mnt/hda5/thohal thohal.mylan(rw,async,no_root_squash)

Note that this assumes the address of thohal.mylan is defined in /etc/hosts. You can replace this with a numerical IP address. You can also replace it with “*” if you don’t mind any machine on the LAN to have access.

Copy over the files by running the following ON THE CLIENT:

mkdir /mnt/yuki
mount -tnfs -onolock 192.168.178.4:/mnt/hda5/thohal /mnt/thohal
cp -axv /. /mnt/thohal/.
cp -axv /dev/. /mnt/thohal/dev/.

Now, back on the server, modify the files to make them suitable for diskless netbooting. Edit /mnt/hda5/thohal/etc/network/interfaces and comment out any lines which automatically bring up eth0 (like “auto eth0” or “allow-hotplug eth0”). Just leave a line like “iface eth0 inet dhcp”. The network interface eth0 will have already been brought up by net-booting, and we don’t want to reset it.

Edit /mnt/hda5/thohal/etc/fstab to look something like this:

###/dev/hda1       /               ext3    noatime,errors=remount-ro 0       1
###/dev/hda5       /mnt/hda5       ext3    noatime         0       2
###/dev/hda6       none            swap    sw              0       0

/dev/nfs        /               nfs     defaults 0 0
none            /tmp            tmpfs   defaults 0 0
none            /var/run        tmpfs   defaults 0 0
none            /var/lock       tmpfs   defaults 0 0
none            /var/tmp        tmpfs   defaults 0 0
none            /media          tmpfs   defaults 0 0

Comment out any local partitions including swap.

Configure BIOS

On the client workstation, boot up and enter setup to turn on PXE LAN boot, then reboot, and see if everything works!

Setting up more workstations

If you want to set up more than one workstation, you’ll need to know the MAC addresses of them all. You can find it out by logging on as root and running “ifconfig -a” (on Debian systems). Then:

1. Create a new PXE config file /tftpboot/pxelinux.cfg/01-aa-bb-cc-dd-ee-ff where aabbccddeeff is the MAC address (use lowercase).

2. Create a new entry in /etc/dhcp3/dhcpd.conf for the new MAC address. Don’t forget to restart the DHCP server with

# /etc/init.d/dhcp3-server restart

3. Create the new nfs shared directory and populate it. Create a new entry in /etc/exports as appropriate. Don’t forget to resync the exports with

# exportfs -rv

4. Configure the BIOS on the client for LAN boot.

For creating the new workstation’s directory, you can copy from an existing one and just edit /mnt/hda5/newworkstation/etc/hostname to change the hostname.

Older entries >>

 
start.txt · Last modified: 2007/11/28 22:52 by thohal     Back to top