libapparmor: fix parsing for yet another format

Backport from trunk revision 2830

This patch fixes the libapparmor log parsing library to take into
account yet another log format style, as well as incorporating a
testcase for it.

Bugs:
  https://bugs.launchpad.net/apparmor/+bug/1399027
  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=771400
  https://bugzilla.opensuse.org/show_bug.cgi?id=905368

Nominated-by: Steve Beattie <steve@nxnw.org>
Acked-by: John Johansen <john.johansen@canonical.com>

Bug: https://launchpad.net/bugs/1399027
This commit is contained in:
Steve Beattie 2014-12-12 17:07:42 -08:00
parent b0273a9289
commit 6a8a099968
4 changed files with 18 additions and 0 deletions

View file

@ -184,6 +184,8 @@ syslog_type:
{ ret_record->version = AA_RECORD_SYNTAX_V2; free($2); free($4); }
| syslog_date TOK_ID TOK_SYSLOG_KERNEL TOK_DMESG_STAMP TOK_AUDIT TOK_COLON key_type audit_id key_list
{ ret_record->version = AA_RECORD_SYNTAX_V2; free($2); free($4); }
| syslog_date TOK_ID TOK_SYSLOG_KERNEL TOK_AUDIT TOK_COLON key_type audit_id key_list
{ ret_record->version = AA_RECORD_SYNTAX_V2; free($2); }
;
/* when audit dispatches a message it doesn't prepend the audit type string */

View file

@ -0,0 +1 @@
Dec 7 13:18:59 rosa kernel: audit: type=1400 audit(1417954745.397:82): apparmor="ALLOWED" operation="open" profile="/home/simi/bin/aa-test" name="/usr/bin/" pid=3231 comm="ls" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0

View file

@ -0,0 +1,15 @@
START
File: test_multi/syslog_audit_02.in
Event type: AA_RECORD_ALLOWED
Audit ID: 1417954745.397:82
Operation: open
Mask: r
Denied Mask: r
fsuid: 1000
ouid: 0
Profile: /home/simi/bin/aa-test
Name: /usr/bin/
Command: ls
PID: 3231
Epoch: 1417954745
Audit subid: 82