MAC(4)
π
MAC(4) β Mandatory Access Control (Kernel Interfaces Manual, bestie) π
π NAME π
mac β Mandatory Access Control
β¨ SYNOPSIS β¨
options MAC
π¦ DESCRIPTION π¦
πΈ Introduction πΈ
Okay so the Mandatory Access Control framework β MAC for short β lets administrators finely control system security by providing a loadable security policy architecture. It is important to note that due to its nature, MAC security policies may only restrict access relative to one another and the base system policy; they cannot override traditional Unix security provisions such as file permissions and superuser checks.
π¨ Vibe check, bestie: MAC policies restrict relative to each other and the base system policy. They do not override classic Unix security like file permissions and superuser checks. No cap.
Currently, the following MAC policy modules are shipped with FreeBSD:
mac_biba(4)β Biba integrity policy Β· labeling: yes Β· load time: boot onlymac_bsdextended(4)β File system firewall Β· labeling: no Β· load time: any timemac_ddb(4)βddb(4)interface restrictions Β· labeling: no Β· load time: any timemac_do(4)β Change command's uid/gid Β· labeling: no Β· load time: any timemac_ifoff(4)β Interface silencing Β· labeling: no Β· load time: any timemac_ipacl(4)β IP Address access control Β· labeling: no Β· load time: any timemac_lomac(4)β Low-Watermark MAC policy Β· labeling: yes Β· load time: boot onlymac_mls(4)β Confidentiality policy Β· labeling: yes Β· load time: boot onlymac_ntpd(4)β Non-root NTP Daemon policy Β· labeling: no Β· load time: any timemac_partition(4)β Process partition policy Β· labeling: yes Β· load time: any timemac_portacl(4)β Portbind(2)access control Β· labeling: no Β· load time: any timemac_priority(4)β Scheduling priority policy Β· labeling: no Β· load time: any timemac_seeotheruids(4)β See-other-UIDs policy Β· labeling: no Β· load time: any timemac_test(4)β MAC testing policy Β· labeling: no Β· load time: any time
π·οΈ MAC Labels π·οΈ
Each system subject (processes, sockets, etc.) and each system object (file system objects, sockets, etc.) can carry with it a MAC label. MAC labels contain data in an arbitrary format taken into consideration in making access control decisions for a given operation. Most MAC labels on system subjects and objects can be modified directly or indirectly by the system administrator. The format for a given policy's label may vary depending on the type of object or subject being labeled. More information on the format for MAC labels can be found in the maclabel(7) man page.
ποΈ MAC Support for UFS2 File Systems ποΈ
By default, file system enforcement of labeled MAC policies relies on a single file system label (see βMAC Labelsβ) in order to make access control decisions for all the files in a particular file system. With some policies, this configuration may not allow administrators to take full advantage of features. In order to enable support for labeling files on an individual basis for a particular file system, the βmultilabelβ flag must be enabled on the file system. To set the βmultilabelβ flag, drop to single-user mode and unmount the file system, then execute the following command:
tunefs -l enable filesystem
where filesystem is either the mount point (in fstab(5)) or the special file (in /dev) corresponding to the file system on which to enable multilabel support.
π Policy Enforcement π
Policy enforcement is divided into the following areas of the system:
- File System β File system mounts, modifying directories, modifying files, etc.
- KLD β Loading, unloading, and retrieving statistics on loaded kernel modules
- Network β Network interfaces,
bpf(4), packet delivery and transmission, interface configuration (ioctl(2),ifconfig(8)) - Pipes β Creation of and operation on
pipe(2)objects - Processes β Debugging (e.g.
ktrace(2)), process visibility (ps(1)), process execution (execve(2)), signalling (kill(2)) - Sockets β Creation of and operation on
socket(2)objects - System β Kernel environment (
kenv(1)), system accounting (acct(2)),reboot(2),settimeofday(2),swapon(2),sysctl(3),nfsd(8)-related operations - VM β
mmap(2)-ed files
π Setting MAC Labels π
From the command line, each type of system object has its own means for setting and modifying its MAC policy label.
- File system object β
setfmac(8),setfsmac(8) - Network interface β
ifconfig(8) - TTY (by login class) β
login.conf(5) - User (by login class) β
login.conf(5)
Additionally, the su(1) and setpmac(8) utilities can be used to run a command with a different process label than the shell's current label.
π§ Programming With MAC π§
MAC security enforcement itself is transparent to application programs, with the exception that some programs may need to be aware of additional errno(2) returns from various system calls.
The interface for retrieving, handling, and setting policy labels is documented in the mac(3) man page.
π SEE ALSO π
mac(3), mac_biba(4), mac_bsdextended(4), mac_ddb(4), mac_do(4), mac_ifoff(4), mac_ipacl(4), mac_lomac(4), mac_mls(4), mac_none(4), mac_ntpd(4), mac_partition(4), mac_portacl(4), mac_priority(4), mac_seeotheruids(4), mac_stub(4), mac_test(4), login.conf(5), maclabel(7), getfmac(8), getpmac(8), setfmac(8), setpmac(8), mac(9)
βMandatory Access Controlβ, The FreeBSD Handbook, https://docs.FreeBSD.org/en/books/handbook/mac/.
β³ HISTORY β³
The mac implementation first appeared in FreeBSD 5.0 and was developed by the TrustedBSD Project.
π«Ά AUTHORS π«Ά
This software was contributed to the FreeBSD Project by 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.
π BUGS π
π¨ Real talk, bestie: while the MAC Framework design is intended to support the containment of the root user, not all attack channels are currently protected by entry point checks. As such, MAC Framework policies should not be relied on, in isolation, to protect against a malicious privileged user.
π That's the tea, bestie β this MAC(4) page's source/version is Debian, and its date is December 30, 2024. Now go be the main character of access control π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 2003 Networks Associates Technology, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms