3 # Copyright (c) 2012 Intel Corporation
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, version 2.
9 # This program is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # General Public License for more details.
14 # You should have received a copy of the GNU General Public
15 # License along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 # Brian McGillion <brian.mcgillion@intel.com>
22 # Description: Initialize Smack policy
25 # Provides: smack-utils
26 # Required-Start: $remote_fs $local_fs
27 # Required-Stop: $remote_fs $local_fs
28 # Default-Start: 2 3 4 5
30 # Short-Description: Utility to set up SMACK policy
31 # Description: SMACK is a simplified mandatory access control \
32 # framework using an the LSM interface of the kernel. \
33 # The access control rules are loaded using smackfs \
37 PATH=/sbin:/usr/sbin:/bin:/usr/bin
40 DESC="Simplified MAC Kernel (SMACK)"
41 SMACKCTL=/usr/bin/smackctl
43 # Check kernel whether smack is supported
44 [ `grep -c smack /proc/filesystems` -eq 1 ] || exit 0
47 # Mount smackfs in /smack
50 if [ ! -d /smack ] ; then
51 test -e /smack && rm -f /smack
54 if ! grep -E -qs smackfs /etc/mtab; then
55 mount -t smackfs smackfs /smack > /dev/null 2>&1
61 echo -n "Starting $DESC ..."
63 /usr/bin/smackctl apply
67 if [ ! -e /smack/load2 ] ; then
71 reload|force-reload|restart|try-restart)
72 echo -n "Reloading $DESC ..."
73 /usr/bin/smackctl clear
74 /usr/bin/smackctl apply
78 echo -n "Stopping $DESC ..."
79 /usr/bin/smackctl clear
83 echo $"Usage: $0 {start|stop|reload|force-reload|restart|try-restart|status}"