zibu

If you have very little requirements, you can call it IDS (Intrusion Detection System), but it is not an IDS. Zibu is a small tool, which allows to cyclically compare access permissions and checksums of files provided by user, with database generated at first run (to be exact, generated with --init or --update mode). But it's main feature, is restoring valid access permissions, and/or executing your commands when checksums are invalid.

Because all values are contained in one big XML file, it's easy to modify it by hand if it's necessary.

Zibu doesn't implement any type of configuration file. The only way to provide a set of files, is to redirect it to Zibu's standard input. Zibu recognizes comments, and empty lines, so it's possible to write nice, and readable list of files, like for example zibu.list.

Screenshot: zibu.png

Probably this program won't be developed any longer, aside from bug fixing. I will not implement any new functions.

Download

Requirements

Linux/BSD (or maybe other Unix-like OS), libxml2, libgcrypt (On Debian Lenny it's libgcrypt11-dev and libxml2-dev)

Compilation

Just type:

$ make

When you are in Zibu's directory.

Example

First, you need to create database. For example, you would like to protect files: /usr/bin/ssh, /usr/bin/scp, /usr/bin/valgrind, /usr/bin/g++. Additionally, you need to know, when file /usr/sbin/logcheck is changed (Because you have very bad memory).

Save those filenames in one file, e.g /etc/zibu.list. Our /etc/zibu.list:

/usr/bin/ssh
/usr/bin/scp
/usr/bin/valgrind
/usr/bin/g++
/usr/sbin/logcheck@echo "logcheck modified" | mail -s ble me@example.com

To generate database type:

$ cat /etc/zibu.list | zibu --init -o /var/lib/zibu/zibu.xml

Time to check our database:

$ zibu --compare -c

If nothing was changed, zibu will do nothing.

Next, you would like to run zibu cyclically. Here, cron comes with help. Create in /etc/cron.hourly shell script, which will run zibu:

#!/bin/sh
/path/to/zibu/zibu --compare -c -r /var/log/zibu.log

That's all! If any of files specified in /etc/zibu.list change in time, Zibu will restore valid access permissions, and send email to you, if /usr/sbin/logcheck will be upgraded.

Modes

Command line arguments

Work modes:

--init

      Gets filenames from stdin and creates database. Saves results in
      output file. Every comments are saved in report file.

--showdb

      Prints database content.

--compare

      Compares database's content to current file's state and saves
      summary to report file. Does not create new database.

--update

      Gets filenames from stdin. Keeps database up to date, adds new files
      and removes missing files. Saves results in output file. Every
      comments are saved in report file.

--version

      Displays Zibu's version.

--help

      Displays help.

Additional options:

-g

     Generates database checksum and saves it to db.xml.md5.random

-c

     Restores correct access permissions (owner, group, mode)

-d <db.xml>

     Zibu's database

-o <out.xml>

     Output file (by default stdout)

-r <report.txt>

     Report file (by default stdout)

Thanks to

Andrzej 'Raziel' Karwala

Author

Tomasz 'urug' Olszewski <urug[at]urug.net>