2004-09-09 09:27:26 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# rpcsvcgssd Start up and shut down RPCSEC GSS daemon
|
|
|
|
#
|
2009-11-03 13:52:20 +00:00
|
|
|
# chkconfig: - 31 69
|
2004-09-09 09:27:26 +00:00
|
|
|
# description: Starts user-level daemon that manages RPCSEC GSS contexts \
|
2009-06-10 16:14:13 +00:00
|
|
|
# for the NFS server.
|
|
|
|
|
|
|
|
### BEGIN INIT INFO
|
|
|
|
# Provides: rpcsvcgssd
|
|
|
|
# Required-Start: $network $syslog
|
|
|
|
# Required-Stop: $network $syslog
|
|
|
|
# Default-Stop: 0 1 6
|
|
|
|
# Short-Description: Starts the RPCSEC GSS server daemon
|
|
|
|
# Description: NFS is a popular protocol for file sharing across \
|
|
|
|
# networks. This deamon manages RPCSEC GSS contexts on the
|
|
|
|
# server used by secure NFS mounts
|
|
|
|
### END INIT INFO
|
2004-09-09 09:27:26 +00:00
|
|
|
|
|
|
|
# Source function library.
|
|
|
|
. /etc/init.d/functions
|
|
|
|
|
|
|
|
# Source networking configuration.
|
2008-09-16 20:29:11 +00:00
|
|
|
[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
|
2004-09-09 09:27:26 +00:00
|
|
|
|
|
|
|
# Check for and source configuration file otherwise set defaults
|
|
|
|
[ -f /etc/sysconfig/nfs ] && . /etc/sysconfig/nfs
|
|
|
|
|
|
|
|
RETVAL=0
|
|
|
|
prog="rpc.svcgssd"
|
2010-10-15 20:25:05 +00:00
|
|
|
LOCKFILE=/var/lock/subsys/$prog
|
|
|
|
uid=`id | cut -d\( -f1 | cut -d= -f2`
|
2004-09-09 09:27:26 +00:00
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start|condstart)
|
2008-09-16 20:29:11 +00:00
|
|
|
# Check that networking is up.
|
|
|
|
[ "${NETWORKING}" != "yes" ] && exit 6
|
|
|
|
[ "${SECURE_NFS}" != "yes" ] && exit 6
|
|
|
|
[ ! -x /usr/sbin/rpc.svcgssd ] && exit 5
|
2010-10-15 20:25:05 +00:00
|
|
|
# Only root can start the service
|
|
|
|
[ $uid -ne 0 ] && exit 4
|
2008-09-16 20:29:11 +00:00
|
|
|
|
2004-09-09 09:27:26 +00:00
|
|
|
# Make sure the daemon is not already running.
|
|
|
|
if status $prog > /dev/null ; then
|
|
|
|
exit 0
|
|
|
|
fi
|
2006-01-11 21:55:51 +00:00
|
|
|
rm -f $LOCKFILE
|
2004-09-09 09:27:26 +00:00
|
|
|
|
2005-02-14 19:29:31 +00:00
|
|
|
echo -n $"Starting RPC svcgssd: "
|
2008-09-16 20:29:11 +00:00
|
|
|
# List of kernel modules to load
|
|
|
|
[ -z "${SECURE_NFS_MODS}" ] && SECURE_NFS_MODS="des rpcsec_gss_krb5"
|
|
|
|
|
2007-07-30 10:10:07 +00:00
|
|
|
# Make sure the rpc_pipefs filesystem is available
|
2011-05-17 15:39:06 +00:00
|
|
|
/bin/mount -t rpc_pipefs sunrpc /var/lib/nfs/rpc_pipefs > /dev/null 2>&1
|
|
|
|
|
2007-07-30 10:10:07 +00:00
|
|
|
[ "${SECURE_NFS_MODS}" != "noload" ] && {
|
|
|
|
[ -x /sbin/lsmod -a -x /sbin/modprobe ] && {
|
2005-02-14 19:29:31 +00:00
|
|
|
# Load rpcsec modules
|
2007-07-30 10:10:07 +00:00
|
|
|
for i in ${SECURE_NFS_MODS}
|
|
|
|
do
|
|
|
|
if ! /sbin/lsmod | grep $i > /dev/null ; then
|
|
|
|
/sbin/modprobe $i || {
|
|
|
|
echo "Error: Unable to load '$i' security module."
|
|
|
|
exit 6;
|
|
|
|
}
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
2004-09-09 09:27:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Start daemon.
|
2007-05-15 15:03:52 +00:00
|
|
|
daemon $prog ${RPCSVCGSSDARGS}
|
2004-09-09 09:27:26 +00:00
|
|
|
RETVAL=$?
|
|
|
|
echo
|
2006-01-11 21:55:51 +00:00
|
|
|
[ $RETVAL -eq 0 ] && touch $LOCKFILE
|
2004-09-09 09:27:26 +00:00
|
|
|
;;
|
|
|
|
stop)
|
2010-10-15 20:25:05 +00:00
|
|
|
# Just exit if not configured
|
|
|
|
[ "${SECURE_NFS}" != "yes" ] && exit 6
|
|
|
|
|
|
|
|
# Only root can stop the service
|
|
|
|
[ $uid -ne 0 ] && exit 4
|
|
|
|
|
2004-09-09 09:27:26 +00:00
|
|
|
# Stop daemon.
|
2005-02-14 19:29:31 +00:00
|
|
|
echo -n $"Shutting down RPC svcgssd: "
|
2004-09-09 09:27:26 +00:00
|
|
|
killproc $prog
|
|
|
|
RETVAL=$?
|
|
|
|
echo
|
2007-08-02 15:54:05 +00:00
|
|
|
rm -f $LOCKFILE
|
2004-09-09 09:27:26 +00:00
|
|
|
;;
|
|
|
|
status)
|
|
|
|
status rpc.svcgssd
|
|
|
|
RETVAL=$?
|
|
|
|
;;
|
2010-10-15 20:25:05 +00:00
|
|
|
restart|reload|force-reload)
|
2004-09-09 09:27:26 +00:00
|
|
|
$0 stop
|
|
|
|
$0 start
|
|
|
|
RETVAL=$?
|
|
|
|
;;
|
2010-10-15 20:25:05 +00:00
|
|
|
condrestart|try-restart)
|
2006-01-11 21:55:51 +00:00
|
|
|
if [ -f $LOCKFILE ]; then
|
2004-09-09 09:27:26 +00:00
|
|
|
$0 restart
|
|
|
|
RETVAL=$?
|
|
|
|
fi
|
|
|
|
;;
|
2008-07-02 23:35:53 +00:00
|
|
|
condstop)
|
|
|
|
if [ -f $LOCKFILE ]; then
|
|
|
|
$0 stop
|
|
|
|
RETVAL=$?
|
|
|
|
fi
|
|
|
|
;;
|
2004-09-09 09:27:26 +00:00
|
|
|
*)
|
2010-10-15 20:25:05 +00:00
|
|
|
echo $"Usage: $0 {start|stop|restart|force-reload|condstart|condrestart|try-restart|status|condstop}"
|
|
|
|
RETVAL=2
|
2007-07-30 10:10:07 +00:00
|
|
|
;;
|
2004-09-09 09:27:26 +00:00
|
|
|
esac
|
|
|
|
|
|
|
|
exit $RETVAL
|