- Change init script to automatically turn on/off allow_ypbind boolean
This commit is contained in:
parent
8c1f662b8d
commit
26d84187d2
23
ypbind.init
23
ypbind.init
@ -27,6 +27,25 @@ OTHER_YPBIND_OPTS=""
|
|||||||
# Check that networking is configured.
|
# Check that networking is configured.
|
||||||
[ ${NETWORKING} = "no" ] && exit 0
|
[ ${NETWORKING} = "no" ] && exit 0
|
||||||
|
|
||||||
|
selinux_on() {
|
||||||
|
[ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled || return
|
||||||
|
echo "Turning on allow_ypbind SELinux boolean"
|
||||||
|
setsebool allow_ypbind=1
|
||||||
|
}
|
||||||
|
|
||||||
|
selinux_off() {
|
||||||
|
[ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled || return
|
||||||
|
allow_ypbind=0
|
||||||
|
. /etc/selinux/config
|
||||||
|
if [ -e /etc/selinux/${SELINUXTYPE}/modules1/active/booleans.local ]; then
|
||||||
|
. /etc/selinux/${SELINUXTYPE}/modules/active/booleans.local
|
||||||
|
fi
|
||||||
|
if [ $allow_ypbind == 0 ]; then
|
||||||
|
echo "Turning off allow_ypbind SELinux boolean"
|
||||||
|
setsebool allow_ypbind=$allow_ypbind
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
DOMAINNAME=`domainname`
|
DOMAINNAME=`domainname`
|
||||||
if [ "$DOMAINNAME" = "(none)" -o "$DOMAINNAME" = "" ]; then
|
if [ "$DOMAINNAME" = "(none)" -o "$DOMAINNAME" = "" ]; then
|
||||||
@ -36,11 +55,13 @@ start() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
selinux_on
|
||||||
echo -n $"Binding to the NIS domain: "
|
echo -n $"Binding to the NIS domain: "
|
||||||
daemon ypbind $OTHER_YPBIND_OPTS
|
daemon ypbind $OTHER_YPBIND_OPTS
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
echo
|
echo
|
||||||
if [ $RETVAL -ne 0 ]; then
|
if [ $RETVAL -ne 0 ]; then
|
||||||
|
selinux_off
|
||||||
return $RETVAL
|
return $RETVAL
|
||||||
fi
|
fi
|
||||||
# the following fixes problems with the init scripts continuing
|
# the following fixes problems with the init scripts continuing
|
||||||
@ -60,6 +81,7 @@ start() {
|
|||||||
logger -t ypbind "bound to NIS server `ypwhich 2> /dev/null`"
|
logger -t ypbind "bound to NIS server `ypwhich 2> /dev/null`"
|
||||||
touch /var/lock/subsys/ypbind
|
touch /var/lock/subsys/ypbind
|
||||||
else
|
else
|
||||||
|
selinux_off
|
||||||
killproc ypbind
|
killproc ypbind
|
||||||
# if we used brute force (like kill -9) we don't want those around
|
# if we used brute force (like kill -9) we don't want those around
|
||||||
if [ x$(domainname) != x ] ; then
|
if [ x$(domainname) != x ] ; then
|
||||||
@ -72,6 +94,7 @@ start() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
|
selinux_off
|
||||||
echo -n $"Shutting down NIS services: "
|
echo -n $"Shutting down NIS services: "
|
||||||
killproc ypbind
|
killproc ypbind
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
|
Loading…
Reference in New Issue
Block a user