Description

ttyrpld is a multi-os kernel-level tty logger (key- and screenlogger for ttys) with (a)synchronous replay supprt. It supports most tty types, including vc, bsd and unix98-style ptys (xterm/ssh), serial, isdn, etc. Being implemented within the kernel makes it unavoidable for the default user. It runs with no overhead if the logging daemon is not active.

Technical aspects

… which cause it to differ from existing solutions:

Most other solutions deploy the logging completely in userspace and make it dependent on the user to activate the logging. Definitely, an intruder does not start e.g. /usr/bin/script voluntarily. I have only seen few other kernel-based loggers. One of them is outdated, others query the x86 keyboard driver using interrupt hijacking and fixed translation. This is very unportable, because it only catches raw AT keyboard scancodes, but not USB or even other keyboards (unless they are in compatibility mode), and it does not work at all for network traffic.

Only the FreeBSD snooper watch, which operates on the /dev/snp* devices, can be taken for a comparison. However, it can only do the interactive live feed mode, no logging is possible for later replay. Packet time stamps are also missing.

Components

This kit (ttyrpld) consists of four components:

kpatch: The kernel patch adds a few lines to provide the rpldev extension hooks, which (any) module can then get onto.

rpldev: The kernel module is responsible for grabbing the data off the tty line and providing a character device for the user-space logging daemon. Data grabbed of the tty is directly passed to the overlying daemons, so with the correct terminal settings you can get a 1:1 replay.

For systems where module loading is not possible or not widely supported (OpenBSD for example), rpldev is integrated into the kpatch.

rpld: Having received the captured data, the logging daemon can store them in any format and/or facility, with or without compression, just as it likes, for this happens in user-space and thus you have all the fluffy libraries available. (That would not be the case from kernel space.)

ttyreplay: real-time log analyzer. Think of it as a simple video player.