1. 01 Jul, 2006 3 commits
    • Darrel Goeddel's avatar
      [PATCH] audit: support for object context filters · 6e5a2d1d
      Darrel Goeddel authored
      
      This patch introduces object audit filters based on the elements
      of the SELinux context.
      Signed-off-by: default avatarDarrel Goeddel <dgoeddel@trustedcs.com>
      Acked-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      
       kernel/auditfilter.c           |   25 +++++++++++++++++++++++++
       kernel/auditsc.c               |   40 ++++++++++++++++++++++++++++++++++++++++
       security/selinux/ss/services.c |   18 +++++++++++++++++-
       3 files changed, 82 insertions(+), 1 deletion(-)
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      6e5a2d1d
    • Darrel Goeddel's avatar
      [PATCH] audit: rename AUDIT_SE_* constants · 3a6b9f85
      Darrel Goeddel authored
      
      This patch renames some audit constant definitions and adds
      additional definitions used by the following patch.  The renaming
      avoids ambiguity with respect to the new definitions.
      Signed-off-by: default avatarDarrel Goeddel <dgoeddel@trustedcs.com>
      
       include/linux/audit.h          |   15 ++++++++----
       kernel/auditfilter.c           |   50 ++++++++++++++++++++---------------------
       kernel/auditsc.c               |   10 ++++----
       security/selinux/ss/services.c |   32 +++++++++++++-------------
       4 files changed, 56 insertions(+), 51 deletions(-)
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      3a6b9f85
    • Amy Griffis's avatar
      [PATCH] add rule filterkey · 5adc8a6a
      Amy Griffis authored
      
      Add support for a rule key, which can be used to tie audit records to audit
      rules.  This is useful when a watched file is accessed through a link or
      symlink, as well as for general audit log analysis.
      
      Because this patch uses a string key instead of an integer key, there is a bit
      of extra overhead to do the kstrdup() when a rule fires.  However, we're also
      allocating memory for the audit record buffer, so it's probably not that
      significant.  I went ahead with a string key because it seems more
      user-friendly.
      
      Note that the user must ensure that filterkeys are unique.  The kernel only
      checks for duplicate rules.
      Signed-off-by: default avatarAmy Griffis <amy.griffis@hpd.com>
      5adc8a6a
  2. 27 Jun, 2006 2 commits
  3. 23 Jun, 2006 1 commit
  4. 20 Jun, 2006 11 commits
    • Steve Grubb's avatar
      [PATCH] make set_loginuid obey audit_enabled · 41757106
      Steve Grubb authored
      
      Hi,
      
      I was doing some testing and noticed that when the audit system was disabled,
      I was still getting messages about the loginuid being set. The following patch
      makes audit_set_loginuid look at in_syscall to determine if it should create
      an audit event. The loginuid will continue to be set as long as there is a context.
      Signed-off-by: default avatarSteve Grubb <sgrubb@redhat.com>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      41757106
    • Amy Griffis's avatar
      [PATCH] log more info for directory entry change events · 9c937dcc
      Amy Griffis authored
      
      When an audit event involves changes to a directory entry, include
      a PATH record for the directory itself.  A few other notable changes:
      
          - fixed audit_inode_child() hooks in fsnotify_move()
          - removed unused flags arg from audit_inode()
          - added audit log routines for logging a portion of a string
      
      Here's some sample output.
      
      before patch:
      type=SYSCALL msg=audit(1149821605.320:26): arch=40000003 syscall=39 success=yes exit=0 a0=bf8d3c7c a1=1ff a2=804e1b8 a3=bf8d3c7c items=1 ppid=739 pid=800 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=ttyS0 comm="mkdir" exe="/bin/mkdir" subj=root:system_r:unconfined_t:s0-s0:c0.c255
      type=CWD msg=audit(1149821605.320:26):  cwd="/root"
      type=PATH msg=audit(1149821605.320:26): item=0 name="foo" parent=164068 inode=164010 dev=03:00 mode=040755 ouid=0 ogid=0 rdev=00:00 obj=root:object_r:user_home_t:s0
      
      after patch:
      type=SYSCALL msg=audit(1149822032.332:24): arch=40000003 syscall=39 success=yes exit=0 a0=bfdd9c7c a1=1ff a2=804e1b8 a3=bfdd9c7c items=2 ppid=714 pid=777 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=ttyS0 comm="mkdir" exe="/bin/mkdir" subj=root:system_r:unconfined_t:s0-s0:c0.c255
      type=CWD msg=audit(1149822032.332:24):  cwd="/root"
      type=PATH msg=audit(1149822032.332:24): item=0 name="/root" inode=164068 dev=03:00 mode=040750 ouid=0 ogid=0 rdev=00:00 obj=root:object_r:user_home_dir_t:s0
      type=PATH msg=audit(1149822032.332:24): item=1 name="foo" inode=164010 dev=03:00 mode=040755 ouid=0 ogid=0 rdev=00:00 obj=root:object_r:user_home_t:s0
      Signed-off-by: default avatarAmy Griffis <amy.griffis@hp.com>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      9c937dcc
    • Amy Griffis's avatar
      [PATCH] audit: path-based rules · f368c07d
      Amy Griffis authored
      In this implementation, audit registers inotify watches on the parent
      directories of paths specified in audit rules.  When audit's inotify
      event handler is called, it updates any affected rules based on the
      filesystem event.  If the parent directory is renamed, removed, or its
      filesystem is unmounted, audit removes all rules referencing that
      inotify watch.
      
      To keep things simple, this implementation limits location-based
      auditing to the directory entries in an existing directory.  Given
      a path-based rule for /foo/bar/passwd, the following table applies:
      
          passwd modified -- audit event logged
          passwd replaced -- audit event logged, rules list updated
          bar renamed     -- rule removed
          foo renamed     -- untracked, meaning that the rule now applies to
      		       the new location
      
      Audit users typically want to have many rules referencing filesystem
      objects, which can significantly impact filtering performance.  This
      patch also adds an inode-number-based rule hash to mitigate this
      situation.
      
      The patch is relative to the audit git tree:
      http://kernel.org/git/?p=linux/kernel/git/viro/audit-current.git;a=summary
      and uses the inotify kernel API:
      http://lkml.org/lkml/2006/6/1/145
      
      Signed-off-by: default avatarAmy Griffis <amy.griffis@hp.com>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      f368c07d
    • George C. Wilson's avatar
      [PATCH] Audit of POSIX Message Queue Syscalls v.2 · 20ca73bc
      George C. Wilson authored
      This patch adds audit support to POSIX message queues.  It applies cleanly to
      the lspp.b15 branch of Al Viro's git tree.  There are new auxiliary data
      structures, and collection and emission routines in kernel/auditsc.c.  New hooks
      in ipc/mqueue.c collect arguments from the syscalls.
      
      I tested the patch by building the examples from the POSIX MQ library tarball.
      Build them -lrt, not against the old MQ library in the tarball.  Here's the URL:
      http://www.geocities.com/wronski12/posix_ipc/libmqueue-4.41.tar.gz
      
      
      Do auditctl -a exit,always -S for mq_open, mq_timedsend, mq_timedreceive,
      mq_notify, mq_getsetattr.  mq_unlink has no new hooks.  Please see the
      corresponding userspace patch to get correct output from auditd for the new
      record types.
      
      [fixes folded]
      Signed-off-by: default avatarGeorge Wilson <ltcgcw@us.ibm.com>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      20ca73bc
    • Al Viro's avatar
      [PATCH] deprecate AUDIT_POSSBILE · 014149cc
      Al Viro authored
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      014149cc
    • Al Viro's avatar
      [PATCH] inline more audit helpers · d8945bb5
      Al Viro authored
      
      pull checks for ->audit_context into inlined wrappers
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      d8945bb5
    • Linda Knippers's avatar
      [PATCH] update of IPC audit record cleanup · ac03221a
      Linda Knippers authored
      The following patch addresses most of the issues with the IPC_SET_PERM
      records as described in:
      https://www.redhat.com/archives/linux-audit/2006-May/msg00010.html
      
      
      and addresses the comments I received on the record field names.
      
      To summarize, I made the following changes:
      
      1. Changed sys_msgctl() and semctl_down() so that an IPC_SET_PERM
         record is emitted in the failure case as well as the success case.
         This matches the behavior in sys_shmctl().  I could simplify the
         code in sys_msgctl() and semctl_down() slightly but it would mean
         that in some error cases we could get an IPC_SET_PERM record
         without an IPC record and that seemed odd.
      
      2. No change to the IPC record type, given no feedback on the backward
         compatibility question.
      
      3. Removed the qbytes field from the IPC record.  It wasn't being
         set and when audit_ipc_obj() is called from ipcperms(), the
         information isn't available.  If we want the information in the IPC
         record, more extensive changes will be necessary.  Since it only
         applies to message queues and it isn't really permission related, it
         doesn't seem worth it.
      
      4. Removed the obj field from the IPC_SET_PERM record.  This means that
         the kern_ipc_perm argument is no longer needed.
      
      5. Removed the spaces and renamed the IPC_SET_PERM field names.  Replaced iuid and
         igid fields with ouid and ogid in the IPC record.
      
      I tested this with the lspp.22 kernel on an x86_64 box.  I believe it
      applies cleanly on the latest kernel.
      
      -- ljk
      Signed-off-by: default avatarLinda Knippers <linda.knippers@hp.com>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      ac03221a
    • Al Viro's avatar
      [PATCH] add filtering by ppid · 3c66251e
      Al Viro authored
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      3c66251e
    • Al Viro's avatar
      [PATCH] log ppid · f46038ff
      Al Viro authored
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      f46038ff
    • Al Viro's avatar
      e1396065
    • Al Viro's avatar
      [PATCH] execve argument logging · 473ae30b
      Al Viro authored
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      473ae30b
  5. 01 May, 2006 11 commits
  6. 20 Mar, 2006 12 commits
    • Ingo Molnar's avatar
      [PATCH] simplify audit_free() locking · 4023e020
      Ingo Molnar authored
      
      Simplify audit_free()'s locking: no need to lock a task that we are tearing
      down.  [the extra locking also caused false positives in the lock
      validator]
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      4023e020
    • Steve Grubb's avatar
      [PATCH] Add tty to syscall audit records · a6c043a8
      Steve Grubb authored
      
      Hi,
      
      >From the RBAC specs:
      
      FAU_SAR.1.1 The TSF shall provide the set of authorized
      RBAC administrators with the capability to read the following
      audit information from the audit records:
      
      <snip>
      (e) The User Session Identifier or Terminal Type
      
      A patch adding the tty for all syscalls is included in this email.
      Please apply.
      Signed-off-by: default avatarSteve Grubb <sgrubb@redhat.com>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      a6c043a8
    • Amy Griffis's avatar
      [PATCH] audit string fields interface + consumer · 93315ed6
      Amy Griffis authored
      
      Updated patch to dynamically allocate audit rule fields in kernel's
      internal representation.  Added unlikely() calls for testing memory
      allocation result.
      
      Amy Griffis wrote:     [Wed Jan 11 2006, 02:02:31PM EST]
      > Modify audit's kernel-userspace interface to allow the specification
      > of string fields in audit rules.
      >
      > Signed-off-by: Amy Griffis <amy.griffis@hp.com>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      (cherry picked from 5ffc4a863f92351b720fe3e9c5cd647accff9e03 commit)
      93315ed6
    • David Woodhouse's avatar
      [PATCH] Fix audit record filtering with !CONFIG_AUDITSYSCALL · fe7752ba
      David Woodhouse authored
      
      This fixes the per-user and per-message-type filtering when syscall
      auditing isn't enabled.
      
      [AV: folded followup fix from the same author]
      Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      fe7752ba
    • Dustin Kirkland's avatar
      [PATCH] Miscellaneous bug and warning fixes · 7306a0b9
      Dustin Kirkland authored
      
      This patch fixes a couple of bugs revealed in new features recently
      added to -mm1:
      * fixes warnings due to inconsistent use of const struct inode *inode
      * fixes bug that prevent a kernel from booting with audit on, and SELinux off
        due to a missing function in security/dummy.c
      * fixes a bug that throws spurious audit_panic() messages due to a missing
        return just before an error_path label
      * some reasonable house cleaning in audit_ipc_context(),
        audit_inode_context(), and audit_log_task_context()
      Signed-off-by: default avatarDustin Kirkland <dustin.kirkland@us.ibm.com>
      Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
      7306a0b9
    • Dustin Kirkland's avatar
      [PATCH] Capture selinux subject/object context information. · 8c8570fb
      Dustin Kirkland authored
      
      This patch extends existing audit records with subject/object context
      information. Audit records associated with filesystem inodes, ipc, and
      tasks now contain SELinux label information in the field "subj" if the
      item is performing the action, or in "obj" if the item is the receiver
      of an action.
      
      These labels are collected via hooks in SELinux and appended to the
      appropriate record in the audit code.
      
      This additional information is required for Common Criteria Labeled
      Security Protection Profile (LSPP).
      
      [AV: fixed kmalloc flags use]
      [folded leak fixes]
      [folded cleanup from akpm (kfree(NULL)]
      [folded audit_inode_context() leak fix]
      [folded akpm's fix for audit_ipc_perm() definition in case of !CONFIG_AUDIT]
      Signed-off-by: default avatarDustin Kirkland <dustin.kirkland@us.ibm.com>
      Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      8c8570fb
    • Dustin Kirkland's avatar
      [PATCH] Exclude messages by message type · c8edc80c
      Dustin Kirkland authored
      
          - Add a new, 5th filter called "exclude".
          - And add a new field AUDIT_MSGTYPE.
          - Define a new function audit_filter_exclude() that takes a message type
            as input and examines all rules in the filter.  It returns '1' if the
            message is to be excluded, and '0' otherwise.
          - Call the audit_filter_exclude() function near the top of
            audit_log_start() just after asserting audit_initialized.  If the
            message type is not to be audited, return NULL very early, before
            doing a lot of work.
      [combined with followup fix for bug in original patch, Nov 4, same author]
      [combined with later renaming AUDIT_FILTER_EXCLUDE->AUDIT_FILTER_TYPE
      and audit_filter_exclude() -> audit_filter_type()]
      Signed-off-by: default avatarDustin Kirkland <dustin.kirkland@us.ibm.com>
      Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      c8edc80c
    • Amy Griffis's avatar
      [PATCH] Collect more inode information during syscall processing. · 73241ccc
      Amy Griffis authored
      
      This patch augments the collection of inode info during syscall
      processing. It represents part of the functionality that was provided
      by the auditfs patch included in RHEL4.
      
      Specifically, it:
      
      - Collects information for target inodes created or removed during
        syscalls.  Previous code only collects information for the target
        inode's parent.
      
      - Adds the audit_inode() hook to syscalls that operate on a file
        descriptor (e.g. fchown), enabling audit to do inode filtering for
        these calls.
      
      - Modifies filtering code to check audit context for either an inode #
        or a parent inode # matching a given rule.
      
      - Modifies logging to provide inode # for both parent and child.
      
      - Protect debug info from NULL audit_names.name.
      
      [AV: folded a later typo fix from the same author]
      Signed-off-by: default avatarAmy Griffis <amy.griffis@hp.com>
      Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      73241ccc
    • Amy Griffis's avatar
      [PATCH] Pass dentry, not just name, in fsnotify creation hooks. · f38aa942
      Amy Griffis authored
      
      The audit hooks (to be added shortly) will want to see dentry->d_inode
      too, not just the name.
      Signed-off-by: default avatarAmy Griffis <amy.griffis@hp.com>
      Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
      f38aa942
    • Dustin Kirkland's avatar
      [PATCH] Filter rule comparators · b63862f4
      Dustin Kirkland authored
      
      Currently, audit only supports the "=" and "!=" operators in the -F
      filter rules.
      
      This patch reworks the support for "=" and "!=", and adds support
      for ">", ">=", "<", and "<=".
      
      This turned out to be a pretty clean, and simply process.  I ended up
      using the high order bits of the "field", as suggested by Steve and Amy.
      This allowed for no changes whatsoever to the netlink communications.
      See the documentation within the patch in the include/linux/audit.h
      area, where there is a table that explains the reasoning of the bitmask
      assignments clearly.
      
      The patch adds a new function, audit_comparator(left, op, right).
      This function will perform the specified comparison (op, which defaults
      to "==" for backward compatibility) between two values (left and right).
      If the negate bit is on, it will negate whatever that result was.  This
      value is returned.
      Signed-off-by: default avatarDustin Kirkland <dustin.kirkland@us.ibm.com>
      Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
      b63862f4
    • Randy Dunlap's avatar
      [PATCH] AUDIT: kerneldoc for kernel/audit*.c · b0dd25a8
      Randy Dunlap authored
      
      - add kerneldoc for non-static functions;
      - don't init static data to 0;
      - limit lines to < 80 columns;
      - fix long-format style;
      - delete whitespace at end of some lines;
      
      (chrisw: resend and update to current audit-2.6 tree)
      Signed-off-by: default avatarRandy Dunlap <rdunlap@xenotime.net>
      Signed-off-by: default avatarChris Wright <chrisw@osdl.org>
      Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
      b0dd25a8
    • Jason Baron's avatar
      [PATCH] make vm86 call audit_syscall_exit · 7e7f8a03
      Jason Baron authored
      hi,
      
      The motivation behind the patch below was to address messages in
      /var/log/messages such as:
      
      Jan 31 10:54:15 mets kernel: audit(:0): major=252 name_count=0: freeing
      multiple contexts (1)
      Jan 31 10:54:15 mets kernel: audit(:0): major=113 name_count=0: freeing
      multiple contexts (2)
      
      I can reproduce by running 'get-edid' from:
      http://john.fremlin.de/programs/linux/read-edid/
      
      .
      
      These messages come about in the log b/c the vm86 calls do not exit via
      the normal system call exit paths and thus do not call
      'audit_syscall_exit'. The next system call will then free the context for
      itself and for the vm86 context, thus generating the above messages. This
      patch addresses the issue by simply adding a call to 'audit_syscall_exit'
      from the vm86 code.
      
      Besides fixing the above error messages the patch also now allows vm86
      system calls to become auditable. This is useful since strace does not
      appear to properly record the return values from sys_vm86.
      
      I think this patch is also a step in the right direction in terms of
      cleaning up some core auditing code. If we can correct any other paths
      that do not properly call the audit exit and entries points, then we can
      also eliminate the notion of context chaining.
      
      I've tested this patch by verifying that the log messages no longer
      appear, and that the audit records for sys_vm86 appear to be correct.
      Also, 'read_edid' produces itentical output.
      
      thanks,
      
      -Jason
      Signed-off-by: default avatarJason Baron <jbaron@redhat.com>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      7e7f8a03