Receiving Linux Audit trails with auditdistd
Contents
Repository |
The aim of this project is to develop a solution, which enables receiving audit trails, generated by the Linux Audit subsystem, with the auditdistd daemon running on FreeBSD.
Hit Comments in the Edit Bar to see other solutions and notes, which are otherwise hidden for readability.
Modified auditdistd
- Idea
- Modify auditdistd so that it could be used directly as an plugin for audispd (Linux Audit plugins receive logs through the standard input).
Advantages
- One less program involved in the process of sending logs.
Disadvantages
- Auditdistd code adaptation and modification, which is a very similar solution to the original idea of creating a brand new Linux Audit plugin capable of communicating with auditdistd running on FreeBSD.
Tasks
#II-5 Set up an environment with Linux and FreeBSD.
- For the time being I'm using Vagrant for that.
#II-1 Provide a shell script to add files required by auditdistd to run.
#II-11 Port proto files to Linux.
#II-9 Find a Linux alternative to the proto library used by auditdistd.
Search under linux socket networking library.
#II-10 Try to separate proto files and pjdlog fiels from auditdistd into separate libraries.
- If there is a Linux alternative to libproto, then use it in the Linux port of auditdistd.
#II-6 Make a connection between Linux auditdistd and FreeBSD auditdistd.
- Also while here:
#II-7 Explain the segfault on Linux when killing auditdistd with SIGINT.
#II-8 Explain why FreeBSD auditdistd prints [ERROR] [TLS sandbox] (server) SSL I/O error., when Linux auditdistd is trying to establish a connection over the internal audidistd protocol with it.
-The auditdistd code has never been tested on Linux-based systems. As a result some ifdefs might be misplaced, especially those controlling various sandboxing technologies like Capsicum.
- It it not the problem of ifdefs.
- The whole issue might be irrelevant.
- Also while here:
#II-2 Add a thread capable of doing the job of auditd.
Files
References & notes
Notes about the auditdistd implementation (MateuszPiotrowski/Audit/Auditdistd)
Repository of Linux OpenBSM, an abandoned project from 2008 (code.google.com)
IRC channel: Freenode/#openbsm
- Issues:
- Old P4 (Perforce) repositories with a lot of very old commits from the beginnings of OpenBSM. There's a lot of information to be found in those commit messages:
Considered solutions
It looks like auditdistd is able to launch on Linux without major problems. It might be a good idea to use it instead of coming up with an entirely new solution. Here are the possible ways to utilize existing auditdistd code:
Helper plugin
Actually, this approach might result in implementing simpler version of FreeBSD auditd, because this is a program which prepares and manages files auditdistd consumes.
Advantages
The plugin should be able to simulate the FreeBSD-way of adding audit trail files to a directory managed by auditdistd. This way auditdistd doesn't have to be modified (much?) as the log files will appear in its directory like if it was being ran on FreeBSD.
Disadvantages
Tasks
#I1 Compare the ways FreeBSD and the Linux Audit subsystem handle audit trail files
Comment: I've analyzed the auditdistd source code so far. It seems pretty obvious now that the plugin for audispd from the Linux Audit subsystem should be a reimplementation of the OpenBSM auditd daemon. It looks like there are already two implementations: one for Darwin (macOS) and one for FreeBSD.
#I2 Create an implementation of OpenBSM auditd suitable to be used as a plugin for Linux Audit audispd
#I3 Hack the OpenBSM Linux build
Comment: The current state of the OpenBSM Linux build is that auditd and auditdistd seem to compile just fine, except the undefined references to functions and audit syscalls like setaudit, which are not available on Linux.
#I4 Do something about the audit system calls and functions missing from libauditd.
Comment: The missing functions are: audit_get_cond, setaudit, audit_set_class, audit_set_fsize, audit_set_kmask, audit_set_policy, au_close, auditctl, audit_set_qctrl, audit_set_event, audit_get_qctrl, audit_set_kaudit.
#I5 Teach the plugin to read audit trails from standard input
#I6 Remove unnecessary code
Comment: Maybe it will solve #2?
#I7 Should the plugin create a pidfile? Maybe the value of AUDITD_PIDFILE in auditd.h should be changed?
#I8 Change the trigger file name
Comment: The trigger file itself might be useful in the future but it should probably be renamed from /dev/auditd.
#I9 Should the plugin be audited or should it call auditd_prevent_audit?
Reconfigured auditdistd
Reconfigure auditdistd, so that it could read log files directly from the Linux Audit auditd daemon directory (/var/log/audit/ seems to be the default one, audit.log being the default file fresh logs are saved to).
Advantages
Disadvantages