Technical article 125305

Tool for displaying OpenServer 5 system audit parameters

OpenServer 5.0.5OpenServer 5.0.6OpenServer 5.0.7

Written · Last revised

Problem

Is there a tool or utility that displays or dumps the
system audit mask and other potentially important audit
parameters, on OpenServer 5?  I am having a problem in
which

1) Turning on system auditing causes the system to slow down considerably

2) Audit events that I have enabled are not being properly logged

3) Desired audit reports are not being generated completely or properly

4) The audit event mask that can be viewed in the ScoAdmin Audit Manager does not appear to agree with what I have configured

5) Any other problems related to system auditing
6) In addition, when trying to display an audit record on screen via
   scoadmin -> audit -> Reports -> Generate, then selecting report
   to display on terminal, the following error message comes up:

Attempt to start process failed Check system conditions Press <Return> to continue

This happens fresh off of the install CD, and also after MP3. The audit data can be saved to a file or printed just fine.

This problem has been reported to SCO Engineering.

Solution

The following program provides a simple way to access the system audit parameters defined in

/usr/include/sys/audit.h directly from the kernel.  This
program can only be compiled and run as root.
Note that all the various parameters defined in audit.h
are described in comments in the code, but only some have
been elected as parameters to display.  This is to keep
the output of the program somewhat manageable, while
targeting the most potentially useful parameters.
However, one can easily display these omitted parameters,
using other already displayed parameters as a guide to
make the necessary changes to the code.

// Compile code below, e.g., "cc -o aud_query aud_query.c"

#include <stdio.h>
#include <sys/types.h>
#include <nlist.h>
#include <fcntl.h>
#include <sys/audit.h>
#define         KMEM            "/dev/kmem"

void error(char*); void praudit(struct audit_control *); void prauditmask(struct audit_control *);

struct nlist nl[2];             /* aud_cont, NULL */
extern char *optarg;
int fd;                         /* /dev/kmem */

