summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorbdrewery <bdrewery@FreeBSD.org>2015-09-29 18:51:56 +0000
committerbdrewery <bdrewery@FreeBSD.org>2015-09-29 18:51:56 +0000
commit575059f684c59b5462e1e12a8852e5cb472bc5ff (patch)
treefaf22b4b5601cc7a0b14cf975bd4302a16903cf5 /etc
parent7d7e4c43c4e9b6fc8ab217a7175b1e8a4bd7d0a1 (diff)
downloadFreeBSD-src-575059f684c59b5462e1e12a8852e5cb472bc5ff.zip
FreeBSD-src-575059f684c59b5462e1e12a8852e5cb472bc5ff.tar.gz
When stopping ugidfw, it is not enough to just try unloading the module. If
the module is built-in to the kernel then the kldunload will fail. Rather than do this just check if there are rules and then remove them all. Add requirement on FILESYSTEMS to ensure /usr is present for /usr/sbin/ugidfw and /usr/bin/xargs. This was already effectively the ordering from rcorder(8). MFC after: 2 weeks Relnotes: yes
Diffstat (limited to 'etc')
-rwxr-xr-xetc/rc.d/ugidfw11
1 files changed, 10 insertions, 1 deletions
diff --git a/etc/rc.d/ugidfw b/etc/rc.d/ugidfw
index d65d6a3..09171e4 100755
--- a/etc/rc.d/ugidfw
+++ b/etc/rc.d/ugidfw
@@ -3,6 +3,7 @@
# $FreeBSD$
# PROVIDE: ugidfw
+# REQUIRE: FILESYSTEMS
# BEFORE: LOGIN
# KEYWORD: nojail shutdown
@@ -33,9 +34,17 @@ ugidfw_start()
ugidfw_stop()
{
+ local rulecount
+
# Disable the policy
#
- kldunload mac_bsdextended
+ # Check for the existence of rules and flush them if needed.
+ rulecount=$(sysctl -in security.mac.bsdextended.rule_count)
+ if [ ${rulecount:-0} -gt 0 ]; then
+ ugidfw list | sed -n '2,$p' | cut -d ' ' -f 1 | sort -r -n |
+ xargs -n 1 ugidfw remove
+ echo "MAC bsdextended rules flushed."
+ fi
}
load_rc_config $name
OpenPOWER on IntegriCloud