From: Kay Hayen <kayhayen@gmx.de>
To: John Dennis <jdennis@redhat.com>
Cc: alex@segv.de, linux-audit@redhat.com
Subject: Re: Audit for live supervision
Date: Tue, 19 Aug 2008 19:46:14 +0200 [thread overview]
Message-ID: <200808191946.14420.kayhayen@gmx.de> (raw)
In-Reply-To: <48AAD55E.5070408@redhat.com>
Hello John,
Am Dienstag, 19. August 2008 16:14:54 schrieb John Dennis:
> Kay Hayen wrote:
> > No, when opening the socket the to the sub deamon audisp. I couldn't
> > convice myself how the API would work with a socket. Does it?
>
> The auparse library can read a stream by opening the parser with
> AUSOURCE_FEED, you set a callback, then feed arbitrary number of bytes
> into the parser by calling auparse_feed(), you'll be called back when a
> complete event is found, at that point just use the normal auparse
> functions.
>
> You can read off of this unix socket (/var/run/audispd_events) but this
> is deprecated. It is now preferred is now to use a audispd plugin and
> read from stdin. See the audit src package and look in audisp/plugins
> for examples. FWIW I noticed that code was calling fgets to get data to
> feed to auparse_feed() but it seems inefficient to buffer lines twice,
> auparse_feed will do the line protocol.
That's great. We can use the first approach initially (unix socket), a plugin
is not so good for us, because our supervision process would need to receive
from it anyway.
The next best step would be to use the netlink socket directly. From what
Steve wrote, that doesn't seem entirely difficult either:
Steve wrote:
> wrt auparse (if that's what you meant) you just run the data through:
> asprintf(&v, "type=%s msg=%.*s\n", type, e->hdr.size, e->data);
> and "v" has the string ready for auparse use. asprinf() allocates memory, so
> watch that it doesn't create a memory leak.
That seems pretty direct too. If it's that easy to use auparse with either
audisp socket or netlink socket, all the blame on us for not discovering it
on our own. :-)
The extra handling of the netlink socket may not be that much code then,
allthough I suspect it requires a root rights (or simply a capability I would
hope).
> > I read that as that we can use the netlink socket with the libaudit
> > directly, which sort of could be exactly what we want. That would mean we
> > wouldn't use audit user space (processes) at all, right?
>
> No, you really want to use the user space interface (see above).
Well, for lowest latency possible (note the "live" in subject), it would be
ideal to avoid context switches auditd -> audisp -> our supervisor and
instead simply run an additional netlink socket in addition to auditd (if
that is allowed). That way we would have a lot less latency, at least in
theory.
But that could well be a final step only and future work and be judged by
measurements of what we get from the relatively easy solution. I am going to
try out that approach of AUSOURCE_FEED and report.
Best regards,
Kay Hayen
next prev parent reply other threads:[~2008-08-19 17:46 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-14 7:14 Audit for live supervision Kay Hayen
2008-08-14 14:04 ` Steve Grubb
2008-08-15 6:43 ` Kay Hayen
2008-08-15 12:54 ` Steve Grubb
2008-08-16 11:19 ` Kay Hayen
2008-08-18 15:10 ` Steve Grubb
2008-08-19 6:45 ` Kay Hayen
2008-08-19 14:14 ` John Dennis
2008-08-19 17:46 ` Kay Hayen [this message]
2008-08-19 18:18 ` Steve Grubb
2008-08-19 14:47 ` Steve Grubb
2008-08-19 18:23 ` Kay Hayen
2008-08-19 18:39 ` Steve Grubb
2008-08-19 20:33 ` Kay Hayen
2008-08-19 20:47 ` Steve Grubb
2008-08-19 21:35 ` Kay Hayen
2008-08-19 21:47 ` Steve Grubb
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200808191946.14420.kayhayen@gmx.de \
--to=kayhayen@gmx.de \
--cc=alex@segv.de \
--cc=jdennis@redhat.com \
--cc=linux-audit@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox