grahamperrin

FreeBSD 16.0-CURRENT: mac(4)

Mar 21st, 2026
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.55 KB | Software | 0 0
  1. MAC(4) FreeBSD Kernel Interfaces Manual MAC(4)
  2.  
  3. NAME
  4. mac – Mandatory Access Control
  5.  
  6. SYNOPSIS
  7. options MAC
  8.  
  9. DESCRIPTION
  10. Introduction
  11. The Mandatory Access Control, or MAC, framework allows administrators to
  12. finely control system security by providing for a loadable security
  13. policy architecture. It is important to note that due to its nature, MAC
  14. security policies may only restrict access relative to one another and
  15. the base system policy; they cannot override traditional Unix security
  16. provisions such as file permissions and superuser checks.
  17.  
  18. Currently, the following MAC policy modules are shipped with FreeBSD:
  19.  
  20. Name Description Labeling Load time
  21. mac_biba(4) Biba integrity policy yes boot only
  22. mac_bsdextended(4) File system firewall no any time
  23. mac_ddb(4) ddb(4) interface restrictions no any time
  24. mac_do(4) Change command's uid/gid no any time
  25. mac_ifoff(4) Interface silencing no any time
  26. mac_ipacl(4) IP Address access control no any time
  27. mac_lomac(4) Low-Watermark MAC policy yes boot only
  28. mac_mls(4) Confidentiality policy yes boot only
  29. mac_ntpd(4) Non-root NTP Daemon policy no any time
  30. mac_partition(4) Process partition policy yes any time
  31. mac_portacl(4) Port bind(2) access control no any time
  32. mac_priority(4) Scheduling priority policy no any time
  33. mac_seeotheruids(4) See-other-UIDs policy no any time
  34. mac_test(4) MAC testing policy no any time
  35.  
  36. MAC Labels
  37. Each system subject (processes, sockets, etc.) and each system object
  38. (file system objects, sockets, etc.) can carry with it a MAC label. MAC
  39. labels contain data in an arbitrary format taken into consideration in
  40. making access control decisions for a given operation. Most MAC labels
  41. on system subjects and objects can be modified directly or indirectly by
  42. the system administrator. The format for a given policy's label may vary
  43. depending on the type of object or subject being labeled. More
  44. information on the format for MAC labels can be found in the maclabel(7)
  45. man page.
  46.  
  47. MAC Support for UFS2 File Systems
  48. By default, file system enforcement of labeled MAC policies relies on a
  49. single file system label (see MAC Labels) in order to make access control
  50. decisions for all the files in a particular file system. With some
  51. policies, this configuration may not allow administrators to take full
  52. advantage of features. In order to enable support for labeling files on
  53. an individual basis for a particular file system, the “multilabel” flag
  54. must be enabled on the file system. To set the “multilabel” flag, drop
  55. to single-user mode and unmount the file system, then execute the
  56. following command:
  57.  
  58. tunefs -l enable filesystem
  59.  
  60. where filesystem is either the mount point (in fstab(5)) or the special
  61. file (in /dev) corresponding to the file system on which to enable
  62. multilabel support.
  63.  
  64. Policy Enforcement
  65. Policy enforcement is divided into the following areas of the system:
  66.  
  67. File System
  68. File system mounts, modifying directories, modifying files, etc.
  69.  
  70. KLD
  71. Loading, unloading, and retrieving statistics on loaded kernel modules
  72.  
  73. Network
  74. Network interfaces, bpf(4), packet delivery and transmission, interface
  75. configuration (ioctl(2), ifconfig(8))
  76.  
  77. Pipes
  78. Creation of and operation on pipe(2) objects
  79.  
  80. Processes
  81. Debugging (e.g. ktrace(2)), process visibility (ps(1)), process execution
  82. (execve(2)), signalling (kill(2))
  83.  
  84. Sockets
  85. Creation of and operation on socket(2) objects
  86.  
  87. System
  88. Kernel environment (kenv(1)), system accounting (acct(2)), reboot(2),
  89. settimeofday(2), swapon(2), sysctl(3), nfsd(8)-related operations
  90.  
  91. VM
  92. mmap(2)-ed files
  93.  
  94. Setting MAC Labels
  95. From the command line, each type of system object has its own means for
  96. setting and modifying its MAC policy label.
  97.  
  98. Subject/Object Utility
  99. File system object setfmac(8), setfsmac(8)
  100. Network interface ifconfig(8)
  101. TTY (by login class) login.conf(5)
  102. User (by login class) login.conf(5)
  103.  
  104. Additionally, the su(1) and setpmac(8) utilities can be used to run a
  105. command with a different process label than the shell's current label.
  106.  
  107. Programming With MAC
  108. MAC security enforcement itself is transparent to application programs,
  109. with the exception that some programs may need to be aware of additional
  110. errno(2) returns from various system calls.
  111.  
  112. The interface for retrieving, handling, and setting policy labels is
  113. documented in the mac(3) man page.
  114.  
  115. SEE ALSO
  116. mac(3), mac_biba(4), mac_bsdextended(4), mac_ddb(4), mac_do(4),
  117. mac_ifoff(4), mac_ipacl(4), mac_lomac(4), mac_mls(4), mac_none(4),
  118. mac_ntpd(4), mac_partition(4), mac_portacl(4), mac_priority(4),
  119. mac_seeotheruids(4), mac_stub(4), mac_test(4), login.conf(5),
  120. maclabel(7), getfmac(8), getpmac(8), setfmac(8), setpmac(8), mac(9)
  121.  
  122. Mandatory Access Control, The FreeBSD Handbook,
  123. https://docs.FreeBSD.org/en/books/handbook/mac/.
  124.  
  125. HISTORY
  126. The mac implementation first appeared in FreeBSD 5.0 and was developed by
  127. the TrustedBSD Project.
  128.  
  129. AUTHORS
  130. This software was contributed to the FreeBSD Project by Network
  131. Associates Labs, the Security Research Division of Network Associates
  132. Inc. under DARPA/SPAWAR contract N66001-01-C-8035 (“CBOSS”), as part of
  133. the DARPA CHATS research program.
  134.  
  135. BUGS
  136. While the MAC Framework design is intended to support the containment of
  137. the root user, not all attack channels are currently protected by entry
  138. point checks. As such, MAC Framework policies should not be relied on,
  139. in isolation, to protect against a malicious privileged user.
  140.  
  141. FreeBSD 16.0-CURRENT December 30, 2024 MAC(4)
Tags: freebsd
Advertisement
Add Comment
Please, Sign In to add comment