Path: blob/master/security/apparmor/include/audit.h
10817 views
/*1* AppArmor security module2*3* This file contains AppArmor auditing function definitions.4*5* Copyright (C) 1998-2008 Novell/SUSE6* Copyright 2009-2010 Canonical Ltd.7*8* This program is free software; you can redistribute it and/or9* modify it under the terms of the GNU General Public License as10* published by the Free Software Foundation, version 2 of the11* License.12*/1314#ifndef __AA_AUDIT_H15#define __AA_AUDIT_H1617#include <linux/audit.h>18#include <linux/fs.h>19#include <linux/lsm_audit.h>20#include <linux/sched.h>21#include <linux/slab.h>2223#include "file.h"2425struct aa_profile;2627extern const char *audit_mode_names[];28#define AUDIT_MAX_INDEX 52930#define AUDIT_APPARMOR_AUTO 0 /* auto choose audit message type */3132enum audit_mode {33AUDIT_NORMAL, /* follow normal auditing of accesses */34AUDIT_QUIET_DENIED, /* quiet all denied access messages */35AUDIT_QUIET, /* quiet all messages */36AUDIT_NOQUIET, /* do not quiet audit messages */37AUDIT_ALL /* audit all accesses */38};3940enum audit_type {41AUDIT_APPARMOR_AUDIT,42AUDIT_APPARMOR_ALLOWED,43AUDIT_APPARMOR_DENIED,44AUDIT_APPARMOR_HINT,45AUDIT_APPARMOR_STATUS,46AUDIT_APPARMOR_ERROR,47AUDIT_APPARMOR_KILL48};4950extern const char *op_table[];51enum aa_ops {52OP_NULL,5354OP_SYSCTL,55OP_CAPABLE,5657OP_UNLINK,58OP_MKDIR,59OP_RMDIR,60OP_MKNOD,61OP_TRUNC,62OP_LINK,63OP_SYMLINK,64OP_RENAME_SRC,65OP_RENAME_DEST,66OP_CHMOD,67OP_CHOWN,68OP_GETATTR,69OP_OPEN,7071OP_FPERM,72OP_FLOCK,73OP_FMMAP,74OP_FMPROT,7576OP_CREATE,77OP_POST_CREATE,78OP_BIND,79OP_CONNECT,80OP_LISTEN,81OP_ACCEPT,82OP_SENDMSG,83OP_RECVMSG,84OP_GETSOCKNAME,85OP_GETPEERNAME,86OP_GETSOCKOPT,87OP_SETSOCKOPT,88OP_SOCK_SHUTDOWN,8990OP_PTRACE,9192OP_EXEC,93OP_CHANGE_HAT,94OP_CHANGE_PROFILE,95OP_CHANGE_ONEXEC,9697OP_SETPROCATTR,98OP_SETRLIMIT,99100OP_PROF_REPL,101OP_PROF_LOAD,102OP_PROF_RM,103};104105106/* define a short hand for apparmor_audit_data portion of common_audit_data */107#define aad apparmor_audit_data108109void aa_audit_msg(int type, struct common_audit_data *sa,110void (*cb) (struct audit_buffer *, void *));111int aa_audit(int type, struct aa_profile *profile, gfp_t gfp,112struct common_audit_data *sa,113void (*cb) (struct audit_buffer *, void *));114115static inline int complain_error(int error)116{117if (error == -EPERM || error == -EACCES)118return 0;119return error;120}121122#endif /* __AA_AUDIT_H */123124125