1.\" Copyright (c) 2003 Networks Associates Technology, Inc. 2.\" All rights reserved. 3.\" 4.\" This software was developed for the FreeBSD Project by Chris Costello 5.\" at Safeport Network Services and Network Associates Labs, the 6.\" Security Research Division of Network Associates, Inc. under 7.\" DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the 8.\" DARPA CHATS research program. 9.\" 10.\" Redistribution and use in source and binary forms, with or without 11.\" modification, are permitted provided that the following conditions 12.\" are met: 13.\" 1. Redistributions of source code must retain the above copyright 14.\" notice, this list of conditions and the following disclaimer. 15.\" 2. Redistributions in binary form must reproduce the above copyright 16.\" notice, this list of conditions and the following disclaimer in the 17.\" documentation and/or other materials provided with the distribution. 18.\" 19.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND 20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE 23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29.\" SUCH DAMAGE. 30.\" 31.\" $FreeBSD$ 32.Dd MARCH 11, 2003 33.Dt MAC_PORTACL 4 34.Sh NAME 35.Nm mac_portacl 36.Nd network port access control policy 37.Sh SYNOPSIS 38To compile the port access control policy into your kernel, 39place the following lines in your kernel 40configuration file: 41.Cd "options MAC" 42.Cd "options MAC_PORTACL" 43.Pp 44Alternately, to load the port access control policy module at boot time, 45place the following line in your kernel configuration file: 46.Cd "options MAC" 47.Pp 48and in 49.Xr loader.conf 5 : 50.Cd mac_portacl_load= Ns \&"YES" 51.Sh DESCRIPTION 52The 53.Nm 54policy allows administrators to administratively limit binding to 55local UDP and TCP ports via the 56.Xr sysctl 8 57interface. 58.Pp 59In order to enable the 60.Nm 61policy, MAC policy must be enforced on sockets 62(see 63.Xr mac 4 ) , 64and the port(s) protected by 65.Nm 66must not be included in the range specified by 67the 68.Va net.inet.ip.portrange.reservedlow 69and 70.Va net.inet.ip.portrange.reservedhigh 71.Xr sysctl 8 72MIBs. 73.Ss Runtime Configuration 74The port access control list is specified in the 75.Va security.mac.portacl.rules 76.Xr sysctl 8 77MIB in the following format: 78.Pp 79.Sm off 80.Bd -literal -offset indent 81.Sy idtype 82.Li : 83.Sy id 84.Li : 85.Sy protocol 86.Li : 87.Sy port 88.Li [, 89.Sy idtype 90.Li : 91.Sy id 92.Li : 93.Sy protocol 94.Li : 95.Sy port 96.Li ,...] 97.Ed 98.Sm on 99.Pp 100.Bl -tag -width protocol 101.It Sy idtype 102Describes the type of subject match to be performed. 103Either 104.Li uid 105for userid matching, or 106.Li gid 107for group ID matching. 108.It Sy id 109The user or group ID (depending on 110.Sy idtype ) 111allowed to bind to the specified port. 112.Bf -emphasis 113NOTE: User and group names are not valid; only the actual ID numbers 114may be used. 115.Ef 116.It Sy protocol 117Describes which protocol this entry applies to. 118Either 119.Li tcp 120or 121.Li udp 122are supported. 123.It Sy port 124Describes which port this entry applies to. 125.Bf -emphasis 126NOTE: MAC security policies may not override other security system policies 127by allowing accesses that they may deny, such as 128.Va net.inet.ip.portrange.reservedlow / 129.Va net.inet.ip.portrange.reservedhigh . 130.Ef 131If the specified port falls within the range specified, the 132.Nm 133entry will not function 134(i.e. even the specified user/group may not be able to bind to the specified 135port). 136.El 137.Sh SEE ALSO 138.Xr mac 3 , 139.Xr mac_biba 4 , 140.Xr mac_bsdextended 4 , 141.Xr mac_ifoff 4 , 142.Xr mac_mls 4 , 143.Xr mac_none 4 , 144.Xr mac_partition 4 , 145.Xr mac_seeotheruids 4 , 146.Xr mac_test 4 , 147.Xr mac 9 148.Sh HISTORY 149MAC first appeared in 150.Fx 5.0 . 151.Sh AUTHORS 152This software was contributed to the 153.Fx 154Project by NAI Labs, the Security Research Division of Network Associates 155Inc. under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), 156as part of the DARPA CHATS research program. 157