17.11. The MAC Partition Policy

Module name: mac_partition.ko

Kernel configuration line: options MAC_PARTITION

Boot option: mac_partition_load="YES"

The mac_partition(4) policy will drop processes into specific partitions based on their MAC label. This module should be added to loader.conf(5) so that it loads and enables the policy at system boot.

Most configuration for this policy is done using setpmac(8). One sysctl tunable is available for this policy:

When this policy is enabled, users will only be permitted to see their processes, and any others within their partition, but will not be permitted to work with utilities outside the scope of this partition. For instance, a user in the insecure class will not be permitted to access top as well as many other commands that must spawn a process.

To set or drop utilities into a partition label, use the setpmac utility:

# setpmac partition/13 top

This example adds top to the label set on users in the insecure class. All processes spawned by users in the insecure class will stay in the partition/13 label.

17.11.1. Examples

The following command will display the partition label and the process list:

# ps Zax

This command will display another user's process partition label and that user's currently running processes:

# ps -ZU trhodes


Users can see processes in root's label unless the mac_seeotheruids(4) policy is loaded.

A really crafty implementation could have all of the services disabled in /etc/rc.conf and started by a script that starts them with the proper labeling set.


The following policies support integer settings in place of the three default labels offered. These options, including their limitations, are further explained in the module manual pages.

All FreeBSD documents are available for download at http://ftp.FreeBSD.org/pub/FreeBSD/doc/

Questions that are not answered by the documentation may be sent to <freebsd-questions@FreeBSD.org>.

Send questions about this document to <freebsd-doc@FreeBSD.org>.