TTY replay daemon

   
Unpacking >

In the following code snippets, # denotes a root/superuser shell, while $ can be a user, or a root shell. Listed are only the commands you have to execute, their output is not shown in the boxes.

If you made it until here, I assume you already unpackaged the source tarball. If not, use:

$ tar -xvjf ttyrpld-VERSION.tbz2;

Of course, replace version with the correct string.

 
Patching the Kernel sources >

This is probably the step most of us will hate, because it involves a total recompile of the Kernel, or at least bzImage. However, I can't help this, as this is by design. Once you have it prepared with the RPL hooks, you will never need again (for that particular kernel)! When there is a new version of ttyrpld and your current Kernel still has the RPL hooks, no more patching is needed. That's one of the strengths.

The correspondig Kernel patches are in the respective folders (kernel-2.6 and kernel-2.4).

Summary of procedure

$ cd /usr/src/linux-2.6.4/;
$ patch -p1 -i ~/ttyrpld/kernel-2.6/rpl-kernelpatch.diff;
$ make menuconfig;

Run `make menuconfig` or anything else that suits your needs to choose "TTY logging via RPL hooks" in the "Security options" menu. For 2.4 where this menu does not exist, rpl-2.4-kernelpatch.diff adds it. If something goes wrong, well, let's hope you are able to edit a few lines of text according to the reject file says. (If not, ask.)

 
Compiling the Kernel module >

After that, run make kmod in the root of the source directory. (Please note that you will need GNU make, version 3.80 or later.) The kmod target tries to figure out the current Kernel version and builds the Kernel module. If a wrong Kernel version is reported (for whatever reason), you can also run make from within the kernel-2.6 (or kernel-2.4) subdirectory.

Be sure to have /lib/modules/`uname -r`/build point to a valid and proper Linux Kernel source tree.

After successful compilation, try to load the module by using `insmod` on kernel-2.6/rpldev.ko (or kernel-2.4/rpldev.o). If it loads fine, you can copy the file to /lib/modules/`uname -r`/misc/.

Summary of (default) procedure

$ make kmod;
# insmod kernel-2.6/rpldev.ko;
# cp kernel-2.6/rpldev.ko /lib/modules/2.6.4/misc/;

To load the module at boot time, edit your distribution specific startup scripts. A hint for SuSE users: it is in /etc/sysconfig/kernel.

 
Compiling the user-space applications >

To compile the user-space tools, run make without any arguments. This will build rpld and ttyreplay (the daemon and the log analyzer).

You will need libHX to use these, because of their (efficient) internal data structures (i.e. tty-to-fd mapping in rpld).

You also need popt (and popt-devel), a library for option parsing. It is usually distributed alongside Redhat's Package Manager "RPM". If you distro does not use RPM, you might still find it in a separate package. (SuSE (uses RPM): popt-1.7-176.3.i586.rpm for example.)

 
Installing >

A `make install` target is currently not provided as different system administrators might want to install it in different places.

The standard position I use is in /usr/lib/ttyrpld. You can directly move the whole source code tree there; it would not make sense to create such a folder just for two executables.

Example on how this could be done:

# cd /usr/lib/;
# tar -xjf ttyrpld-version.tbz2;
# ln -fs ttyrpld-version ttyrpld;

You normally do not to create a device node, since rpld will open /proc/misc to see at which minor number the module has been registered and dynamically creates a node in the current directory (which is deleted shortly afterwards).