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. 530d239bcSRobert Watson * Copyright (c) 2006 SPARTA, Inc. 618717f69SRobert Watson * 718717f69SRobert Watson * This software was developed by Robert Watson and Ilmar Habibulin for the 818717f69SRobert Watson * TrustedBSD Project. 918717f69SRobert Watson * 1018717f69SRobert Watson * This software was developed for the FreeBSD Project in part by Network 1118717f69SRobert Watson * Associates Laboratories, the Security Research Division of Network 1218717f69SRobert Watson * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), 1318717f69SRobert Watson * as part of the DARPA CHATS research program. 1418717f69SRobert Watson * 1530d239bcSRobert Watson * This software was enhanced by SPARTA ISSO under SPAWAR contract 1630d239bcSRobert Watson * N66001-04-C-6019 ("SEFOS"). 1730d239bcSRobert Watson * 1818717f69SRobert Watson * Redistribution and use in source and binary forms, with or without 1918717f69SRobert Watson * modification, are permitted provided that the following conditions 2018717f69SRobert Watson * are met: 2118717f69SRobert Watson * 1. Redistributions of source code must retain the above copyright 2218717f69SRobert Watson * notice, this list of conditions and the following disclaimer. 2318717f69SRobert Watson * 2. Redistributions in binary form must reproduce the above copyright 2418717f69SRobert Watson * notice, this list of conditions and the following disclaimer in the 2518717f69SRobert Watson * documentation and/or other materials provided with the distribution. 2618717f69SRobert Watson * 2718717f69SRobert Watson * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 2818717f69SRobert Watson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2918717f69SRobert Watson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 3018717f69SRobert Watson * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 3118717f69SRobert Watson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 3218717f69SRobert Watson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 3318717f69SRobert Watson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3418717f69SRobert Watson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3518717f69SRobert Watson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3618717f69SRobert Watson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3718717f69SRobert Watson * SUCH DAMAGE. 3818717f69SRobert Watson * 3918717f69SRobert Watson * $FreeBSD$ 4018717f69SRobert Watson */ 4118717f69SRobert Watson 4218717f69SRobert Watson #include <sys/param.h> 4318717f69SRobert Watson #include <sys/module.h> 4418717f69SRobert Watson #include <sys/vnode.h> 4518717f69SRobert Watson 4618717f69SRobert Watson #include <security/audit/audit.h> 4718717f69SRobert Watson 4818717f69SRobert Watson #include <security/mac/mac_framework.h> 4918717f69SRobert Watson #include <security/mac/mac_internal.h> 5018717f69SRobert Watson #include <security/mac/mac_policy.h> 5118717f69SRobert Watson 5218717f69SRobert Watson int 5330d239bcSRobert Watson mac_proc_check_setaudit(struct ucred *cred, struct auditinfo *ai) 5418717f69SRobert Watson { 5518717f69SRobert Watson int error; 5618717f69SRobert Watson 5730d239bcSRobert Watson MAC_CHECK(proc_check_setaudit, cred, ai); 5818717f69SRobert Watson 5918717f69SRobert Watson return (error); 6018717f69SRobert Watson } 6118717f69SRobert Watson 6218717f69SRobert Watson int 6330d239bcSRobert Watson mac_proc_check_setaudit_addr(struct ucred *cred, struct auditinfo_addr *aia) 64f1e8bf6dSRobert Watson { 65f1e8bf6dSRobert Watson int error; 66f1e8bf6dSRobert Watson 6730d239bcSRobert Watson MAC_CHECK(proc_check_setaudit_addr, cred, aia); 68f1e8bf6dSRobert Watson 69f1e8bf6dSRobert Watson return (error); 70f1e8bf6dSRobert Watson } 71f1e8bf6dSRobert Watson 72f1e8bf6dSRobert Watson int 7330d239bcSRobert Watson mac_proc_check_setauid(struct ucred *cred, uid_t auid) 7418717f69SRobert Watson { 7518717f69SRobert Watson int error; 7618717f69SRobert Watson 7730d239bcSRobert Watson MAC_CHECK(proc_check_setauid, cred, auid); 7818717f69SRobert Watson 7918717f69SRobert Watson return (error); 8018717f69SRobert Watson } 8118717f69SRobert Watson 8218717f69SRobert Watson int 8330d239bcSRobert Watson mac_system_check_audit(struct ucred *cred, void *record, int length) 8418717f69SRobert Watson { 8518717f69SRobert Watson int error; 8618717f69SRobert Watson 8730d239bcSRobert Watson MAC_CHECK(system_check_audit, cred, record, length); 8818717f69SRobert Watson 8918717f69SRobert Watson return (error); 9018717f69SRobert Watson } 9118717f69SRobert Watson 9218717f69SRobert Watson int 9330d239bcSRobert Watson mac_system_check_auditctl(struct ucred *cred, struct vnode *vp) 9418717f69SRobert Watson { 9518717f69SRobert Watson int error; 9618717f69SRobert Watson struct label *vl; 9718717f69SRobert Watson 9830d239bcSRobert Watson ASSERT_VOP_LOCKED(vp, "mac_system_check_auditctl"); 9918717f69SRobert Watson 10018717f69SRobert Watson vl = (vp != NULL) ? vp->v_label : NULL; 10118717f69SRobert Watson 10230d239bcSRobert Watson MAC_CHECK(system_check_auditctl, cred, vp, vl); 10318717f69SRobert Watson 10418717f69SRobert Watson return (error); 10518717f69SRobert Watson } 10618717f69SRobert Watson 10718717f69SRobert Watson int 10830d239bcSRobert Watson mac_system_check_auditon(struct ucred *cred, int cmd) 10918717f69SRobert Watson { 11018717f69SRobert Watson int error; 11118717f69SRobert Watson 11230d239bcSRobert Watson MAC_CHECK(system_check_auditon, cred, cmd); 11318717f69SRobert Watson 11418717f69SRobert Watson return (error); 11518717f69SRobert Watson } 116