source: svn/trunk/newcon3bcm2_21bu/toolchain/mips-linux-uclibc/include/linux/audit.h @ 8

Last change on this file since 8 was 2, checked in by jglee, 11 years ago

first commit

  • Property svn:executable set to *
File size: 5.7 KB
Line 
1/* audit.h -- Auditing support
2 *
3 * Copyright 2003-2004 Red Hat Inc., Durham, North Carolina.
4 * All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 *
20 * Written by Rickard E. (Rik) Faith <faith@redhat.com>
21 *
22 */
23
24#ifndef _LINUX_AUDIT_H_
25#define _LINUX_AUDIT_H_
26
27#include <asm/types.h>
28#include <linux/netlink.h>
29
30#include <linux/sched.h>
31#include <linux/elf.h>
32
33/* Request and reply types */
34#define AUDIT_GET      1000     /* Get status */
35#define AUDIT_SET      1001     /* Set status (enable/disable/auditd) */
36#define AUDIT_LIST     1002     /* List filtering rules */
37#define AUDIT_ADD      1003     /* Add filtering rule */
38#define AUDIT_DEL      1004     /* Delete filtering rule */
39#define AUDIT_USER     1005     /* Send a message from user-space */
40#define AUDIT_LOGIN    1006     /* Define the login id and informaiton */
41#define AUDIT_KERNEL   2000     /* Asynchronous audit record. NOT A REQUEST. */
42
43/* Rule flags */
44#define AUDIT_PER_TASK 0x01     /* Apply rule at task creation (not syscall) */
45#define AUDIT_AT_ENTRY 0x02     /* Apply rule at syscall entry */
46#define AUDIT_AT_EXIT  0x04     /* Apply rule at syscall exit */
47#define AUDIT_PREPEND  0x10     /* Prepend to front of list */
48
49/* Rule actions */
50#define AUDIT_NEVER    0        /* Do not build context if rule matches */
51#define AUDIT_POSSIBLE 1        /* Build context if rule matches  */
52#define AUDIT_ALWAYS   2        /* Generate audit record if rule matches */
53
54/* Rule structure sizes -- if these change, different AUDIT_ADD and
55 * AUDIT_LIST commands must be implemented. */
56#define AUDIT_MAX_FIELDS   64
57#define AUDIT_BITMASK_SIZE 64
58#define AUDIT_WORD(nr) ((__u32)((nr)/32))
59#define AUDIT_BIT(nr)  (1 << ((nr) - AUDIT_WORD(nr)*32))
60
61/* Rule fields */
62                                /* These are useful when checking the
63                                 * task structure at task creation time
64                                 * (AUDIT_PER_TASK).  */
65#define AUDIT_PID       0
66#define AUDIT_UID       1
67#define AUDIT_EUID      2
68#define AUDIT_SUID      3
69#define AUDIT_FSUID     4
70#define AUDIT_GID       5
71#define AUDIT_EGID      6
72#define AUDIT_SGID      7
73#define AUDIT_FSGID     8
74#define AUDIT_LOGINUID  9
75#define AUDIT_PERS      10
76#define AUDIT_ARCH      11
77
78                                /* These are ONLY useful when checking
79                                 * at syscall exit time (AUDIT_AT_EXIT). */
80#define AUDIT_DEVMAJOR  100
81#define AUDIT_DEVMINOR  101
82#define AUDIT_INODE     102
83#define AUDIT_EXIT      103
84#define AUDIT_SUCCESS   104     /* exit >= 0; value ignored */
85
86#define AUDIT_ARG0      200
87#define AUDIT_ARG1      (AUDIT_ARG0+1)
88#define AUDIT_ARG2      (AUDIT_ARG0+2)
89#define AUDIT_ARG3      (AUDIT_ARG0+3)
90
91#define AUDIT_NEGATE    0x80000000
92
93
94/* Status symbols */
95                                /* Mask values */
96#define AUDIT_STATUS_ENABLED            0x0001
97#define AUDIT_STATUS_FAILURE            0x0002
98#define AUDIT_STATUS_PID                0x0004
99#define AUDIT_STATUS_RATE_LIMIT         0x0008
100#define AUDIT_STATUS_BACKLOG_LIMIT      0x0010
101                                /* Failure-to-log actions */
102#define AUDIT_FAIL_SILENT       0
103#define AUDIT_FAIL_PRINTK       1
104#define AUDIT_FAIL_PANIC        2
105
106/* distinguish syscall tables */
107#define __AUDIT_ARCH_64BIT 0x80000000
108#define __AUDIT_ARCH_LE    0x40000000
109#define AUDIT_ARCH_ALPHA        (EM_ALPHA|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
110#define AUDIT_ARCH_ARM          (EM_ARM|__AUDIT_ARCH_LE)
111#define AUDIT_ARCH_ARMEB        (EM_ARM)
112#define AUDIT_ARCH_CRIS         (EM_CRIS|__AUDIT_ARCH_LE)
113#define AUDIT_ARCH_FRV          (EM_FRV)
114#define AUDIT_ARCH_H8300        (EM_H8_300)
115#define AUDIT_ARCH_I386         (EM_386|__AUDIT_ARCH_LE)
116#define AUDIT_ARCH_IA64         (EM_IA_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
117#define AUDIT_ARCH_M32R         (EM_M32R)
118#define AUDIT_ARCH_M68K         (EM_68K)
119#define AUDIT_ARCH_MIPS         (EM_MIPS)
120#define AUDIT_ARCH_MIPSEL       (EM_MIPS|__AUDIT_ARCH_LE)
121#define AUDIT_ARCH_MIPS64       (EM_MIPS|__AUDIT_ARCH_64BIT)
122#define AUDIT_ARCH_MIPSEL64     (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
123#define AUDIT_ARCH_PARISC       (EM_PARISC)
124#define AUDIT_ARCH_PARISC64     (EM_PARISC|__AUDIT_ARCH_64BIT)
125#define AUDIT_ARCH_PPC          (EM_PPC)
126#define AUDIT_ARCH_PPC64        (EM_PPC64|__AUDIT_ARCH_64BIT)
127#define AUDIT_ARCH_S390         (EM_S390)
128#define AUDIT_ARCH_S390X        (EM_S390|__AUDIT_ARCH_64BIT)
129#define AUDIT_ARCH_SH           (EM_SH)
130#define AUDIT_ARCH_SHEL         (EM_SH|__AUDIT_ARCH_LE)
131#define AUDIT_ARCH_SH64         (EM_SH|__AUDIT_ARCH_64BIT)
132#define AUDIT_ARCH_SHEL64       (EM_SH|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
133#define AUDIT_ARCH_SPARC        (EM_SPARC)
134#define AUDIT_ARCH_SPARC64      (EM_SPARC64|__AUDIT_ARCH_64BIT)
135#define AUDIT_ARCH_V850         (EM_V850|__AUDIT_ARCH_LE)
136#define AUDIT_ARCH_X86_64       (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
137
138struct audit_message {
139        struct nlmsghdr nlh;
140        char            data[1200];
141};
142
143struct audit_status {
144        __u32           mask;           /* Bit mask for valid entries */
145        __u32           enabled;        /* 1 = enabled, 0 = disbaled */
146        __u32           failure;        /* Failure-to-log action */
147        __u32           pid;            /* pid of auditd process */
148        __u32           rate_limit;     /* messages rate limit (per second) */
149        __u32           backlog_limit;  /* waiting messages limit */
150        __u32           lost;           /* messages lost */
151        __u32           backlog;        /* messages waiting in queue */
152};
153
154struct audit_rule {             /* for AUDIT_LIST, AUDIT_ADD, and AUDIT_DEL */
155        __u32           flags;  /* AUDIT_PER_{TASK,CALL}, AUDIT_PREPEND */
156        __u32           action; /* AUDIT_NEVER, AUDIT_POSSIBLE, AUDIT_ALWAYS */
157        __u32           field_count;
158        __u32           mask[AUDIT_BITMASK_SIZE];
159        __u32           fields[AUDIT_MAX_FIELDS];
160        __u32           values[AUDIT_MAX_FIELDS];
161};
162
163#endif
Note: See TracBrowser for help on using the repository browser.