118717f69SRobert Watson /*- 218717f69SRobert Watson * Copyright (c) 1999-2002 Robert N. M. Watson 318717f69SRobert Watson * Copyright (c) 2001 Ilmar S. Habibulin 418717f69SRobert Watson * Copyright (c) 2001-2004 Networks Associates Technology, Inc. 518717f69SRobert Watson * 618717f69SRobert Watson * This software was developed by Robert Watson and Ilmar Habibulin for the 718717f69SRobert Watson * TrustedBSD Project. 818717f69SRobert Watson * 918717f69SRobert Watson * This software was developed for the FreeBSD Project in part by Network 1018717f69SRobert Watson * Associates Laboratories, the Security Research Division of Network 1118717f69SRobert Watson * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), 1218717f69SRobert Watson * as part of the DARPA CHATS research program. 1318717f69SRobert Watson * 1418717f69SRobert Watson * Redistribution and use in source and binary forms, with or without 1518717f69SRobert Watson * modification, are permitted provided that the following conditions 1618717f69SRobert Watson * are met: 1718717f69SRobert Watson * 1. Redistributions of source code must retain the above copyright 1818717f69SRobert Watson * notice, this list of conditions and the following disclaimer. 1918717f69SRobert Watson * 2. Redistributions in binary form must reproduce the above copyright 2018717f69SRobert Watson * notice, this list of conditions and the following disclaimer in the 2118717f69SRobert Watson * documentation and/or other materials provided with the distribution. 2218717f69SRobert Watson * 2318717f69SRobert Watson * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 2418717f69SRobert Watson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2518717f69SRobert Watson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2618717f69SRobert Watson * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 2718717f69SRobert Watson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2818717f69SRobert Watson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2918717f69SRobert Watson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3018717f69SRobert Watson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3118717f69SRobert Watson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3218717f69SRobert Watson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3318717f69SRobert Watson * SUCH DAMAGE. 3418717f69SRobert Watson * 3518717f69SRobert Watson * $FreeBSD$ 3618717f69SRobert Watson */ 3718717f69SRobert Watson 3818717f69SRobert Watson #include <sys/param.h> 3918717f69SRobert Watson #include <sys/module.h> 4018717f69SRobert Watson #include <sys/vnode.h> 4118717f69SRobert Watson 4218717f69SRobert Watson #include <security/audit/audit.h> 4318717f69SRobert Watson 4418717f69SRobert Watson #include <security/mac/mac_framework.h> 4518717f69SRobert Watson #include <security/mac/mac_internal.h> 4618717f69SRobert Watson #include <security/mac/mac_policy.h> 4718717f69SRobert Watson 4818717f69SRobert Watson int 4918717f69SRobert Watson mac_check_proc_setaudit(struct ucred *cred, struct auditinfo *ai) 5018717f69SRobert Watson { 5118717f69SRobert Watson int error; 5218717f69SRobert Watson 5318717f69SRobert Watson MAC_CHECK(check_proc_setaudit, cred, ai); 5418717f69SRobert Watson 5518717f69SRobert Watson return (error); 5618717f69SRobert Watson } 5718717f69SRobert Watson 5818717f69SRobert Watson int 59f1e8bf6dSRobert Watson mac_check_proc_setaudit_addr(struct ucred *cred, struct auditinfo_addr *aia) 60f1e8bf6dSRobert Watson { 61f1e8bf6dSRobert Watson int error; 62f1e8bf6dSRobert Watson 63f1e8bf6dSRobert Watson MAC_CHECK(check_proc_setaudit_addr, cred, aia); 64f1e8bf6dSRobert Watson 65f1e8bf6dSRobert Watson return (error); 66f1e8bf6dSRobert Watson } 67f1e8bf6dSRobert Watson 68f1e8bf6dSRobert Watson int 6918717f69SRobert Watson mac_check_proc_setauid(struct ucred *cred, uid_t auid) 7018717f69SRobert Watson { 7118717f69SRobert Watson int error; 7218717f69SRobert Watson 7318717f69SRobert Watson MAC_CHECK(check_proc_setauid, cred, auid); 7418717f69SRobert Watson 7518717f69SRobert Watson return (error); 7618717f69SRobert Watson } 7718717f69SRobert Watson 7818717f69SRobert Watson int 7918717f69SRobert Watson mac_check_system_audit(struct ucred *cred, void *record, int length) 8018717f69SRobert Watson { 8118717f69SRobert Watson int error; 8218717f69SRobert Watson 8318717f69SRobert Watson MAC_CHECK(check_system_audit, cred, record, length); 8418717f69SRobert Watson 8518717f69SRobert Watson return (error); 8618717f69SRobert Watson } 8718717f69SRobert Watson 8818717f69SRobert Watson int 8918717f69SRobert Watson mac_check_system_auditctl(struct ucred *cred, struct vnode *vp) 9018717f69SRobert Watson { 9118717f69SRobert Watson int error; 9218717f69SRobert Watson struct label *vl; 9318717f69SRobert Watson 9418717f69SRobert Watson ASSERT_VOP_LOCKED(vp, "mac_check_system_auditctl"); 9518717f69SRobert Watson 9618717f69SRobert Watson vl = (vp != NULL) ? vp->v_label : NULL; 9718717f69SRobert Watson 9818717f69SRobert Watson MAC_CHECK(check_system_auditctl, cred, vp, vl); 9918717f69SRobert Watson 10018717f69SRobert Watson return (error); 10118717f69SRobert Watson } 10218717f69SRobert Watson 10318717f69SRobert Watson int 10418717f69SRobert Watson mac_check_system_auditon(struct ucred *cred, int cmd) 10518717f69SRobert Watson { 10618717f69SRobert Watson int error; 10718717f69SRobert Watson 10818717f69SRobert Watson MAC_CHECK(check_system_auditon, cred, cmd); 10918717f69SRobert Watson 11018717f69SRobert Watson return (error); 11118717f69SRobert Watson } 112