]>
git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - security/apparmor/include/audit.h
2 * AppArmor security module
4 * This file contains AppArmor auditing function definitions.
6 * Copyright (C) 1998-2008 Novell/SUSE
7 * Copyright 2009-2010 Canonical Ltd.
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation, version 2 of the
18 #include <linux/audit.h>
20 #include <linux/lsm_audit.h>
21 #include <linux/sched.h>
22 #include <linux/slab.h>
27 extern const char *const audit_mode_names
[];
28 #define AUDIT_MAX_INDEX 5
30 AUDIT_NORMAL
, /* follow normal auditing of accesses */
31 AUDIT_QUIET_DENIED
, /* quiet all denied access messages */
32 AUDIT_QUIET
, /* quiet all messages */
33 AUDIT_NOQUIET
, /* do not quiet audit messages */
34 AUDIT_ALL
/* audit all accesses */
39 AUDIT_APPARMOR_ALLOWED
,
40 AUDIT_APPARMOR_DENIED
,
42 AUDIT_APPARMOR_STATUS
,
50 #define OP_SYSCTL "sysctl"
51 #define OP_CAPABLE "capable"
53 #define OP_UNLINK "unlink"
54 #define OP_MKDIR "mkdir"
55 #define OP_RMDIR "rmdir"
56 #define OP_MKNOD "mknod"
57 #define OP_TRUNC "truncate"
58 #define OP_LINK "link"
59 #define OP_SYMLINK "symlink"
60 #define OP_RENAME_SRC "rename_src"
61 #define OP_RENAME_DEST "rename_dest"
62 #define OP_CHMOD "chmod"
63 #define OP_CHOWN "chown"
64 #define OP_GETATTR "getattr"
65 #define OP_OPEN "open"
67 #define OP_FRECEIVE "file_receive"
68 #define OP_FPERM "file_perm"
69 #define OP_FLOCK "file_lock"
70 #define OP_FMMAP "file_mmap"
71 #define OP_FMPROT "file_mprotect"
72 #define OP_INHERIT "file_inherit"
74 #define OP_CREATE "create"
75 #define OP_POST_CREATE "post_create"
76 #define OP_BIND "bind"
77 #define OP_CONNECT "connect"
78 #define OP_LISTEN "listen"
79 #define OP_ACCEPT "accept"
80 #define OP_SENDMSG "sendmsg"
81 #define OP_RECVMSG "recvmsg"
82 #define OP_GETSOCKNAME "getsockname"
83 #define OP_GETPEERNAME "getpeername"
84 #define OP_GETSOCKOPT "getsockopt"
85 #define OP_SETSOCKOPT "setsockopt"
86 #define OP_SHUTDOWN "socket_shutdown"
88 #define OP_PTRACE "ptrace"
90 #define OP_EXEC "exec"
92 #define OP_CHANGE_HAT "change_hat"
93 #define OP_CHANGE_PROFILE "change_profile"
94 #define OP_CHANGE_ONEXEC "change_onexec"
95 #define OP_STACK "stack"
96 #define OP_STACK_ONEXEC "stack_onexec"
98 #define OP_SETPROCATTR "setprocattr"
99 #define OP_SETRLIMIT "setrlimit"
101 #define OP_PROF_REPL "profile_replace"
102 #define OP_PROF_LOAD "profile_load"
103 #define OP_PROF_RM "profile_remove"
106 struct apparmor_audit_data
{
110 struct aa_label
*label
;
116 /* these entries require a custom callback fn */
118 struct aa_label
*peer
;
136 /* macros for dealing with apparmor_audit_data structure */
137 #define aad(SA) ((SA)->apparmor_audit_data)
138 #define DEFINE_AUDIT_DATA(NAME, T, X) \
139 /* TODO: cleanup audit init so we don't need _aad = {0,} */ \
140 struct apparmor_audit_data NAME ## _aad = { .op = (X), }; \
141 struct common_audit_data NAME = \
146 NAME.apparmor_audit_data = &(NAME ## _aad)
148 void aa_audit_msg(int type
, struct common_audit_data
*sa
,
149 void (*cb
) (struct audit_buffer
*, void *));
150 int aa_audit(int type
, struct aa_profile
*profile
, struct common_audit_data
*sa
,
151 void (*cb
) (struct audit_buffer
*, void *));
153 #define aa_audit_error(ERROR, SA, CB) \
155 aad((SA))->error = (ERROR); \
156 aa_audit_msg(AUDIT_APPARMOR_ERROR, (SA), (CB)); \
161 static inline int complain_error(int error
)
163 if (error
== -EPERM
|| error
== -EACCES
)
168 #endif /* __AA_AUDIT_H */