main(int argc, char** argv) { char *kernel; struct audit_control aud_cont;

     if (argc == 1) kernel = "/stand/unix";
     else if (argc == 3)
     {
           while ( getopt(argc, argv, "n:") != -1)
           {
                kernel = optarg;
           }
     }
     else
     {
           fprintf(stderr, "Usage: audit_query [-n
<namelist>]\n");
           exit(1);
     }
     nl[0].n_name = "aud_cont";
     nl[1].n_name = NULL;
     if (nlist(kernel, nl) == -1)
         error(kernel);
     if ((fd = open(KMEM, O_RDONLY)) == -1)
         error(KMEM);
    lseek(fd, nl[0].n_value, 0);
    read(fd, &aud_cont, sizeof(struct audit_control));
    praudit(&aud_cont);
    prauditmask(&aud_cont);
    exit(0);
}
void praudit(struct audit_control *aud)
{
     int x;
printf("System-Wide audit_control Structure (aud_cont):\n\n");
printf("char    init: %d\n", aud->init);
/* subsystem initialized */
printf("char    auditing: %d\n", aud->auditing);
/* enabled=1, disabled=0 */
printf("char    mounted: %d\n", aud->mounted);
/* filesystems mounted */
printf("char    lock: %d\n", aud->lock);
/* audit subsystem lock */
printf("char    read_nosleep: %d\n", aud->read_nosleep);
/* read process shouldn't sleep */
printf("char    not_warned: %d\n", aud->not_warned);
/* low free block warning flag */
/*      char    termed;          terminated due to error  */
/*      char    panic;           panic on error if flag set */
printf("char    cf_open: %d\n", aud->cf_open);
/* collection file open in progress */
printf("char    in_timeout: %d\n", aud->in_timeout);
/* cf_timeout in progress */
/*      char    resvd[2];        RFU */
printf("uint    session: %d\n", aud->session);
/* system boot session number */
printf("uint    sequence: %d\n", aud->sequence);
/* collection file sequence number */
printf("ulong   event_id: %d\n", aud->event_id);
/* event sequence number */
printf("short   cf_uid: %d\n", aud->cf_uid);
/* audit user id */
printf("short   cf_gid: %d\n", aud->cf_gid);

/* audit group id */ /* Used to retain boot information */

/*      ino16_t ;          kernel boot  */
/*      char    [AUDIT_];  kernel path name
*/
/* Subsystem tunable parameters */
printf("mask_t  sys_mask[AUDIT_MASK_SIZE]: %20b\n",
aud->sys_mask[0]);
/* system event mask */
 printf("ulong   switch_count: %d\n", aud->switch_count);
/* collection file switch threshold */
printf("uint    read_count: %d\n", aud->read_count);
/* daemon flush read count */
printf("uint    write_count: %d\n", aud->write_count);
/* subsystem flush count */
printf("uint    write_time: %d\n", aud->write_time);
/* subsystem write interval (HZ) */
for (x=0; x<AUDIT_MAXDIRS; x++)
 {
    if ((uint)aud->dirs[x] > 0)
printf("char    *dirs[%d]: %x\n", x, aud->dirs[x]);
/* directory buffer pointers */
 }
printf("uint    dir_count: %d\n", aud->dir_count);
/* directory list count */
printf("uint    uid_count: %d\n", aud->uid_count);
/* user id select count */
printf("uint    gid_count: %d\n", aud->gid_count);
/* group id select count */
printf("uint    dir_index: %d\n", aud->dir_index);
/* next directory pointer index */
if ((int)aud->dir_pool > 0)
printf("char    *dir_pool: %s\n", aud->dir_pool);
/* pointer to directory path names */
if ((int)aud->curr_dir > 0)
printf("char    *curr_dir: %s\n", aud->curr_dir);
/* pointer to directory path */
if ((int)aud->id_pool > 0)
printf("char    *id_pool: %s\n", aud->id_pool);
/* pointer to id buffer pool */
printf("uint    idpool_size: %d\n", aud->idpool_size);
/* size of id buffer pool */
/*      ushort  *uids;           uid array */
/*      ushort  *gids;           gid array */
/* Collection file buffer pool variables        */
printf("uint    buff_size: %d\n", aud->buff_size);
/* size of collection buffer */
printf("uint    last_flush: %d\n", aud->last_flush);
/* write count since last buffer write */
printf("uint    total_count: %d\n", aud->total_count);
/* total bytes in buffers */
printf("uint    buff_offset: %d\n", aud->buff_offset);
/* current offset into buffers */
printf("uint    buff_count: %d\n", aud->buff_count);
/* number of allocated buffers */
printf("uint    buff_io: %d\n", aud->buff_io);
/*   current I/O buffer id */
/*      uint    block_number;    current file block number
(BSIZE blocks) */
/*      char    *buff_addr;      address of buffer pool */
/* Variables to track the exclusive read process        */
printf("struct proc *d_procp: %x\n", aud->d_procp);
/* daemon proc pointer */
printf("ushort  d_pid: %d\n", aud->d_pid);
/* daemon process id */
printf("ulong   lock_count: %d\n", aud->lock_count);
/* audit lock count */
printf("ulong   unlock_count: %d\n", aud->unlock_count);
/* audit unlock count */
printf("ushort  lock_pid: %d\n", aud->lock_pid);
/* audit subsystem lock pid */
printf("ushort  plockr_pid: %d\n", aud->plockr_pid);
/* read inode plock pid */
printf("ushort  plockw_pid: %d\n", aud->plockw_pid);
/* write inode plock pid */
/* Collection file read and write variables     */
/*      struct filsys *fs;       Superblock ptr of audit
                                 device */
/*      struct inode *cfip[AUDIT_MAXIPS];  collection file
                                 inode pointers */
/*      struct inode *rcfip;     readers inode pointer */
/*      struct inode *wcfip;     writers inode pointer */
/*      uint    warn_blocks;     free block warning count */
/*      uint    stop_blocks;     free block stop-switch count */
/*      long    rcf_offset;      readers file offset */
/*      long    wcf_offset;      writers file offset */
/*      uint    read_index;      readers index into cfip[] */
/*      uint    write_index;     writers index into cfip[] */
/* Audit record generation storage */
/*      uint    path1_size;      size of path name */
/*      uint    path2_size;      size of path name */
/*      char    path1[AUDIT_PATHSIZE];   path name from
                                        user space */
/*      char    path2[AUDIT_PATHSIZE];   path name from
                                        user space */
}
void prauditmask(struct audit_control *aud)
{
      mask_t *auditmask;
auditmask = aud->sys_mask;
printf("\n");
printf("System-Wide Audit Event Mask:\n\n");
printf("A: Startup/Shutdown: %c\n", ISBITSET(auditmask,
ET_BOOT_DOWN)?'y':'n');
printf("B: Login/Logoff: %c\n", ISBITSET(auditmask,
ET_LOGIN)?'y':'n');
printf("C: Process Create/Delete: %c\n",
ISBITSET(auditmask, ET_PROCESS)?'y':'n');
printf("D: Make Object Available: %c\n",
ISBITSET(auditmask, ET_OBJECT_AVAIL)?'y':'n');
printf("E: Map Object to Subject: %c\n",
ISBITSET(auditmask, ET_OBJECT_MAP)?'y':'n');
printf("F: Object Modification: %c\n",
ISBITSET(auditmask, ET_OBJECT_MOD)?'y':'n');
printf("G: Make Object Unavailable: %c\n",
ISBITSET(auditmask, ET_OBJECT_UNAV)?'y':'n');
printf("H: Object Creation: %c\n", ISBITSET(auditmask,
ET_OBJECT_CREAT)?'y':'n');
printf("I: Object Deletion: %c\n", ISBITSET(auditmask,
ET_OBJECT_DEL)?'y':'n');
printf("J: DAC Changes: %c\n", ISBITSET(auditmask,
ET_DAC_CHANGE)?'y':'n');
printf("K: DAC Denials: %c\n", ISBITSET(auditmask,
ET_ACCESS_DENIAL)?'y':'n');
printf("L: Admin/Operator/Actions: %c\n",
ISBITSET(auditmask, ET_SYS_ADMIN)?'y':'n');
printf("M: Insufficient Authorization: %c\n",
ISBITSET(auditmask, ET_INSUFF_PRIV)?'y':'n');
printf("N: Resource Denials: %c\n", ISBITSET(auditmask,
ET_RES_DENIAL)?'y':'n');
printf("O: IPC Functions: %c\n", ISBITSET(auditmask,
ET_IPC)?'y':'n');
printf("P: Process Modifications: %c\n",
ISBITSET(auditmask, ET_PROCESS_MOD)?'y':'n');
printf("Q: Audit Subsystem Events: %c\n",
ISBITSET(auditmask, ET_AUDIT)?'y':'n');
printf("R: Database Events: %c\n", ISBITSET(auditmask,
ET_DATABASE)?'y':'n');
printf("S: Subsystem Events: %c\n", ISBITSET(auditmask,
ET_SUBSYSTEM)?'y':'n');
printf("T: Use of Authorization: %c\n",
ISBITSET(auditmask, ET_PRIVILEGE)?'y':'n');
}

void error(char *s) { perror(s); exit(1); } // end of program

NOTES:    The above tool is only useful if you are thoroughly
          familiar with the auditing subsystem on OpenServer 5 and
          wish to troubleshoot an auditing-related problem, and/or
          if the information that the tool outputs is requested by
          SCO Support.

This tool is included in the current version of the sysinfo(ADM) utility, as /usr/lib/sysinfo.d/bin/aud_query.

From the Xinuos technical article database, record 125305. Reproduced with permission. The original is at www.sco.com/ta/125305, which is reachable but blocked from search engines.

Next step

Need this fixed rather than explained?

Tell us the release, what the system runs and what it is doing. We will reply by email with what we would do next.

  • You deal with the people who do the work
  • No obligation, and no upgrade required before we will help
  • We tell you plainly if something is not worth doing

Send an enquiry

We reply by email. If a server is down, say so in the first line. You can also write to help@scoexpert.com.