xref: /freebsd/sys/security/mac/mac_audit.c (revision 1e413cf93298b5b97441a21d9a50fdcd0ee9945e)
1 /*-
2  * Copyright (c) 1999-2002 Robert N. M. Watson
3  * Copyright (c) 2001 Ilmar S. Habibulin
4  * Copyright (c) 2001-2004 Networks Associates Technology, Inc.
5  * Copyright (c) 2006 SPARTA, Inc.
6  *
7  * This software was developed by Robert Watson and Ilmar Habibulin for the
8  * TrustedBSD Project.
9  *
10  * This software was developed for the FreeBSD Project in part by Network
11  * Associates Laboratories, the Security Research Division of Network
12  * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"),
13  * as part of the DARPA CHATS research program.
14  *
15  * This software was enhanced by SPARTA ISSO under SPAWAR contract
16  * N66001-04-C-6019 ("SEFOS").
17  *
18  * Redistribution and use in source and binary forms, with or without
19  * modification, are permitted provided that the following conditions
20  * are met:
21  * 1. Redistributions of source code must retain the above copyright
22  *    notice, this list of conditions and the following disclaimer.
23  * 2. Redistributions in binary form must reproduce the above copyright
24  *    notice, this list of conditions and the following disclaimer in the
25  *    documentation and/or other materials provided with the distribution.
26  *
27  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
28  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
31  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37  * SUCH DAMAGE.
38  *
39  * $FreeBSD$
40  */
41 
42 #include <sys/param.h>
43 #include <sys/module.h>
44 #include <sys/vnode.h>
45 
46 #include <security/audit/audit.h>
47 
48 #include <security/mac/mac_framework.h>
49 #include <security/mac/mac_internal.h>
50 #include <security/mac/mac_policy.h>
51 
52 int
53 mac_proc_check_setaudit(struct ucred *cred, struct auditinfo *ai)
54 {
55 	int error;
56 
57 	MAC_CHECK(proc_check_setaudit, cred, ai);
58 
59 	return (error);
60 }
61 
62 int
63 mac_proc_check_setaudit_addr(struct ucred *cred, struct auditinfo_addr *aia)
64 {
65 	int error;
66 
67 	MAC_CHECK(proc_check_setaudit_addr, cred, aia);
68 
69 	return (error);
70 }
71 
72 int
73 mac_proc_check_setauid(struct ucred *cred, uid_t auid)
74 {
75 	int error;
76 
77 	MAC_CHECK(proc_check_setauid, cred, auid);
78 
79 	return (error);
80 }
81 
82 int
83 mac_system_check_audit(struct ucred *cred, void *record, int length)
84 {
85 	int error;
86 
87 	MAC_CHECK(system_check_audit, cred, record, length);
88 
89 	return (error);
90 }
91 
92 int
93 mac_system_check_auditctl(struct ucred *cred, struct vnode *vp)
94 {
95 	int error;
96 	struct label *vl;
97 
98 	ASSERT_VOP_LOCKED(vp, "mac_system_check_auditctl");
99 
100 	vl = (vp != NULL) ? vp->v_label : NULL;
101 
102 	MAC_CHECK(system_check_auditctl, cred, vp, vl);
103 
104 	return (error);
105 }
106 
107 int
108 mac_system_check_auditon(struct ucred *cred, int cmd)
109 {
110 	int error;
111 
112 	MAC_CHECK(system_check_auditon, cred, cmd);
113 
114 	return (error);
115 }
116