From: "Timothy R. Chavez" <tinytim@us.ibm.com>
To: Audit Mailing List <linux-audit@redhat.com>
Subject: autail
Date: Tue, 24 Oct 2006 18:11:07 -0500 [thread overview]
Message-ID: <1161731467.27200.1.camel@localhost.localdomain> (raw)
Hello,
I thought the following really basic script might be useful to others.
The script adds tail functionality to the "human readable" audit log.
Particular care was taken to allow for "tail -f" functionality to work
reasonably well. It's not perfect, unfortunately, so if you have any
improvements feel free to send them my way. The hard part here is that
ausearch consults /etc/passwd quite a bit and will wreak havoc on the
audit log if /etc/passwd is being audited and ausearch is reading from
stdin. There's no really good way to pipe raw audit records into
ausearch either, so the below is the best I could get it. There's one
side effect that I know of with this solution and that is you may get a
"<no matches>" message. I'll spend some time figuring out how to get
rid of it. It'd be really great if you could pipe data directly into
ausearch rather than having to use "-if".
Enjoy.
-tim
#!/bin/bash
#
# autail - tail functionality for the audit log
#
# Copyright (C) IBM Corporation, 2001
# Authors: Timothy R. Chavez <tinytim@us.ibm.com>
#
# The "ausearch" utility accesses /etc/passwd frequently, so to prevent it
# from generating its own messages while reading from /dev/stdin, we disable
# it by introducing a short-circuit rule into the audit subsystem and run
# ausearch such that any record it generates is thrown away.
#
insert_shortcircuit ()
{
groupadd autail
/sbin/auditctl -A entry,never -F gid=autail
}
remove_shortcircuit ()
{
/sbin/auditctl -d entry,never -F gid=autail
groupdel autail
}
trap "{ remove_shortcircuit; exit 0; }" SIGINT SIGTERM
insert_shortcircuit
sg autail "/sbin/ausearch -i -if /dev/stdin"&
/usr/bin/tail $* /var/log/audit/audit.log
remove_shortcircuit
exit 0
next reply other threads:[~2006-10-24 23:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-24 23:11 Timothy R. Chavez [this message]
2006-10-24 23:18 ` autail Timothy R. Chavez
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=1161731467.27200.1.camel@localhost.localdomain \
--to=tinytim@us.ibm.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