MAC_BSDEXTENDED(4)
π mac_bsdextended(4) β the file system firewall policy π
okay bestie, gather round, because this one is literally a firewall but for files, and it's iconic. welcome to mac_bsdextended(4), the mandatory access control module that goes "no ma'am" to specific users touching specific things. let's get into it π
β¨ NAME β¨
mac_bsdextended β file system firewall policy π¦
β¨ SYNOPSIS β¨
so there's two ways to get this bad boy living in your kernel, and you gotta pick your fighter π
Option 1: compile it in. drop these lines into your kernel config file:
options MAC
options MAC_BSDEXTENDED
Option 2: load the module at boot time instead. then you only need this in your kernel config file:
options MAC
aaaand then over in loader.conf(5) you add:
mac_bsdextended_load="YES"
slay, that's it, no cap β¨
β¨ DESCRIPTION β¨
the mac_bsdextended security policy module is basically a whole interface for the system administrator to lay down mandatory rules about users and, like, some system objects. you upload rules to the module β usually with ugidfw(8), or honestly whatever other tool is vibing with libugidfw(3) β and the module keeps them stored internally, then uses them to decide whether to allow or deny specific accesses. (go peek at ugidfw(8) for the deets, bestie.)
β¨ IMPLEMENTATION NOTES β¨
okay so here's the tea: even though the traditional mac(9) entry points are implemented, policy labels are not used. instead, access control decisions happen by iterating through the internal list of rules until it finds a rule that denies that particular access β or until it just runs out of list. π
the mac_bsdextended policy works kinda like ipfw(8), or, if you prefer, it uses a first match semantic. what that means fr fr is that not all rules get applied β only the first matched rule does. so if Rule A allows access and Rule B blocks access, Rule B will never be applied. periodt. π
π«Ά Sysctls π«Ά
these sysctls are your little knobs for tweaking how mac_bsdextended behaves:
security.mac.bsdextended.enabledβ set it to zero or one to toggle the policy off or on.security.mac.bsdextended.rule_countβ lists the number of defined rules; the maximum rule count is currently set at 256.security.mac.bsdextended.rule_slotsβ lists the number of rule slots currently being used.security.mac.bsdextended.firstmatch_enabledβ toggles between the old all-rules-match functionality and the new first-rule-matches functionality. this one is enabled by default.security.mac.bsdextended.loggingβ logs all access violations via theAUTHPRIVsyslog(3)facility.security.mac.bsdextended.rulesβ currently does nothing interesting. π (iconic honestly, it's just there, existing, main character energy with no plot)
β¨ SEE ALSO β¨
go read these next, they're all part of the cinematic universe π
libugidfw(3), syslog(3), mac(4), mac_biba(4), mac_ifoff(4), mac_lomac(4), mac_mls(4), mac_none(4), mac_partition(4), mac_portacl(4), mac_seeotheruids(4), mac_test(4), ipfw(8), ugidfw(8), mac(9)
β¨ HISTORY β¨
the mac_bsdextended policy module first appeared in FreeBSD 5.0, and it was developed by the TrustedBSD Project. π
the "match first case" and logging capabilities were later added by Tom Rhodes <trhodes@FreeBSD.org>. π
β¨ AUTHORS β¨
this software was contributed to the FreeBSD Project by NAI 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. π«‘
and that's the whole page, bestie!! this one came from the Debian corner of the universe, dated May 21, 2005 β vintage but still eating π β¨ mwah, go firewall some files π¦π
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 2002 Networks Associates Technology, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms