public inbox for linux-audit@redhat.com
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@redhat.com>
To: Eric Paris <eparis@redhat.com>
Cc: linux-audit@redhat.com, Al Viro <viro@zeniv.linux.org.uk>
Subject: [PATCH v2] audit: log the audit_names record type
Date: Thu, 23 May 2013 10:48:25 -0400	[thread overview]
Message-ID: <1369320505-7413-1-git-send-email-jlayton@redhat.com> (raw)
In-Reply-To: <1368023543-21735-1-git-send-email-jlayton@redhat.com>

...to make it clear what the intent behind each record's operation was.

In many cases you can infer this, based on the context of the syscall
and the result. In other cases it's not so obvious. For instance, in
the case where you have a file being renamed over another, you'll have
two different records with the same filename but different inode info.
By logging this information we can clearly tell which one was created
and which was deleted.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 kernel/audit.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/kernel/audit.c b/kernel/audit.c
index 21c7fa6..d0cd77d 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -1535,6 +1535,26 @@ void audit_log_name(struct audit_context *context, struct audit_names *n,
 		}
 	}
 
+	/* log the audit_names record type */
+	audit_log_format(ab, " objtype=");
+	switch(n->type) {
+	case AUDIT_TYPE_NORMAL:
+		audit_log_format(ab, "NORMAL");
+		break;
+	case AUDIT_TYPE_PARENT:
+		audit_log_format(ab, "PARENT");
+		break;
+	case AUDIT_TYPE_CHILD_DELETE:
+		audit_log_format(ab, "DELETE");
+		break;
+	case AUDIT_TYPE_CHILD_CREATE:
+		audit_log_format(ab, "CREATE");
+		break;
+	default:
+		audit_log_format(ab, "UNKNOWN");
+		break;
+	}
+
 	audit_log_fcaps(ab, n);
 	audit_log_end(ab);
 }
-- 
1.7.1

      parent reply	other threads:[~2013-05-23 14:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-08 14:32 [PATCH] audit: log the audit_names record type Jeff Layton
2013-05-09 13:21 ` Steve Grubb
2013-05-09 14:57   ` Jeff Layton
2013-05-23 14:48 ` Jeff Layton [this message]

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=1369320505-7413-1-git-send-email-jlayton@redhat.com \
    --to=jlayton@redhat.com \
    --cc=eparis@redhat.com \
    --cc=linux-audit@redhat.com \
    --cc=viro@zeniv.linux.org.uk \
    /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