2003-03-31 08:10:10 +00:00
|
|
|
.\" Copyright (c) 2003 Networks Associates Technology, Inc.
|
|
|
|
.\" All rights reserved.
|
2003-05-29 21:28:36 +00:00
|
|
|
.\"
|
2003-03-31 08:10:10 +00:00
|
|
|
.\" This software was developed for the FreeBSD Project by Chris Costello
|
|
|
|
.\" at Safeport Network Services and Network Associates Labs, the
|
|
|
|
.\" Security Research Division of Network Associates, Inc. under
|
|
|
|
.\" DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
|
|
|
|
.\" DARPA CHATS research program.
|
2003-05-29 21:28:36 +00:00
|
|
|
.\"
|
2003-03-31 08:10:10 +00:00
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
2003-05-29 21:28:36 +00:00
|
|
|
.\"
|
2003-03-31 08:10:10 +00:00
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
2003-05-29 21:28:36 +00:00
|
|
|
.\"
|
2003-03-31 08:10:10 +00:00
|
|
|
.\" $FreeBSD$
|
2003-05-29 21:28:36 +00:00
|
|
|
.\"
|
2004-12-10 15:27:06 +00:00
|
|
|
.Dd December 9, 2004
|
2003-03-31 08:10:10 +00:00
|
|
|
.Dt MAC_PORTACL 4
|
2003-05-29 21:28:36 +00:00
|
|
|
.Os
|
2003-03-31 08:10:10 +00:00
|
|
|
.Sh NAME
|
|
|
|
.Nm mac_portacl
|
2004-02-13 22:08:16 +00:00
|
|
|
.Nd "network port access control policy"
|
2003-03-31 08:10:10 +00:00
|
|
|
.Sh SYNOPSIS
|
|
|
|
To compile the port access control policy into your kernel,
|
|
|
|
place the following lines in your kernel
|
|
|
|
configuration file:
|
2003-05-29 21:28:36 +00:00
|
|
|
.Bd -ragged -offset indent
|
2003-03-31 08:10:10 +00:00
|
|
|
.Cd "options MAC"
|
|
|
|
.Cd "options MAC_PORTACL"
|
2003-05-29 21:28:36 +00:00
|
|
|
.Ed
|
2003-03-31 08:10:10 +00:00
|
|
|
.Pp
|
|
|
|
Alternately, to load the port access control policy module at boot time,
|
|
|
|
place the following line in your kernel configuration file:
|
2003-05-29 21:28:36 +00:00
|
|
|
.Bd -ragged -offset indent
|
2003-03-31 08:10:10 +00:00
|
|
|
.Cd "options MAC"
|
2003-05-29 21:28:36 +00:00
|
|
|
.Ed
|
2003-03-31 08:10:10 +00:00
|
|
|
.Pp
|
2003-05-29 21:28:36 +00:00
|
|
|
and in
|
2003-03-31 08:10:10 +00:00
|
|
|
.Xr loader.conf 5 :
|
2003-05-29 21:28:36 +00:00
|
|
|
.Pp
|
|
|
|
.Dl "mac_portacl_load=""YES"""
|
2003-03-31 08:10:10 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
policy allows administrators to administratively limit binding to
|
2003-05-29 21:28:36 +00:00
|
|
|
local
|
|
|
|
.Tn UDP
|
|
|
|
and
|
|
|
|
.Tn TCP
|
|
|
|
ports via the
|
2003-03-31 08:10:10 +00:00
|
|
|
.Xr sysctl 8
|
|
|
|
interface.
|
|
|
|
.Pp
|
|
|
|
In order to enable the
|
|
|
|
.Nm
|
|
|
|
policy, MAC policy must be enforced on sockets
|
|
|
|
(see
|
|
|
|
.Xr mac 4 ) ,
|
|
|
|
and the port(s) protected by
|
|
|
|
.Nm
|
|
|
|
must not be included in the range specified by
|
|
|
|
the
|
|
|
|
.Va net.inet.ip.portrange.reservedlow
|
|
|
|
and
|
|
|
|
.Va net.inet.ip.portrange.reservedhigh
|
|
|
|
.Xr sysctl 8
|
|
|
|
MIBs.
|
2004-02-13 22:08:16 +00:00
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
policy only affects ports explicitly bound by a user process (either
|
|
|
|
for a listen/outgoing
|
|
|
|
.Tn TCP
|
|
|
|
socket, or a send/receive
|
|
|
|
.Tn UDP
|
|
|
|
socket).
|
|
|
|
This policy will not limit ports bound implicitly for outgoing
|
|
|
|
connections where the process has not explicitly selected a port:
|
|
|
|
these are automatically selected by the IP stack.
|
|
|
|
.Pp
|
|
|
|
When
|
|
|
|
.Nm
|
2004-06-16 08:33:57 +00:00
|
|
|
is enabled, it will control binding access to ports up to the port
|
2004-02-13 22:08:16 +00:00
|
|
|
number set in the
|
|
|
|
.Va security.mac.portacl.port_high
|
|
|
|
.Xr sysctl 8
|
|
|
|
variable.
|
2004-06-16 08:33:57 +00:00
|
|
|
By default, all attempts to bind to
|
2004-02-13 22:08:16 +00:00
|
|
|
.Nm
|
|
|
|
controlled ports will fail if not explicitly allowed by the port
|
|
|
|
access control list, though binding by the superuser will be allowed,
|
|
|
|
if the
|
|
|
|
.Xr sysctl 8
|
|
|
|
variable
|
|
|
|
.Va security.mac.portacl.suser_exempt
|
|
|
|
is set to a non-zero value.
|
2003-03-31 08:10:10 +00:00
|
|
|
.Ss Runtime Configuration
|
2004-02-13 22:08:16 +00:00
|
|
|
The following
|
|
|
|
.Xr sysctl 8
|
|
|
|
MIBs are available for fine-tuning the enforcement of this MAC policy.
|
|
|
|
All
|
2003-03-31 08:10:10 +00:00
|
|
|
.Xr sysctl 8
|
2004-02-13 22:08:16 +00:00
|
|
|
variables, except
|
|
|
|
.Va security.mac.portacl.rules ,
|
|
|
|
can also be set as
|
|
|
|
.Xr loader 8
|
|
|
|
tunables in
|
|
|
|
.Xr loader.conf 5 .
|
|
|
|
.Bl -tag -width indent
|
|
|
|
.It Va security.mac.portacl.enabled
|
|
|
|
Enforce the
|
|
|
|
.Nm
|
|
|
|
policy.
|
|
|
|
(Default: 1).
|
|
|
|
.It Va security.mac.portacl.port_high
|
|
|
|
The highest port number
|
|
|
|
.Nm
|
|
|
|
will enforce rules for.
|
|
|
|
(Default: 1023).
|
|
|
|
.It Va security.mac.portacl.rules
|
2005-01-12 10:14:43 +00:00
|
|
|
The port access control list is specified in the following format:
|
2003-03-31 08:10:10 +00:00
|
|
|
.Pp
|
|
|
|
.Sm off
|
2005-01-15 12:24:26 +00:00
|
|
|
.D1 Ar idtype : id : protocol : port Op , Ar idtype : id : protocol : port , ...
|
2003-03-31 08:10:10 +00:00
|
|
|
.Sm on
|
|
|
|
.Pp
|
2003-05-29 21:28:36 +00:00
|
|
|
.Bl -tag -width ".Ar protocol"
|
|
|
|
.It Ar idtype
|
2003-03-31 08:10:10 +00:00
|
|
|
Describes the type of subject match to be performed.
|
|
|
|
Either
|
|
|
|
.Li uid
|
2003-05-29 21:28:36 +00:00
|
|
|
for user ID matching, or
|
2003-03-31 08:10:10 +00:00
|
|
|
.Li gid
|
|
|
|
for group ID matching.
|
2003-05-29 21:28:36 +00:00
|
|
|
.It Ar id
|
2003-03-31 08:10:10 +00:00
|
|
|
The user or group ID (depending on
|
2003-05-29 21:28:36 +00:00
|
|
|
.Ar idtype )
|
2003-03-31 08:10:10 +00:00
|
|
|
allowed to bind to the specified port.
|
|
|
|
.Bf -emphasis
|
|
|
|
NOTE: User and group names are not valid; only the actual ID numbers
|
|
|
|
may be used.
|
|
|
|
.Ef
|
2003-05-29 21:28:36 +00:00
|
|
|
.It Ar protocol
|
2003-03-31 08:10:10 +00:00
|
|
|
Describes which protocol this entry applies to.
|
|
|
|
Either
|
|
|
|
.Li tcp
|
|
|
|
or
|
|
|
|
.Li udp
|
|
|
|
are supported.
|
2003-05-29 21:28:36 +00:00
|
|
|
.It Ar port
|
2003-03-31 08:10:10 +00:00
|
|
|
Describes which port this entry applies to.
|
|
|
|
.Bf -emphasis
|
|
|
|
NOTE: MAC security policies may not override other security system policies
|
|
|
|
by allowing accesses that they may deny, such as
|
|
|
|
.Va net.inet.ip.portrange.reservedlow /
|
|
|
|
.Va net.inet.ip.portrange.reservedhigh .
|
|
|
|
.Ef
|
|
|
|
If the specified port falls within the range specified, the
|
|
|
|
.Nm
|
|
|
|
entry will not function
|
2003-05-29 21:28:36 +00:00
|
|
|
(i.e., even the specified user/group may not be able to bind to the specified
|
2003-03-31 08:10:10 +00:00
|
|
|
port).
|
|
|
|
.El
|
2004-02-13 22:08:16 +00:00
|
|
|
.It Va security.mac.portacl.suser_exempt
|
2004-06-16 08:33:57 +00:00
|
|
|
Allow superuser (i.e., root) to bind to all
|
2004-02-13 22:08:16 +00:00
|
|
|
.Nm
|
|
|
|
protected ports, even if the port access control list does not
|
|
|
|
explicitly allow this.
|
|
|
|
(Default: 1).
|
2004-12-08 15:58:38 +00:00
|
|
|
.It Va security.mac.portacl.autoport_exempt
|
|
|
|
Allow applications to use automatic binding to port 0.
|
2004-12-09 13:48:33 +00:00
|
|
|
Applications use port 0 as a request for automatic port allocation when
|
|
|
|
binding an IP address to a socket.
|
|
|
|
This tunable will exempt port 0 allocation from rule checking.
|
2005-01-12 10:14:43 +00:00
|
|
|
(Default: 1).
|
2004-02-13 22:08:16 +00:00
|
|
|
.El
|
2003-03-31 08:10:10 +00:00
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr mac 3 ,
|
2004-02-13 22:08:16 +00:00
|
|
|
.Xr ip 4 ,
|
2003-03-31 08:10:10 +00:00
|
|
|
.Xr mac_biba 4 ,
|
|
|
|
.Xr mac_bsdextended 4 ,
|
|
|
|
.Xr mac_ifoff 4 ,
|
|
|
|
.Xr mac_mls 4 ,
|
|
|
|
.Xr mac_none 4 ,
|
|
|
|
.Xr mac_partition 4 ,
|
|
|
|
.Xr mac_seeotheruids 4 ,
|
|
|
|
.Xr mac_test 4 ,
|
|
|
|
.Xr mac 9
|
|
|
|
.Sh HISTORY
|
|
|
|
MAC first appeared in
|
2004-02-13 22:08:16 +00:00
|
|
|
.Fx 5.0
|
|
|
|
and
|
|
|
|
.Nm
|
|
|
|
first appeared in
|
|
|
|
.Fx 5.1 .
|
2003-03-31 08:10:10 +00:00
|
|
|
.Sh AUTHORS
|
|
|
|
This software was contributed to the
|
|
|
|
.Fx
|
|
|
|
Project by NAI Labs, the Security Research Division of Network Associates
|
2004-07-03 18:29:24 +00:00
|
|
|
Inc.\& under DARPA/SPAWAR contract N66001-01-C-8035
|
2003-05-29 21:28:36 +00:00
|
|
|
.Pq Dq CBOSS ,
|
2003-03-31 08:10:10 +00:00
|
|
|
as part of the DARPA CHATS research program.
|