2003-04-16 20:40:34 +00:00
|
|
|
.\" Copyright (c) 2001, 2003 Networks Associates Technology, Inc.
|
2009-08-12 10:46:48 +00:00
|
|
|
.\" Copyright (c) 2009 Robert N. M. Watson
|
2002-08-02 21:14:42 +00:00
|
|
|
.\" All rights reserved.
|
2002-12-04 16:28:45 +00:00
|
|
|
.\"
|
2002-08-02 21:14:42 +00:00
|
|
|
.\" This software was developed for the FreeBSD Project by Chris
|
2002-11-04 20:45:44 +00:00
|
|
|
.\" Costello at Safeport Network Services and Network Associates
|
|
|
|
.\" Laboratories, 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.
|
2002-12-04 16:28:45 +00:00
|
|
|
.\"
|
2002-08-02 21:14:42 +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.
|
2002-12-04 16:28:45 +00:00
|
|
|
.\"
|
2002-08-02 21:14:42 +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.
|
2002-12-04 16:28:45 +00:00
|
|
|
.\"
|
2002-08-02 21:14:42 +00:00
|
|
|
.\" $FreeBSD$
|
2002-12-04 16:28:45 +00:00
|
|
|
.\"
|
2009-08-12 10:46:48 +00:00
|
|
|
.Dd August 7, 2009
|
2002-08-02 21:14:42 +00:00
|
|
|
.Dt MAC 3
|
2002-12-11 15:55:29 +00:00
|
|
|
.Os
|
2002-08-02 21:14:42 +00:00
|
|
|
.Sh NAME
|
|
|
|
.Nm mac
|
2003-05-22 13:02:28 +00:00
|
|
|
.Nd introduction to the MAC security API
|
2002-08-02 21:14:42 +00:00
|
|
|
.Sh LIBRARY
|
|
|
|
.Lb libc
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
.In sys/mac.h
|
|
|
|
.Pp
|
|
|
|
In the kernel configuration file:
|
|
|
|
.Cd "options MAC"
|
|
|
|
.Sh DESCRIPTION
|
2009-08-12 10:46:48 +00:00
|
|
|
Mandatory Access Control labels describe confidentiality, integrity, and
|
|
|
|
other security attributes of operating system objects, overriding
|
|
|
|
discretionary access control.
|
|
|
|
Not all system objects support MAC labeling, and MAC policies must be
|
|
|
|
explicitly enabled by the administrator.
|
|
|
|
This API, based on POSIX.1e, includes routines to retrieve, manipulate, set,
|
|
|
|
and convert to and from text the MAC labels on files and processes.
|
2002-08-02 21:14:42 +00:00
|
|
|
.Pp
|
2009-08-12 10:46:48 +00:00
|
|
|
MAC labels consist of a set of (name, value) tuples, representing security
|
|
|
|
attributes from MAC policies.
|
|
|
|
For example, this label contains security labels defined by two policies,
|
|
|
|
.Xr mac_biba 4
|
|
|
|
and
|
|
|
|
.Xr mac_mls 4 :
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
biba/low,mls/low
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
Further syntax and semantics of MAC labels may be found in
|
|
|
|
.Xr maclabel 7 .
|
2002-08-02 21:14:42 +00:00
|
|
|
.Pp
|
2009-08-12 10:46:48 +00:00
|
|
|
Applications operate on labels stored in
|
|
|
|
.Vt mac_t ,
|
|
|
|
but can convert between this internal format and a text format for the
|
|
|
|
purposes of presentation to uses or external storage.
|
|
|
|
When querying a label on an object, a
|
|
|
|
.Vt mac_t
|
|
|
|
must first be prepared using the interfaces described in
|
|
|
|
.Xr mac_prepare 3 ,
|
2010-08-02 16:01:45 +00:00
|
|
|
allowing the application to declare which policies it wishes to interrogate.
|
2009-08-12 10:46:48 +00:00
|
|
|
The application writer can also rely on default label names declared in
|
|
|
|
.Xr mac.conf 5 .
|
|
|
|
.Pp
|
|
|
|
When finished with a
|
|
|
|
.Vt mac_t ,
|
|
|
|
the application must call
|
|
|
|
.Xr mac_free 3
|
|
|
|
to release its storage.
|
|
|
|
.Pp
|
|
|
|
The following functions are defined:
|
2002-08-02 21:14:42 +00:00
|
|
|
.Bl -tag -width indent
|
2009-08-12 10:46:48 +00:00
|
|
|
.It Fn mac_is_present
|
|
|
|
This function, described in
|
|
|
|
.Xr mac_is_present 3 ,
|
|
|
|
allows applications to test whether MAC is configured, as well as whether
|
|
|
|
specific policies are configured.
|
|
|
|
.It Fn mac_get_fd , Fn mac_get_file , Fn mac_get_link , Fn mac_get_peer
|
|
|
|
These functions, described in
|
2002-08-02 21:14:42 +00:00
|
|
|
.Xr mac_get 3 ,
|
2009-08-12 10:46:48 +00:00
|
|
|
retrieve the MAC labels associated with file descriptors, files, and socket
|
|
|
|
peers.
|
|
|
|
.It Fn mac_get_pid , Fn mac_get_proc
|
|
|
|
These functions, described in
|
2002-08-02 21:14:42 +00:00
|
|
|
.Xr mac_get 3 ,
|
2009-08-12 10:46:48 +00:00
|
|
|
retrieve the MAC labels associated with processes.
|
|
|
|
.It Fn mac_set_fd , Fn mac_set_file , Fn mac_set_link
|
|
|
|
These functions, described in
|
2002-08-02 21:14:42 +00:00
|
|
|
.Xr mac_set 3 ,
|
2009-08-12 10:46:48 +00:00
|
|
|
set the MAC labels associated with file descriptors and files.
|
2002-08-02 21:14:42 +00:00
|
|
|
.It Fn mac_set_proc
|
2009-08-12 10:46:48 +00:00
|
|
|
This function, described in
|
2002-08-02 21:14:42 +00:00
|
|
|
.Xr mac_set 3 ,
|
2009-08-12 10:46:48 +00:00
|
|
|
sets the MAC label associated with the current process.
|
2002-08-02 21:14:42 +00:00
|
|
|
.It Fn mac_free
|
2010-08-02 16:01:45 +00:00
|
|
|
This function, described in
|
2002-08-02 21:14:42 +00:00
|
|
|
.Xr mac_free 3 ,
|
2009-08-12 10:46:48 +00:00
|
|
|
frees working MAC label storage.
|
2002-08-02 21:14:42 +00:00
|
|
|
.It Fn mac_from_text
|
2009-08-12 10:46:48 +00:00
|
|
|
This function, described in
|
2002-08-02 21:14:42 +00:00
|
|
|
.Xr mac_text 3 ,
|
2009-08-12 10:46:48 +00:00
|
|
|
converts a text-form MAC label into working MAC label storage,
|
2002-08-02 21:14:42 +00:00
|
|
|
.Vt mac_t .
|
2009-08-12 10:46:48 +00:00
|
|
|
.It Fn mac_prepare , Fn mac_prepare_file_label , Fn mac_prepare_ifnet_label , Fn mac_prepare_process_label , Fn mac_prepare_type
|
|
|
|
These functions, described in
|
2003-04-20 02:56:16 +00:00
|
|
|
.Xr mac_prepare 3 ,
|
2009-08-12 10:46:48 +00:00
|
|
|
allocate working storage for MAC label operations.
|
2003-04-20 02:56:16 +00:00
|
|
|
.Xr mac_prepare 3
|
|
|
|
prepares a label based on caller-specified label names; the other calls
|
|
|
|
rely on the default configuration specified in
|
|
|
|
.Xr mac.conf 5 .
|
2002-08-02 21:14:42 +00:00
|
|
|
.It Fn mac_to_text
|
|
|
|
This function is described in
|
|
|
|
.Xr mac_text 3 ,
|
|
|
|
and may be used to convert a
|
|
|
|
.Vt mac_t
|
|
|
|
into a text-form MAC label.
|
|
|
|
.El
|
2003-04-20 04:43:56 +00:00
|
|
|
.Sh FILES
|
|
|
|
.Bl -tag -width ".Pa /etc/mac.conf" -compact
|
|
|
|
.It Pa /etc/mac.conf
|
|
|
|
MAC library configuration file, documented in
|
|
|
|
.Xr mac.conf 5 .
|
|
|
|
Provides default behavior for applications aware of MAC labels on
|
|
|
|
system objects, but without policy-specific knowledge.
|
|
|
|
.El
|
2002-08-02 21:14:42 +00:00
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr mac_free 3 ,
|
|
|
|
.Xr mac_get 3 ,
|
2009-08-12 10:46:48 +00:00
|
|
|
.Xr mac_is_present 3 ,
|
2003-01-15 00:45:31 +00:00
|
|
|
.Xr mac_prepare 3 ,
|
2002-08-02 21:14:42 +00:00
|
|
|
.Xr mac_set 3 ,
|
2002-10-22 01:52:53 +00:00
|
|
|
.Xr mac_text 3 ,
|
2009-08-12 10:46:48 +00:00
|
|
|
.Xr posix1e 3 ,
|
2003-01-15 03:03:05 +00:00
|
|
|
.Xr mac 4 ,
|
2003-04-20 04:43:56 +00:00
|
|
|
.Xr mac.conf 5 ,
|
2002-10-22 01:52:53 +00:00
|
|
|
.Xr mac 9
|
2002-08-02 21:14:42 +00:00
|
|
|
.Sh STANDARDS
|
2009-08-12 10:46:48 +00:00
|
|
|
These APIs are loosely based on the APIs described in POSIX.1e, as described
|
|
|
|
in IEEE POSIX.1e draft 17.
|
2010-08-02 16:01:45 +00:00
|
|
|
However, the resemblance of these APIs to the POSIX APIs is loose, as the
|
2010-02-11 19:20:06 +00:00
|
|
|
POSIX APIs were unable to express some notions required for flexible and
|
2009-08-12 10:46:48 +00:00
|
|
|
extensible access control.
|
2002-11-04 20:45:44 +00:00
|
|
|
.Sh HISTORY
|
|
|
|
Support for Mandatory Access Control was introduced in
|
|
|
|
.Fx 5.0
|
2002-12-04 16:28:45 +00:00
|
|
|
as part of the
|
|
|
|
.Tn TrustedBSD
|
|
|
|
Project.
|
2002-11-04 20:42:58 +00:00
|
|
|
.Sh BUGS
|
2002-12-04 16:28:45 +00:00
|
|
|
The
|
|
|
|
.Tn TrustedBSD
|
|
|
|
MAC Framework and associated policies, interfaces, and
|
2002-11-04 20:42:58 +00:00
|
|
|
applications are considered to be an experimental feature in
|
|
|
|
.Fx .
|
|
|
|
Sites considering production deployment should keep the experimental
|
|
|
|
status of these services in mind during any deployment process.
|
|
|
|
See also
|
|
|
|
.Xr mac 9
|
|
|
|
for related considerations regarding the kernel framework.
|