13ebc28efSChris Costello.\" Copyright (c) 2002 Networks Associates Technology, Inc. 23ebc28efSChris Costello.\" All rights reserved. 33ebc28efSChris Costello.\" 45792da74SChris Costello.\" This software was developed for the FreeBSD Project by Chris Costello 55792da74SChris Costello.\" at Safeport Network Services and Network Associates Laboratories, the 65792da74SChris Costello.\" Security Research Division of Network Associates, Inc. under 75792da74SChris Costello.\" DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the 85792da74SChris Costello.\" DARPA CHATS research program. 93ebc28efSChris Costello.\" 103ebc28efSChris Costello.\" Redistribution and use in source and binary forms, with or without 113ebc28efSChris Costello.\" modification, are permitted provided that the following conditions 123ebc28efSChris Costello.\" are met: 133ebc28efSChris Costello.\" 1. Redistributions of source code must retain the above copyright 143ebc28efSChris Costello.\" notice, this list of conditions and the following disclaimer. 153ebc28efSChris Costello.\" 2. Redistributions in binary form must reproduce the above copyright 163ebc28efSChris Costello.\" notice, this list of conditions and the following disclaimer in the 173ebc28efSChris Costello.\" documentation and/or other materials provided with the distribution. 183ebc28efSChris Costello.\" 193ebc28efSChris Costello.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND 203ebc28efSChris Costello.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 213ebc28efSChris Costello.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 223ebc28efSChris Costello.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE 233ebc28efSChris Costello.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 243ebc28efSChris Costello.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 253ebc28efSChris Costello.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 263ebc28efSChris Costello.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 273ebc28efSChris Costello.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 283ebc28efSChris Costello.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 293ebc28efSChris Costello.\" SUCH DAMAGE. 303ebc28efSChris Costello.\" 313ebc28efSChris Costello.\" $FreeBSD$ 323cc3bf52SRuslan Ermilov.\" 3388af0398STom Rhodes.Dd September 10, 2004 343ebc28efSChris Costello.Os 353ebc28efSChris Costello.Dt MAC_BSDEXTENDED 4 363ebc28efSChris Costello.Sh NAME 373ebc28efSChris Costello.Nm mac_bsdextended 383cc3bf52SRuslan Ermilov.Nd "file system firewall policy" 393ebc28efSChris Costello.Sh SYNOPSIS 405fa65465SChris CostelloTo compile the file system firewall policy into your kernel, 415fa65465SChris Costelloplace the following lines in your kernel configuration file: 423cc3bf52SRuslan Ermilov.Bd -ragged -offset indent 435fa65465SChris Costello.Cd "options MAC" 445fa65465SChris Costello.Cd "options MAC_BSDEXTENDED" 453cc3bf52SRuslan Ermilov.Ed 465fa65465SChris Costello.Pp 475fa65465SChris CostelloAlternately, to load the file system firewall policy module at boot time, 4817c5113aSChris Costelloplace the following line in your kernel configuration file: 493cc3bf52SRuslan Ermilov.Bd -ragged -offset indent 5017c5113aSChris Costello.Cd "options MAC" 513cc3bf52SRuslan Ermilov.Ed 5217c5113aSChris Costello.Pp 5317c5113aSChris Costelloand in 5417c5113aSChris Costello.Xr loader.conf 5 : 553cc3bf52SRuslan Ermilov.Bd -literal -offset indent 563cc3bf52SRuslan Ermilovmac_bsdextended_load="YES" 573cc3bf52SRuslan Ermilov.Ed 583ebc28efSChris Costello.Sh DESCRIPTION 593ebc28efSChris CostelloThe 603ebc28efSChris Costello.Nm 613ebc28efSChris Costellointerface provides an interface for the system administrator 623ebc28efSChris Costelloto impose mandatory rules regarding users and some system objects. 633ebc28efSChris CostelloRules are uploaded to the module 643ebc28efSChris Costello(typically using 6517c5113aSChris Costello.Xr ugidfw 8 , 6617c5113aSChris Costelloor some other tool utilizing 673ebc28efSChris Costello.Xr libugidfw 3 ) 683ebc28efSChris Costellowhere they are stored internally 693ebc28efSChris Costelloand used to determine whether to allow or deny specific accesses 703ebc28efSChris Costello(see 713ebc28efSChris Costello.Xr ugidfw 8 ) . 723ebc28efSChris Costello.Sh IMPLEMENTATION NOTES 733ebc28efSChris CostelloWhile the traditional 743ebc28efSChris Costello.Xr mac 9 753ebc28efSChris Costelloentry points are implemented, 763ebc28efSChris Costellopolicy labels are not used; 773ebc28efSChris Costelloinstead, access control decisions are made by iterating through the internal 783ebc28efSChris Costellolist of rules until a rule 793ebc28efSChris Costellowhich denies the particular access 803ebc28efSChris Costellois found, 813ebc28efSChris Costelloor the end of the list is reached. 8245fd0f24STom RhodesThe 8345fd0f24STom Rhodes.Nm 8445fd0f24STom Rhodespolicy works similar to 8545fd0f24STom Rhodes.Xr ipfw 8 8645fd0f24STom Rhodesor by using a 8745fd0f24STom Rhodes.Em first match semantic . 8845fd0f24STom RhodesThis means that not all rules are applied, 8945fd0f24STom Rhodesonly the first matched rule; thus if 9045fd0f24STom RhodesRule A allows access and Rule B blocks 9145fd0f24STom Rhodesaccess, Rule B will never be applied. 9245fd0f24STom Rhodes.Pp 9345fd0f24STom Rhodes.Ss Sysctls 9445fd0f24STom RhodesThe following sysctls may be used to tweak the behavior of 9545fd0f24STom Rhodes.Nm : 9645fd0f24STom Rhodes.Bl -tag -width indent 9745fd0f24STom Rhodes.It Va security.mac.bsdextended.enabled 9845fd0f24STom RhodesSet to zero or one to toggle the policy on or off. 9945fd0f24STom Rhodes.It Va security.mac.bsdextended.rule_count 10045fd0f24STom RhodesList the number of defined rules, the maximum rule count is 10145fd0f24STom Rhodescurrent set at 256. 10245fd0f24STom Rhodes.It Va security.mac.bsdextended.rule_slots 10345fd0f24STom RhodesList the number of rule slots currently being used. 10445fd0f24STom Rhodes.It Va security.mac.bsdextended.firstmatch_enabled 10545fd0f24STom RhodesToggle between the old all rules match functionality 10645fd0f24STom Rhodesand the new first rule matches functionality. 10788af0398STom RhodesThis is enabled by default. 10845fd0f24STom Rhodes.It Va security.mac.bsdextended.logging 10945fd0f24STom RhodesLog all access violations via the 11045fd0f24STom Rhodes.Dv AUTHPRIV 11145fd0f24STom Rhodes.Xr syslog 3 11245fd0f24STom Rhodesfacility. 11345fd0f24STom Rhodes.It Va security.mac.bsdextended.rules 11445fd0f24STom RhodesCurrently does nothing interesting. 1153ebc28efSChris Costello.Sh SEE ALSO 1163ebc28efSChris Costello.Xr libugidfw 3 , 11745fd0f24STom Rhodes.Xr syslog 3 , 118ccf09d7cSChris Costello.Xr mac 4 , 11917c5113aSChris Costello.Xr mac_biba 4 , 120057baf37SChris Costello.Xr mac_ifoff 4 , 1219cad8863SChris Costello.Xr mac_lomac 4 , 12217c5113aSChris Costello.Xr mac_mls 4 , 12317c5113aSChris Costello.Xr mac_none 4 , 124057baf37SChris Costello.Xr mac_partition 4 , 1250c6e926fSChris Costello.Xr mac_portacl 4 , 12617c5113aSChris Costello.Xr mac_seeotheruids 4 , 12717c5113aSChris Costello.Xr mac_test 4 , 12845fd0f24STom Rhodes.Xr ipfw 8 , 1293ebc28efSChris Costello.Xr ugidfw 8 , 1303ebc28efSChris Costello.Xr mac 9 1313ebc28efSChris Costello.Sh HISTORY 1323ebc28efSChris CostelloThe 1333ebc28efSChris Costello.Nm 13417c5113aSChris Costellopolicy module first appeared in 13517c5113aSChris Costello.Fx 5.0 1363cc3bf52SRuslan Ermilovand was developed by the 1373cc3bf52SRuslan Ermilov.Tn TrustedBSD 1383cc3bf52SRuslan ErmilovProject. 13945fd0f24STom Rhodes.Pp 14045fd0f24STom RhodesThe "match first case" and logging capabilities were later added by 14145fd0f24STom Rhodes.An Tom Rhodes Aq trhodes@FreeBSD.org . 1423ebc28efSChris Costello.Sh AUTHORS 1433ebc28efSChris CostelloThis software was contributed to the 1443ebc28efSChris Costello.Fx 1453ebc28efSChris CostelloProject by NAI Labs, the Security Research Division of Network Associates 1465203edcdSRuslan ErmilovInc.\& under DARPA/SPAWAR contract N66001-01-C-8035 1473cc3bf52SRuslan Ermilov.Pq Dq CBOSS , 1483ebc28efSChris Costelloas part of the DARPA CHATS research program. 149