1a5684034SChris Costello.\" Copyright (c) 2003 Networks Associates Technology, Inc. 2a5684034SChris Costello.\" All rights reserved. 3a5684034SChris Costello.\" 4a5684034SChris Costello.\" This software was developed for the FreeBSD Project by Chris Costello 5a5684034SChris Costello.\" at Safeport Network Services and Network Associates Labs, the 6a5684034SChris Costello.\" Security Research Division of Network Associates, Inc. under 7a5684034SChris Costello.\" DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the 8a5684034SChris Costello.\" DARPA CHATS research program. 9a5684034SChris Costello.\" 10a5684034SChris Costello.\" Redistribution and use in source and binary forms, with or without 11a5684034SChris Costello.\" modification, are permitted provided that the following conditions 12a5684034SChris Costello.\" are met: 13a5684034SChris Costello.\" 1. Redistributions of source code must retain the above copyright 14a5684034SChris Costello.\" notice, this list of conditions and the following disclaimer. 15a5684034SChris Costello.\" 2. Redistributions in binary form must reproduce the above copyright 16a5684034SChris Costello.\" notice, this list of conditions and the following disclaimer in the 17a5684034SChris Costello.\" documentation and/or other materials provided with the distribution. 18a5684034SChris Costello.\" 19a5684034SChris Costello.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND 20a5684034SChris Costello.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21a5684034SChris Costello.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22a5684034SChris Costello.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE 23a5684034SChris Costello.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24a5684034SChris Costello.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25a5684034SChris Costello.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26a5684034SChris Costello.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27a5684034SChris Costello.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28a5684034SChris Costello.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29a5684034SChris Costello.\" SUCH DAMAGE. 30a5684034SChris Costello.\" 31a5684034SChris Costello.\" $FreeBSD$ 32a5684034SChris Costello.Dd JANUARY 8, 2003 33a5684034SChris Costello.Os 34a5684034SChris Costello.Dt MAC 4 35a5684034SChris Costello.Sh NAME 36a5684034SChris Costello.Nm mac 37a5684034SChris Costello.Nd Mandatory Access Control 38a5684034SChris Costello.Sh SYNOPSIS 39a5684034SChris Costello.Cd "options MAC" 40a5684034SChris Costello.Sh DESCRIPTION 41a5684034SChris Costello.Ss Introduction 42a5684034SChris CostelloThe Mandatory Access Control, or MAC, framework allows administrators to 43a5684034SChris Costellofinely control system security by providing for a loadable security policy 44a5684034SChris Costelloarchitecture. 45a5684034SChris CostelloIt is important to note that due to its nature, MAC security policies may 46a5684034SChris Costelloonly further restrict security; they cannot override traditional UNIX 47a5684034SChris Costellosecurity provisions such as file permissions and superuser checks. 48a5684034SChris Costello.Pp 49a5684034SChris CostelloCurrently, the following MAC policy modules are shipped with 50a5684034SChris Costello.Fx : 51a5684034SChris Costello.Bl -column ".Xr mac_seeotheruids 4" "low-watermark mac policy " ".Em Labeling" "boot only" 52028c285dSChris Costello.It Sy Name Ta Sy Description Ta Sy Labeling Ta Sy "Load time" 53a5684034SChris Costello.It Xr mac_biba 4 Ta "Biba integrity policy" Ta yes Ta boot only 54a5684034SChris Costello.It Xr mac_bsdextended 4 Ta "File system firewall" Ta no Ta any time 55a5684034SChris Costello.It Xr mac_ifoff 4 Ta "Interface silencing" Ta no Ta any time 56a5684034SChris Costello.It Xr mac_lomac 4 Ta "Low-Watermark MAC policy" Ta yes Ta boot only 57a5684034SChris Costello.It Xr mac_mls 4 Ta "Confidentiality policy" Ta yes Ta boot only 58a5684034SChris Costello.It Xr mac_none 4 Ta "Sample no-op policy" Ta no Ta any time 59a5684034SChris Costello.It Xr mac_partition 4 Ta "Process partition policy" Ta yes Ta any time 60a5684034SChris Costello.It Xr mac_seeotheruids 4 Ta "See-other-UIDs policy" Ta no Ta any time 61a5684034SChris Costello.It Xr mac_test 4 Ta "MAC testing policy" Ta no Ta any time 62a5684034SChris Costello.El 63a5684034SChris Costello.Ss MAC Labels 64a5684034SChris CostelloEach system subject (processes, sockets, etc.) and each system object 65a5684034SChris Costello(file system objects, sockets, etc.) can carry with it a MAC label. 66a5684034SChris CostelloMAC labels can contain data in an arbitrary format 67a5684034SChris Costelloused by the MAC policies in order to help determine how to determine 68a5684034SChris Costelloaccess rights for a given operation. 69a5684034SChris CostelloMost MAC labels on system subjects and objects 70a5684034SChris Costellocan be modified directly or indirectly by the system 71a5684034SChris Costelloadministrator. 72a5684034SChris CostelloMore information on the format for MAC labels can be found in the 73a5684034SChris Costello.Xr maclabel 7 74a5684034SChris Costelloman page. 7558ce77d3SChris Costello.Ss Policy Enforcement 7658ce77d3SChris CostelloMAC can be configured to enforce only specific portions of 7758ce77d3SChris Costellopolicies 7858ce77d3SChris Costello(see 7958ce77d3SChris Costello.Sx "Runtime Configuration" ) . 8058ce77d3SChris CostelloPolicy enforcement is divided into the following areas of the system: 8158ce77d3SChris Costello.Bl -ohang 8258ce77d3SChris Costello.It Sy File System 8358ce77d3SChris CostelloFile system mounts, modifying directories, modifying files, etc. 8458ce77d3SChris Costello.It Sy KLD 8558ce77d3SChris CostelloLoading, unloading, and retrieving statistics on loaded kernel modules 8658ce77d3SChris Costello.It Sy Network 8758ce77d3SChris CostelloNetwork interfaces, 8858ce77d3SChris Costello.Xr bpf 4 8958ce77d3SChris Costello.It Sy Pipes 9058ce77d3SChris CostelloCreation of and operation on 9158ce77d3SChris Costello.Xr pipe 2 9258ce77d3SChris Costelloobjects 9358ce77d3SChris Costello.It Sy Processes 9458ce77d3SChris CostelloDebugging 9558ce77d3SChris Costello(e.g. 9658ce77d3SChris Costello.Xr ktrace 2 ) , 9758ce77d3SChris Costelloprocess visibility 9858ce77d3SChris Costello.Xr ( ps 1 ) , 9958ce77d3SChris Costelloprocess execution 10058ce77d3SChris Costello.Xr ( execve 2 ) , 10158ce77d3SChris Costellosignalling 10258ce77d3SChris Costello.Xr ( kill 2 ) 10358ce77d3SChris Costello.It Sy Sockets 10458ce77d3SChris CostelloCreation and operation on 10558ce77d3SChris Costello.Xr socket 2 10658ce77d3SChris Costelloobjects 10758ce77d3SChris Costello.It Sy System 10858ce77d3SChris CostelloKernel environment 10958ce77d3SChris Costello.Xr ( kenv 1 ) , 11058ce77d3SChris Costellosystem accounting 11158ce77d3SChris Costello.Xr ( acct 2 ) , 11258ce77d3SChris Costello.Xr reboot 2 , 11358ce77d3SChris Costello.Xr settimeofday 2 , 11458ce77d3SChris Costello.Xr swapon 2 , 11558ce77d3SChris Costello.Xr sysctl 3 , 11658ce77d3SChris Costello.Sm off 11758ce77d3SChris Costello.Xr nfsd 8 - 11858ce77d3SChris Costellorelated 11958ce77d3SChris Costello.Sm on 12058ce77d3SChris Costellooperations 12158ce77d3SChris Costello.It Sy VM 12258ce77d3SChris Costello.Sm off 12358ce77d3SChris Costello.Xr mmap 2 - 12458ce77d3SChris Costelloed 12558ce77d3SChris Costello.Sm on 12658ce77d3SChris Costellofiles 12758ce77d3SChris Costello.El 128a5684034SChris Costello.Ss Setting MAC labels 129972f13bcSChris CostelloFrom the command line, each type of system object has its own means for setting 130a5684034SChris Costelloand modifying its MAC policy label. 131028c285dSChris Costello.Bl -column "user (by login class)" "Xr login.conf 5" -offset indent 132028c285dSChris Costello.It Sy "Subject/Object" Ta Sy "Utility" 133a5684034SChris Costello.It "File system object" Ta Xr setfmac 8 134a5684034SChris Costello.It "Network interface" Ta Xr ifconfig 8 135a5684034SChris Costello.It "TTY (by login class)" Ta Xr login.conf 5 136a5684034SChris Costello.It "User (by login class)" Ta Xr login.conf 5 137a5684034SChris Costello.El 138a5684034SChris Costello.Pp 139a5684034SChris CostelloAdditionally, the 140a5684034SChris Costello.Xr setpmac 8 141a5684034SChris Costellocommand can be used to run a command with a different process label than 142a5684034SChris Costellothe shell's current label. 143a5684034SChris Costello.Ss Programming With MAC 144a5684034SChris CostelloMAC security enforcement itself is transparent to application 145a5684034SChris Costelloprograms, with the exception that some programs may need to be aware of 146a5684034SChris Costelloadditional 147a5684034SChris Costello.Xr errno 2 148a5684034SChris Costelloreturns from various system calls. 149a5684034SChris Costello.Pp 150a5684034SChris CostelloThe interface for retrieving, handling, and setting policy labels 151a5684034SChris Costellois documented in the 152a5684034SChris Costello.Xr mac 3 153a5684034SChris Costelloman page. 15458ce77d3SChris Costello.Ss Runtime Configuration 15558ce77d3SChris CostelloThe following 15658ce77d3SChris Costello.Xr sysctl 8 15758ce77d3SChris CostelloMIBs are available for fine-tuning the enforcement of MAC policies. 15858ce77d3SChris CostelloUnless specifically noted, all MIBs default to 15958ce77d3SChris Costello.Li 1 16058ce77d3SChris Costello(that is, all areas are enforced by default): 16158ce77d3SChris Costello.Bl -tag -width "security.mac.mmap_revocation" 16258ce77d3SChris Costello.It Va security.mac.enforce_fs 16358ce77d3SChris CostelloEnforce MAC policies for file system accesses 16458ce77d3SChris Costello.It Va security.mac.enforce_kld 16558ce77d3SChris CostelloEnforce MAC policies on 16658ce77d3SChris Costello.Xr kld 4 16758ce77d3SChris Costello.It Va security.mac.enforce_network 16858ce77d3SChris CostelloEnforce MAC policies on network interfaces 16958ce77d3SChris Costello.It Va security.mac.enforce_pipe 17058ce77d3SChris CostelloEnforce MAC policies on pipes 17158ce77d3SChris Costello.It Va security.mac.enforce_process 17258ce77d3SChris CostelloEnforce MAC policies between system processes 17358ce77d3SChris Costello(e.g. 17458ce77d3SChris Costello.Xr ps 1 , 17558ce77d3SChris Costello.Xr ktrace 2 ) 17658ce77d3SChris Costello.It Va security.mac.enforce_socket 17758ce77d3SChris CostelloEnforce MAC policies on sockets 17858ce77d3SChris Costello.It Va security.mac.enforce_system 17958ce77d3SChris CostelloEnforce MAC policies on system-related items 18058ce77d3SChris Costello(e.g. 18158ce77d3SChris Costello.Xr kenv 1 , 18258ce77d3SChris Costello.Xr acct 2 , 18358ce77d3SChris Costello.Xr reboot 2 ) 18458ce77d3SChris Costello.It Va security.mac.enforce_vm 18558ce77d3SChris CostelloEnforce MAC policies on 18658ce77d3SChris Costello.Xr mmap 2 18758ce77d3SChris Costelloand 18858ce77d3SChris Costello.Xr mprotect 2 18958ce77d3SChris Costello.It Va security.mac.mmap_revocation 19058ce77d3SChris CostelloRevoke 19158ce77d3SChris Costello.Xr mmap 2 19258ce77d3SChris Costelloaccess to files on subject relabel 19358ce77d3SChris Costello.It Va security.mac.mmap_revocation_via_cow 19458ce77d3SChris CostelloRevoke 19558ce77d3SChris Costello.Xr mmap 2 19658ce77d3SChris Costelloaccess to files via copy-on-write semantics; 19758ce77d3SChris Costellomapped regions will still appear writable, but will no longer 19858ce77d3SChris Costelloeffect a change on the underlying vnode 19958ce77d3SChris Costello(Default: 0) 20058ce77d3SChris Costello.El 201a5684034SChris Costello.Sh SEE ALSO 202a5684034SChris Costello.Xr mac 3 , 203a5684034SChris Costello.Xr mac_biba 4 , 204a5684034SChris Costello.Xr mac_bsdextended 4 , 205a5684034SChris Costello.Xr mac_ifoff 4 , 206a5684034SChris Costello.Xr mac_lomac 4 , 207a5684034SChris Costello.Xr mac_mls 4 , 208a5684034SChris Costello.Xr mac_none 4 , 209a5684034SChris Costello.Xr mac_partition 4 , 210a5684034SChris Costello.Xr mac_seeotheruids 4 , 211a5684034SChris Costello.Xr mac_test 4 , 212a5684034SChris Costello.Xr login.5 , 213a5684034SChris Costello.Xr maclabel 7 , 214a5684034SChris Costello.Xr getfmac 8 , 215a5684034SChris Costello.Xr setfmac 8 , 216a5684034SChris Costello.Xr getpmac 8 , 217a5684034SChris Costello.Xr setpmac 8 , 218a5684034SChris Costello.Xr mac 9 219bc2c2a48SChris Costello.Rs 220bc2c2a48SChris Costello.%B "The FreeBSD Handbook" 221bc2c2a48SChris Costello.%T "Mandatory Access Control" 222bc2c2a48SChris Costello.%O http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/mac.html 223bc2c2a48SChris Costello.Re 224a5684034SChris Costello.Sh HISTORY 225a5684034SChris CostelloThe 226a5684034SChris Costello.Nm 227a5684034SChris Costelloimplementation first appeared in 228a5684034SChris Costello.Fx 5.0 229a5684034SChris Costelloand was developed by the TrustedBSD Project. 230a5684034SChris Costello.Sh AUTHORS 231a5684034SChris CostelloThis software was contributed to the 232a5684034SChris Costello.Fx 233a5684034SChris CostelloProject by Network Associates Labs, 234a5684034SChris Costellothe Security Research Division of Network Associates 235a5684034SChris CostelloInc. under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), 236a5684034SChris Costelloas part of the DARPA CHATS research program. 237