1ae5fbd9bSRobert Watson.\" Copyright (c) 2002, 2004 Networks Associates Technology, Inc. 2fb8085a2SChris Costello.\" All rights reserved. 3fb8085a2SChris Costello.\" 4fb8085a2SChris Costello.\" This software was developed for the FreeBSD Project by Chris 5fb8085a2SChris Costello.\" Costello at Safeport Network Services and NAI Labs, the Security 6fb8085a2SChris Costello.\" Research Division of Network Associates, Inc. under DARPA/SPAWAR 7fb8085a2SChris Costello.\" contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA CHATS 8fb8085a2SChris Costello.\" research program. 9fb8085a2SChris Costello.\" 10fb8085a2SChris Costello.\" Redistribution and use in source and binary forms, with or without 11fb8085a2SChris Costello.\" modification, are permitted provided that the following conditions 12fb8085a2SChris Costello.\" are met: 13fb8085a2SChris Costello.\" 1. Redistributions of source code must retain the above copyright 14fb8085a2SChris Costello.\" notice, this list of conditions and the following disclaimer. 15fb8085a2SChris Costello.\" 2. Redistributions in binary form must reproduce the above copyright 16fb8085a2SChris Costello.\" notice, this list of conditions and the following disclaimer in the 17fb8085a2SChris Costello.\" documentation and/or other materials provided with the distribution. 18fb8085a2SChris Costello.\" 19fb8085a2SChris Costello.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND 20fb8085a2SChris Costello.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21fb8085a2SChris Costello.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22fb8085a2SChris Costello.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE 23fb8085a2SChris Costello.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24fb8085a2SChris Costello.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25fb8085a2SChris Costello.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26fb8085a2SChris Costello.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27fb8085a2SChris Costello.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28fb8085a2SChris Costello.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29fb8085a2SChris Costello.\" SUCH DAMAGE. 30fb8085a2SChris Costello.\" 31ae5fbd9bSRobert Watson.Dd February 24, 2004 32fb8085a2SChris Costello.Dt UGIDFW 8 33ee8e7f9dSRuslan Ermilov.Os 34fb8085a2SChris Costello.Sh NAME 35fb8085a2SChris Costello.Nm ugidfw 36ee8e7f9dSRuslan Ermilov.Nd "firewall-like access controls for file system objects" 37fb8085a2SChris Costello.Sh SYNOPSIS 38fb8085a2SChris Costello.Nm 39ae5fbd9bSRobert Watson.Cm add 40ae5fbd9bSRobert Watson.Cm subject 41ae5fbd9bSRobert Watson.Op Cm not 4289ddbd45SDavid Malone.Oo 4389ddbd45SDavid Malone.Op Cm \&! 4489ddbd45SDavid Malone.Cm uid Ar uid | minuid:maxuid 4589ddbd45SDavid Malone.Oc 4689ddbd45SDavid Malone.Oo 4789ddbd45SDavid Malone.Op Cm \&! 4889ddbd45SDavid Malone.Cm gid Ar gid | mingid:maxgid 4989ddbd45SDavid Malone.Oc 5089ddbd45SDavid Malone.Oo 5189ddbd45SDavid Malone.Op Cm \&! 5289ddbd45SDavid Malone.Cm jailid Ad jailid 5389ddbd45SDavid Malone.Oc 54ae5fbd9bSRobert Watson.Cm object 55ae5fbd9bSRobert Watson.Op Cm not 5689ddbd45SDavid Malone.Oo 5789ddbd45SDavid Malone.Op Cm \&! 5889ddbd45SDavid Malone.Cm uid Ar uid | minuid:maxuid 5989ddbd45SDavid Malone.Oc 6089ddbd45SDavid Malone.Oo 6189ddbd45SDavid Malone.Op Cm \&! 6289ddbd45SDavid Malone.Cm gid Ar gid | mingid:maxgid 6389ddbd45SDavid Malone.Oc 6489ddbd45SDavid Malone.Oo 6589ddbd45SDavid Malone.Op Cm \&! 6689ddbd45SDavid Malone.Cm filesys Ad path 6789ddbd45SDavid Malone.Oc 6889ddbd45SDavid Malone.Oo 6989ddbd45SDavid Malone.Op Cm \&! 7089ddbd45SDavid Malone.Cm suid 7189ddbd45SDavid Malone.Oc 7289ddbd45SDavid Malone.Oo 7389ddbd45SDavid Malone.Op Cm \&! 7489ddbd45SDavid Malone.Cm sgid 7589ddbd45SDavid Malone.Oc 7689ddbd45SDavid Malone.Oo 7789ddbd45SDavid Malone.Op Cm \&! 7889ddbd45SDavid Malone.Cm uid_of_subject 7989ddbd45SDavid Malone.Oc 8089ddbd45SDavid Malone.Oo 8189ddbd45SDavid Malone.Op Cm \&! 8289ddbd45SDavid Malone.Cm gid_of_subject 8389ddbd45SDavid Malone.Oc 8489ddbd45SDavid Malone.Oo 8589ddbd45SDavid Malone.Op Cm \&! 8689ddbd45SDavid Malone.Cm type Ar ardbclsp 8789ddbd45SDavid Malone.Oc 88ae5fbd9bSRobert Watson.Cm mode 89ae5fbd9bSRobert Watson.Ar arswxn 90ae5fbd9bSRobert Watson.Nm 91fb8085a2SChris Costello.Cm list 92fb8085a2SChris Costello.Nm 93fb8085a2SChris Costello.Cm set 94fb8085a2SChris Costello.Ar rulenum 95fb8085a2SChris Costello.Cm subject 96fb8085a2SChris Costello.Op Cm not 9789ddbd45SDavid Malone.Oo 9889ddbd45SDavid Malone.Op Cm \&! 9989ddbd45SDavid Malone.Cm uid Ar uid | minuid:maxuid 10089ddbd45SDavid Malone.Oc 10189ddbd45SDavid Malone.Oo 10289ddbd45SDavid Malone.Op Cm \&! 10389ddbd45SDavid Malone.Cm gid Ar gid | mingid:maxgid 10489ddbd45SDavid Malone.Oc 10589ddbd45SDavid Malone.Oo 10689ddbd45SDavid Malone.Op Cm \&! 10789ddbd45SDavid Malone.Cm jailid Ad jailid 10889ddbd45SDavid Malone.Oc 109fb8085a2SChris Costello.Cm object 110fb8085a2SChris Costello.Op Cm not 11189ddbd45SDavid Malone.Oo 11289ddbd45SDavid Malone.Op Cm \&! 11389ddbd45SDavid Malone.Cm uid Ar uid | minuid:maxuid 11489ddbd45SDavid Malone.Oc 11589ddbd45SDavid Malone.Oo 11689ddbd45SDavid Malone.Op Cm \&! 11789ddbd45SDavid Malone.Cm gid Ar gid | mingid:maxgid 11889ddbd45SDavid Malone.Oc 11989ddbd45SDavid Malone.Oo 12089ddbd45SDavid Malone.Op Cm \&! 12189ddbd45SDavid Malone.Cm filesys Ad path 12289ddbd45SDavid Malone.Oc 12389ddbd45SDavid Malone.Oo 12489ddbd45SDavid Malone.Op Cm \&! 12589ddbd45SDavid Malone.Cm suid 12689ddbd45SDavid Malone.Oc 12789ddbd45SDavid Malone.Oo 12889ddbd45SDavid Malone.Op Cm \&! 12989ddbd45SDavid Malone.Cm sgid 13089ddbd45SDavid Malone.Oc 13189ddbd45SDavid Malone.Oo 13289ddbd45SDavid Malone.Op Cm \&! 13389ddbd45SDavid Malone.Cm uid_of_subject 13489ddbd45SDavid Malone.Oc 13589ddbd45SDavid Malone.Oo 13689ddbd45SDavid Malone.Op Cm \&! 13789ddbd45SDavid Malone.Cm gid_of_subject 13889ddbd45SDavid Malone.Oc 13989ddbd45SDavid Malone.Oo 14089ddbd45SDavid Malone.Op Cm \&! 14189ddbd45SDavid Malone.Cm type Ar ardbclsp 14289ddbd45SDavid Malone.Oc 143fb8085a2SChris Costello.Cm mode 144fb8085a2SChris Costello.Ar arswxn 145fb8085a2SChris Costello.Nm 146fb8085a2SChris Costello.Cm remove 147fb8085a2SChris Costello.Ar rulenum 148fb8085a2SChris Costello.Sh DESCRIPTION 149fb8085a2SChris CostelloThe 150fb8085a2SChris Costello.Nm 151ee8e7f9dSRuslan Ermilovutility provides an 152fb8085a2SChris Costello.Xr ipfw 8 Ns -like 153a3fe8ea3STom Rhodesinterface to manage access to file system objects by UID and GID, 154fb8085a2SChris Costellosupported by the 155ee8e7f9dSRuslan Ermilov.Xr mac_bsdextended 4 156fb8085a2SChris Costello.Xr mac 9 157fb8085a2SChris Costellopolicy. 158fb8085a2SChris Costello.Pp 159fb8085a2SChris CostelloThe arguments are as follows: 160ee8e7f9dSRuslan Ermilov.Bl -tag -width indent -offset indent 161ae5fbd9bSRobert Watson.It Xo 162ae5fbd9bSRobert Watson.Cm add 163ae5fbd9bSRobert Watson.Cm subject 16489ddbd45SDavid Malone.Ar ... 165ae5fbd9bSRobert Watson.Cm object 16689ddbd45SDavid Malone.Ar ... 167ae5fbd9bSRobert Watson.Cm mode 168ae5fbd9bSRobert Watson.Ar arswxn 169ae5fbd9bSRobert Watson.Xc 170ae5fbd9bSRobert WatsonAdd a new rule, automatically selecting the rule number. 171ae5fbd9bSRobert WatsonSee the description of 172ae5fbd9bSRobert Watson.Cm set 173ae5fbd9bSRobert Watsonfor syntax information. 174fb8085a2SChris Costello.It Cm list 175fb8085a2SChris CostelloProduces a list of all the current 176fb8085a2SChris Costello.Nm 177fb8085a2SChris Costellorules in the system. 178fb8085a2SChris Costello.It Xo 179fb8085a2SChris Costello.Cm set Ar rulenum 180fb8085a2SChris Costello.Cm subject 18189ddbd45SDavid Malone.Ar ... 182fb8085a2SChris Costello.Cm object 18389ddbd45SDavid Malone.Ar ... 184fb8085a2SChris Costello.Cm mode 185fb8085a2SChris Costello.Ar arswxn 186fb8085a2SChris Costello.Xc 187fb8085a2SChris CostelloAdd a new rule or modify an existing rule. 188fb8085a2SChris CostelloThe arguments are as follows: 189ee8e7f9dSRuslan Ermilov.Bl -tag -width ".Ar rulenum" 190fb8085a2SChris Costello.It Ar rulenum 191fb8085a2SChris CostelloRule number. 192fb8085a2SChris CostelloEntries with a lower rule number 193fb8085a2SChris Costelloare applied first; 194fb8085a2SChris Costelloplacing the most frequently-matched rules at the beginning of the list 19507bfccd7SRuslan Ermilov(i.e., lower-numbered) 196fb8085a2SChris Costellowill yield a slight performance increase. 197fb8085a2SChris Costello.It Xo 198fb8085a2SChris Costello.Cm subject 199fb8085a2SChris Costello.Op Cm not 20089ddbd45SDavid Malone.Oo 20189ddbd45SDavid Malone.Op Cm \&! 20289ddbd45SDavid Malone.Cm uid Ar uid | minuid:maxuid 20389ddbd45SDavid Malone.Oc 20489ddbd45SDavid Malone.Oo 20589ddbd45SDavid Malone.Op Cm \&! 20689ddbd45SDavid Malone.Cm gid Ar gid | mingid:maxgid 20789ddbd45SDavid Malone.Oc 20889ddbd45SDavid Malone.Oo 20989ddbd45SDavid Malone.Op Cm \&! 21089ddbd45SDavid Malone.Cm jailid Ad jailid 21189ddbd45SDavid Malone.Oc 212fb8085a2SChris Costello.Xc 21389ddbd45SDavid MaloneSubjects performing an operation must match all the conditions given. 21489ddbd45SDavid MaloneA leading 215ee8e7f9dSRuslan Ermilov.Cm not 21689ddbd45SDavid Malonemeans that the subject should not match the remainder of the specification. 21789ddbd45SDavid MaloneA condition may be prefixed by 21889ddbd45SDavid Malone.Cm \&! 21989ddbd45SDavid Maloneto indicate that particular condition must not match the subject. 22089ddbd45SDavid MaloneThe subject can be required to have a particular 221fb8085a2SChris Costello.Ar uid 222fb8085a2SChris Costelloand/or 22389ddbd45SDavid Malone.Ar gid . 224*32ba16b6SUlrich SpörleinA range of uids/gids can be specified, separated by a colon. 22589ddbd45SDavid MaloneThe subject can be required to be in a particular jail with the 22689ddbd45SDavid Malone.Ar jailid . 227fb8085a2SChris Costello.It Xo 228fb8085a2SChris Costello.Cm object 229fb8085a2SChris Costello.Op Cm not 23089ddbd45SDavid Malone.Oo 23189ddbd45SDavid Malone.Op Cm \&! 23289ddbd45SDavid Malone.Cm uid Ar uid | minuid:maxuid 23389ddbd45SDavid Malone.Oc 23489ddbd45SDavid Malone.Oo 23589ddbd45SDavid Malone.Op Cm \&! 23689ddbd45SDavid Malone.Cm gid Ar gid | mingid:maxgid 23789ddbd45SDavid Malone.Oc 23889ddbd45SDavid Malone.Oo 23989ddbd45SDavid Malone.Op Cm \&! 24089ddbd45SDavid Malone.Cm filesys Ad path 24189ddbd45SDavid Malone.Oc 24289ddbd45SDavid Malone.Oo 24389ddbd45SDavid Malone.Op Cm \&! 24489ddbd45SDavid Malone.Cm suid 24589ddbd45SDavid Malone.Oc 24689ddbd45SDavid Malone.Oo 24789ddbd45SDavid Malone.Op Cm \&! 24889ddbd45SDavid Malone.Cm sgid 24989ddbd45SDavid Malone.Oc 25089ddbd45SDavid Malone.Oo 25189ddbd45SDavid Malone.Op Cm \&! 25289ddbd45SDavid Malone.Cm uid_of_subject 25389ddbd45SDavid Malone.Oc 25489ddbd45SDavid Malone.Oo 25589ddbd45SDavid Malone.Op Cm \&! 25689ddbd45SDavid Malone.Cm gid_of_subject 25789ddbd45SDavid Malone.Oc 25889ddbd45SDavid Malone.Oo 25989ddbd45SDavid Malone.Op Cm \&! 26089ddbd45SDavid Malone.Cm type Ar ardbclsp 26189ddbd45SDavid Malone.Oc 262fb8085a2SChris Costello.Xc 26389ddbd45SDavid MaloneThe rule will apply only to objects matching all the specified conditions. 26489ddbd45SDavid MaloneA leading 265ee8e7f9dSRuslan Ermilov.Cm not 26689ddbd45SDavid Malonemeans that the object should not match all the remaining conditions. 26789ddbd45SDavid MaloneA condition may be prefixed by 26889ddbd45SDavid Malone.Cm \&! 26989ddbd45SDavid Maloneto indicate that particular condition must not match the object. 27089ddbd45SDavid MaloneObjects can be required to be owned by the user and/or group specified by 271fb8085a2SChris Costello.Ar uid 272fb8085a2SChris Costelloand/or 27389ddbd45SDavid Malone.Ar gid . 274*32ba16b6SUlrich SpörleinA range of uids/gids can be specified, separated by a colon. 27589ddbd45SDavid MaloneThe object can be required to be in a particular filesystem by 276*32ba16b6SUlrich Spörleinspecifying the filesystem using 27789ddbd45SDavid Malone.Cm filesys . 27889ddbd45SDavid MaloneNote, 27989ddbd45SDavid Maloneif the filesystem is unmounted and remounted, 28089ddbd45SDavid Malonethen the rule may need to be reapplied to ensure the correct filesystem 28189ddbd45SDavid Maloneid is used. 28289ddbd45SDavid MaloneThe object can be required to have the 28389ddbd45SDavid Malone.Cm suid 28489ddbd45SDavid Maloneor 28589ddbd45SDavid Malone.Cm sgid 28689ddbd45SDavid Malonebits set. 28789ddbd45SDavid MaloneThe owner of the object can be required to match the 28889ddbd45SDavid Malone.Cm uid_of_subject 28989ddbd45SDavid Maloneor the 29089ddbd45SDavid Malone.Cm gid_of_subject 29189ddbd45SDavid Maloneattempting the operation. 29289ddbd45SDavid MaloneThe type of the object can be restricted to a subset of 29389ddbd45SDavid Malonethe following types. 29489ddbd45SDavid Malone.Pp 29589ddbd45SDavid Malone.Bl -tag -width ".Cm w" -compact -offset indent 29689ddbd45SDavid Malone.It Cm a 29789ddbd45SDavid Maloneany file type 29889ddbd45SDavid Malone.It Cm r 29989ddbd45SDavid Malonea regular file 30089ddbd45SDavid Malone.It Cm d 30189ddbd45SDavid Malonea directory 30289ddbd45SDavid Malone.It Cm b 30389ddbd45SDavid Malonea block special device 30489ddbd45SDavid Malone.It Cm c 30589ddbd45SDavid Malonea character special device 30689ddbd45SDavid Malone.It Cm l 30789ddbd45SDavid Malonea symbolic link 30889ddbd45SDavid Malone.It Cm s 30989ddbd45SDavid Malonea unix domain socket 31089ddbd45SDavid Malone.It Cm p 31189ddbd45SDavid Malonea named pipe (FIFO) 31289ddbd45SDavid Malone.El 313fb8085a2SChris Costello.It Cm mode Ar arswxn 314fb8085a2SChris CostelloSimilar to 315fb8085a2SChris Costello.Xr chmod 1 , 316fb8085a2SChris Costelloeach character represents an access mode. 317fb8085a2SChris CostelloIf the rule applies, 318fb8085a2SChris Costellothe specified access permissions are enforced 319fb8085a2SChris Costellofor the object. 320fb8085a2SChris CostelloWhen a character is specified in the rule, 321fb8085a2SChris Costellothe rule will allow for the operation. 322fb8085a2SChris CostelloConversely, not including it will cause the operation 323fb8085a2SChris Costelloto be denied. 324fb8085a2SChris CostelloThe definitions of each character are as follows: 325ee8e7f9dSRuslan Ermilov.Pp 326ee8e7f9dSRuslan Ermilov.Bl -tag -width ".Cm w" -compact -offset indent 327ee8e7f9dSRuslan Ermilov.It Cm a 328ee8e7f9dSRuslan Ermilovadministrative operations 329ee8e7f9dSRuslan Ermilov.It Cm r 330ee8e7f9dSRuslan Ermilovread access 331ee8e7f9dSRuslan Ermilov.It Cm s 332ee8e7f9dSRuslan Ermilovaccess to file attributes 333ee8e7f9dSRuslan Ermilov.It Cm w 334ee8e7f9dSRuslan Ermilovwrite access 335ee8e7f9dSRuslan Ermilov.It Cm x 336ee8e7f9dSRuslan Ermilovexecute access 337ee8e7f9dSRuslan Ermilov.It Cm n 338ee8e7f9dSRuslan Ermilovnone 339fb8085a2SChris Costello.El 340fb8085a2SChris Costello.El 341ee8e7f9dSRuslan Ermilov.It Cm remove Ar rulenum 342fb8085a2SChris CostelloDisable and remove the rule with the specified rule number. 343fb8085a2SChris Costello.El 344fb8085a2SChris Costello.Sh SEE ALSO 345ee8e7f9dSRuslan Ermilov.Xr mac_bsdextended 4 , 346fb8085a2SChris Costello.Xr mac 9 347fb8085a2SChris Costello.Sh HISTORY 348fb8085a2SChris CostelloThe 349fb8085a2SChris Costello.Nm 350ee8e7f9dSRuslan Ermilovutility first appeared in 351fb8085a2SChris Costello.Fx 5.0 . 352fb8085a2SChris Costello.Sh AUTHORS 353fb8085a2SChris CostelloThis software was contributed to the 354fb8085a2SChris Costello.Fx 355e5900bcbSChris CostelloProject by NAI Labs, the Security Research Division of Network Associates 35607bfccd7SRuslan ErmilovInc.\& under DARPA/SPAWAR contract N66001-01-C-8035 357ee8e7f9dSRuslan Ermilov.Pq Dq CBOSS , 358fb8085a2SChris Costelloas part of the DARPA CHATS research program. 359