Print this page
NEX-13644 File access audit logging
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/c2/audit_start.c
          +++ new/usr/src/uts/common/c2/audit_start.c
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
       23 + * Copyright 2018 Nexenta Systems, Inc.  All rights reserved.
  23   24   */
  24   25  
  25   26  /*
  26   27   * This file contains the envelope code for system call auditing.
  27   28   */
  28   29  
  29   30  #include <sys/param.h>
  30   31  #include <sys/types.h>
  31   32  #include <sys/time.h>
  32   33  #include <sys/kmem.h>
↓ open down ↓ 423 lines elided ↑ open up ↑
 456  457                  if (amask.as_success & estate || amask.as_failure & estate)
 457  458                          flag = 1;
 458  459          } else if (tad->tad_scid == SYS_execve &&
 459  460              getpflags(PRIV_PFEXEC, CRED()) != 0) {
 460  461                  estate = kctx->auk_ets[AUE_PFEXEC];
 461  462                  if (amask.as_success & estate || amask.as_failure & estate)
 462  463                          flag = 1;
 463  464          }
 464  465  
 465  466          return (flag);
      467 +}
      468 +
      469 +/*
      470 + * determine if we've preselected this event (non-syscall).
      471 + */
      472 +
      473 +int
      474 +auditev(au_event_t event, cred_t *cr)
      475 +{
      476 +        au_mask_t amask;
      477 +        const auditinfo_addr_t *ainfo;
      478 +        au_state_t estate;
      479 +        au_kcontext_t *kctx = GET_KCTX_PZ;
      480 +
      481 +        ASSERT3U(event, <=, MAX_KEVENTS);
      482 +
      483 +        estate = kctx->auk_ets[event];
      484 +        ainfo = crgetauinfo(cr);
      485 +        if (ainfo == NULL)
      486 +                return (0);
      487 +        amask = ainfo->ai_mask;
      488 +
      489 +        if ((amask.as_success & estate) != 0 ||
      490 +            (amask.as_failure & estate) != 0)
      491 +                return (AU_OK);
      492 +
      493 +        return (0);
 466  494  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX