Technical article 104936

How can I determine if the audit subsystem is enabled?

OpenServer 5.0.0

Written · Last revised

Problem

The audit subsystem is part of the kernel.  Therefore, no user
process or daemon is associated with it.  (The auditd daemon only
reads and compacts collection files created by the audit subsystem.)
Is there any way to determine if the audit subsystem is enabled in
the kernel?

Solution

Follow the procedure below.
NOTE:     You must have the development system to compile this program.
---cut paste glue---
/*
 * This program requires read access on /unix and /dev/kmem.
 *
 * Compile: cc -o audit_query audit_query.c
 *
 */
#include        <stdio.h>
#include        <sys/types.h>
#include        <nlist.h>
#include        <fcntl.h>
#ifndef         UNIX
#define         UNIX            "/unix"
#endif
#ifndef         KMEM
#define         KMEM            "/dev/kmem"
#endif
#define OFFSET 0x1              /* audit_control.auditing field */
void error(char*);
struct nlist nl[2];             /* aud_cont, NULL */
main(int argc, char** argv)
{
    int fd, enable_flag;

nl[0].n_name = "aud_cont"; nl[1].n_name = NULL; if (nlist(UNIX, nl) == -1) error(UNIX); if ((fd = open(KMEM, O_RDONLY)) == -1) error(KMEM);

    lseek(fd, nl[0].n_value + OFFSET, 0);
    read(fd, &enable_flag, 1);
    if (enable_flag)
        printf("Audit subsystem is enabled\n");
    else
        printf("Audit subsystem is disabled\n");
}

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

From the Xinuos technical article database, record 104936. Reproduced with permission. The original is at www.sco.com/ta/104936, which is reachable but blocked from search engines. Xinuos marks this article against a retired product line. That refers to the product’s lifecycle, not to whether the advice still works — plenty of it still applies to running systems.

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.