- Converted init scrips to systemd services. (bz 699040)

- Made nfsnobody's uid/gid to always be a 16-bit value of -2

Signed-off-by: Steve Dickson <steved@redhat.com>
This commit is contained in:
Steve Dickson 2011-08-03 06:09:46 -04:00
parent 2281ec5d7e
commit 67ebcf9f55
16 changed files with 199 additions and 808 deletions

12
nfs-idmap.service Normal file
View File

@ -0,0 +1,12 @@
[Unit]
Description=NFSv4 ID-name mapping daemon
Wants=var-lib-nfs-rpc_pipefs.mount
Requires=var-lib-nfs-rpc_pipefs.mount
[Service]
Type=forking
EnvironmentFile=-/etc/sysconfig/nfs
ExecStart=/usr/sbin/rpc.idmapd $RPCIDMAPDARGS
[Install]
WantedBy=multi-user.target

17
nfs-lock.preconfig Normal file
View File

@ -0,0 +1,17 @@
#!/bin/sh
. /etc/sysconfig/nfs
# Make sure lockd is loaded
/sbin/modprobe -q lockd $LOCKDARG
# See if the kernel lockd should start up
# listening on a particular port
#
if [ -n "$LOCKD_TCPPORT" -o -n "$LOCKD_UDPPORT" ]; then
[ -n "$LOCKD_TCPPORT" ] && \
/sbin/sysctl -w fs.nfs.nlm_tcpport=$LOCKD_TCPPORT >/dev/null 2>&1
[ -n "$LOCKD_UDPPORT" ] && \
/sbin/sysctl -w fs.nfs.nlm_udpport=$LOCKD_UDPPORT >/dev/null 2>&1
fi

14
nfs-lock.service Normal file
View File

@ -0,0 +1,14 @@
[Unit]
Description=NFS file locking service.
After=network.target rpcbind.service
[Service]
Type=forking
EnvironmentFile=-/etc/sysconfig/nfs
ExecStartPre=/usr/lib/nfs-utils/scripts/nfs-lock.preconfig
ExecStart=/sbin/rpc.statd $STATDARG
# Make sure lockd's ports are reset
ExecStopPost=-/sbin/sysctl -w fs.nfs.nlm_tcpport=0 fs.nfs.nlm_udpport=0
[Install]
WantedBy=multi-user.target

13
nfs-secure-server.service Normal file
View File

@ -0,0 +1,13 @@
[Unit]
Description=Secure NFS Server
Requires=var-lib-nfs-rpc_pipefs.mount nfs-server.service
After=var-lib-nfs-rpc_pipefs.mount nfs-server.service
[Service]
Type=forking
EnvironmentFile=-/etc/sysconfig/nfs
ExecStart=/usr/sbin/rpc.svcgssd $RPCSVCGSSDARGS
[Install]
WantedBy=multi-user.target

12
nfs-secure.service Normal file
View File

@ -0,0 +1,12 @@
[Unit]
Description=Secure NFS
After=var-lib-nfs-rpc_pipefs.mount
Requires=var-lib-nfs-rpc_pipefs.mount
[Service]
Type=forking
EnvironmentFile=-/etc/sysconfig/nfs
ExecStart=/usr/sbin/rpc.gssd $RPCGSSDARGS
[Install]
WantedBy=multi-user.target

17
nfs-server.postconfig Normal file
View File

@ -0,0 +1,17 @@
#!/bin/sh
. /etc/sysconfig/nfs
# Tell idmapd the server is up and running
/usr/bin/pkill -HUP rpc.idmapd
#
# Enabled the RDMA server support if configured to do so.
#
# Make sure the modules is loaded
[ -n "$RDMA_PORT" ] && /sbin/modprobe svcrdma
# Enable the server to listen on the given port
[ -n "$RDMA_PORT" ] && echo "rdma $RDMA_PORT" > /proc/fs/nfsd/portlist
exit 0

10
nfs-server.preconfig Normal file
View File

@ -0,0 +1,10 @@
#!/bin/bash
. /etc/sysconfig/nfs
# Set v4 grace period if requested
[ -n "$NFSD_V4_GRACE" ] && {
echo "$NFSD_V4_GRACE" > /proc/fs/nfsd/nfsv4gracetime
}
exit 0

19
nfs-server.service Normal file
View File

@ -0,0 +1,19 @@
[Unit]
Description=NFS Protocol Daemon
After=network.target rpcbind.service
[Service]
Type=forking
EnvironmentFile=-/etc/sysconfig/nfs
EnvironmentFile=/usr/lib/nfs-utils/scripts/nfs-server.preconfig
ExecStartPre=-/usr/sbin/rpc.rquotad $RPCRQUOTADOPTS
ExecStartPre=/usr/sbin/exportfs -r
ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS ${RPCNFSDCOUNT}
ExecStartPost=/usr/sbin/rpc.mountd $RPCMOUNTDOPTS
ExecStartPost=-/usr/lib/nfs-utils/scripts/nfs-server.postconfig
ExecStop=/usr/sbin/rpc.nfsd 0
ExecStopPost=/usr/sbin/exportfs -f
[Install]
WantedBy=multi-user.target

View File

@ -2,7 +2,7 @@ Summary: NFS utilities and supporting clients and daemons for the kernel NFS ser
Name: nfs-utils
URL: http://sourceforge.net/projects/nfs
Version: 1.2.4
Release: 3%{?dist}
Release: 4%{?dist}
Epoch: 1
# group all 32bit related archs
@ -10,12 +10,19 @@ Epoch: 1
Source0: http://www.kernel.org/pub/linux/utils/nfs/%{name}-%{version}.tar.bz2
Source10: nfs.init
Source11: nfslock.init
Source12: rpcidmapd.init
Source13: rpcgssd.init
Source14: rpcsvcgssd.init
Source15: nfs.sysconfig
Source10: nfs.sysconfig
Source11: nfs-lock.service
Source12: nfs-secure.service
Source13: nfs-secure-server.service
Source14: nfs-server.service
Source15: nfs-idmap.service
Source16: var-lib-nfs-rpc_pipefs.mount
%define nfs_services %{SOURCE11} %{SOURCE12} %{SOURCE13} %{SOURCE14} %{SOURCE15} %{SOURCE16}
Source50: nfs-lock.preconfig
Source51: nfs-server.preconfig
Source52: nfs-server.postconfig
%define nfs_configs %{SOURCE50} %{SOURCE51} %{SOURCE52}
Patch001: nfs-utils.1.2.5-rc1.patch
@ -55,6 +62,9 @@ Requires(pre): shadow-utils >= 4.0.3-25
Requires(pre): /sbin/chkconfig /sbin/nologin
Requires: libnfsidmap libgssglue libevent
Requires: libtirpc libblkid libcap libmount
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
%description
The nfs-utils package provides a daemon for the kernel NFS server and
@ -107,18 +117,21 @@ make %{?_smp_mflags} all
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT{/sbin,/usr/sbin}
mkdir -p $RPM_BUILD_ROOT{/sbin,/usr/sbin,/lib/systemd/system}
mkdir -p $RPM_BUILD_ROOT/usr/lib/%{name}/scripts
mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man8
mkdir -p $RPM_BUILD_ROOT{/etc/rc.d/init.d,/etc/sysconfig}
mkdir -p $RPM_BUILD_ROOT/etc/sysconfig
make DESTDIR=$RPM_BUILD_ROOT install
install -s -m 755 tools/rpcdebug/rpcdebug $RPM_BUILD_ROOT/usr/sbin
install -m 755 %{SOURCE10} $RPM_BUILD_ROOT/etc/rc.d/init.d/nfs
install -m 755 %{SOURCE11} $RPM_BUILD_ROOT/etc/rc.d/init.d/nfslock
install -m 755 %{SOURCE12} $RPM_BUILD_ROOT/etc/rc.d/init.d/rpcidmapd
install -m 755 %{SOURCE13} $RPM_BUILD_ROOT/etc/rc.d/init.d/rpcgssd
install -m 755 %{SOURCE14} $RPM_BUILD_ROOT/etc/rc.d/init.d/rpcsvcgssd
install -m 644 %{SOURCE15} $RPM_BUILD_ROOT/etc/sysconfig/nfs
install -m 644 utils/mount/nfsmount.conf $RPM_BUILD_ROOT/etc
install -m 644 %{SOURCE10} $RPM_BUILD_ROOT/etc/sysconfig/nfs
for service in %{nfs_services} ; do
install -m 644 $service $RPM_BUILD_ROOT/lib/systemd/system
done
for config in %{nfs_configs} ; do
install -m 755 $config $RPM_BUILD_ROOT/usr/lib/%{name}/scripts
done
mkdir -p $RPM_BUILD_ROOT/var/lib/nfs/rpc_pipefs
@ -133,6 +146,7 @@ mkdir -p $RPM_BUILD_ROOT/var/lib/nfs/v4recovery
rm -rf $RPM_BUILD_ROOT
%pre
# move files so the running service will have this applied as well
for x in gssd svcgssd idmapd ; do
if [ -f /var/lock/subsys/rpc.$x ]; then
@ -142,48 +156,47 @@ done
/usr/sbin/useradd -l -c "RPC Service User" -r \
-s /sbin/nologin -u 29 -d /var/lib/nfs rpcuser 2>/dev/null || :
# Define the correct unsigned uid value for 32 or 64 bit archs
%ifarch %{all_32bit_archs}
%define nfsnobody_uid 65534
%else
%define nfsnobody_uid 4294967294
%endif
/usr/sbin/groupadd -g 29 rpcuser 2>/dev/null || :
# If GID 65534 (or 4294967294 64bit archs) is unassigned,
# create group "nfsnobody"
# Using the 16-bit value of -2 for the nfsnobody uid and gid
%define nfsnobody_uid 65534
# Create nfsnobody gid as long as it does not already exist
cat /etc/group | cut -d':' -f 3 | grep --quiet %{nfsnobody_uid} 2>/dev/null
if [ "$?" -eq 1 ]; then
/usr/sbin/groupadd -g %{nfsnobody_uid} nfsnobody 2>/dev/null || :
else
/usr/sbin/groupmod -g %{nfsnobody_uid} nfsnobody 2>/dev/null || :
fi
# If UID 65534 (or 4294967294 64bit archs) is unassigned,
# create user "nfsnobody"
# Create nfsnobody uid as long as it does not already exist.
cat /etc/passwd | cut -d':' -f 3 | grep --quiet %{nfsnobody_uid} 2>/dev/null
if [ "$?" -eq 1 ]; then
/usr/sbin/useradd -l -c "Anonymous NFS User" -r -g %{nfsnobody_uid} \
-s /sbin/nologin -u %{nfsnobody_uid} -d /var/lib/nfs nfsnobody 2>/dev/null || :
else
/usr/sbin/usermod -u %{nfsnobody_uid} nfsnobody 2>/dev/null || :
fi
%post
/sbin/chkconfig --add nfs
/sbin/chkconfig --add nfslock
/sbin/chkconfig --add rpcidmapd
/sbin/chkconfig --add rpcgssd
/sbin/chkconfig --add rpcsvcgssd
if [ $1 -eq 1 ]; then
# Package install, not upgrade
/bin/systemctl enable nfs-idmap.service >/dev/null 2>&1 || :
/bin/systemctl enable nfs-lock.service >/dev/null 2>&1 || :
fi
# Make sure statd used the correct uid/gid.
chown -R rpcuser:rpcuser /var/lib/nfs/statd
%preun
if [ "$1" = "0" ]; then
/etc/rc.d/init.d/nfs condstop > /dev/null
/etc/rc.d/init.d/rpcgssd condstop > /dev/null
/etc/rc.d/init.d/rpcidmapd condstop > /dev/null
/etc/rc.d/init.d/nfslock condstop > /dev/null
/sbin/chkconfig --del rpcidmapd
/sbin/chkconfig --del rpcgssd
/sbin/chkconfig --del rpcsvcgssd
/sbin/chkconfig --del nfs
/sbin/chkconfig --del nfslock
# Package removal, not upgrade
for service in %{nfs_services} ; do
/bin/systemctl disable $service >/dev/null 2>&1 || :
/bin/systemctl stop $service >/dev/null 2>&1 || :
done
/usr/sbin/userdel rpcuser 2>/dev/null || :
/usr/sbin/groupdel rpcuser 2>/dev/null || :
/usr/sbin/userdel nfsnobody 2>/dev/null || :
@ -193,28 +206,22 @@ if [ "$1" = "0" ]; then
fi
%postun
if [ "$1" -ge 1 ]; then
/etc/rc.d/init.d/rpcidmapd condrestart > /dev/null
/etc/rc.d/init.d/rpcgssd condrestart > /dev/null
/etc/rc.d/init.d/nfs condrestart > /dev/null
/etc/rc.d/init.d/nfslock condrestart > /dev/null
# Package upgrade, not uninstall
for service in %{nfs_services} ; do
/bin/systemctl try-restart $service >/dev/null 2>&1 || :
done
fi
/bin/systemctl --system daemon-reload >/dev/null 2>&1 || :
%triggerpostun -- nfs-server
/sbin/chkconfig --add nfs
%triggerpostun -- knfsd
/sbin/chkconfig --add nfs
%triggerpostun -- knfsd-clients
/sbin/chkconfig --add nfslock
%triggerun -- nfs < 1.2.4-4
if /sbin/chkconfig --level 3 nfs ; then
/bin/systemctl --no-reload enable nfsserver.service >/dev/null 2>&1 || :
fi
%files
%defattr(-,root,root)
%config /etc/rc.d/init.d/nfs
%config /etc/rc.d/init.d/rpcidmapd
%config /etc/rc.d/init.d/rpcgssd
%config /etc/rc.d/init.d/rpcsvcgssd
%config(noreplace) /etc/sysconfig/nfs
%config(noreplace) /etc/nfsmount.conf
%dir /var/lib/nfs/v4recovery
@ -247,7 +254,8 @@ fi
/usr/sbin/nfsiostat
/usr/sbin/nfsidmap
%{_mandir}/*/*
%config /etc/rc.d/init.d/nfslock
/lib/systemd/system/*
/usr/lib/%{name}/scripts/*
%attr(4755,root,root) /sbin/mount.nfs
%attr(4755,root,root) /sbin/mount.nfs4
@ -255,6 +263,10 @@ fi
%attr(4755,root,root) /sbin/umount.nfs4
%changelog
* Wed Aug 3 2011 Steve Dickson <steved@redhat.com> 1.2.4-4
- Converted init scrips to systemd services. (bz 699040)
- Made nfsnobody's uid/gid to always be a 16-bit value of -2
* Thu Jul 21 2011 Steve Dickson <steved@redhat.com> 1.2.4-3
- Updated to latest upstream release: nfs-utils-1-2-5-rc1

231
nfs.init
View File

@ -1,231 +0,0 @@
#!/bin/sh
#
# nfs This shell script takes care of starting and stopping
# the NFS services.
#
# chkconfig: - 30 60
# description: NFS is a popular protocol for file sharing across networks.
# This service provides NFS server functionality, which is \
# configured via the /etc/exports file.
# probe: true
# config: /etc/sysconfig/nfs
### BEGIN INIT INFO
# Provides: nfs
# Required-Start: $local_fs $network $syslog $rpcbind
# Required-Stop: $local_fs $network $syslog $rpcbind
# Default-Stop: 0 1 6
# Short-Description: Start up the NFS server sevice
# Description: NFS is a popular protocol for file sharing across networks \
# This service provides NFS server functionality, \
# which is configured via the /etc/exports file.
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
# Check for and source configuration file otherwise set defaults
[ -f /etc/sysconfig/nfs ] && . /etc/sysconfig/nfs
# Remote quota server
[ -z "$RQUOTAD" ] && RQUOTAD=`type -path rpc.rquotad`
RETVAL=0
uid=`id | cut -d\( -f1 | cut -d= -f2`
# See how we were called.
case "$1" in
start)
# Check that networking is up.
[ "${NETWORKING}" != "yes" ] && exit 6
[ -x /usr/sbin/rpc.nfsd ] || exit 5
[ -x /usr/sbin/rpc.mountd ] || exit 5
[ -x /usr/sbin/exportfs ] || exit 5
# Make sure the rpc.mountd is not already running.
if status rpc.mountd > /dev/null ; then
exit 0
fi
# Only root can start the service
[ $uid -ne 0 ] && exit 4
# Don't fail if /etc/exports doesn't exist; create a bare-bones
# version and continue.
[ -r /etc/exports ] || \
{ touch /etc/exports && chmod u+rw,g+r,o+r /etc/exports ; } || \
{ echo "/etc/exports does not exist" ; exit 0 ; }
[ -z "$MOUNTD_NFS_V2" ] && MOUNTD_NFS_V2=default
[ -z "$MOUNTD_NFS_V3" ] && MOUNTD_NFS_V3=default
# Number of servers to be started by default
[ -z "$RPCNFSDCOUNT" ] && RPCNFSDCOUNT=8
# Start daemons.
[ -x /usr/sbin/rpc.svcgssd ] && /sbin/service rpcsvcgssd start
# Set the ports lockd should listen on
if [ -n "$LOCKD_TCPPORT" -o -n "$LOCKD_UDPPORT" ]; then
[ -x /sbin/modprobe ] && /sbin/modprobe lockd $LOCKDARG
[ -n "$LOCKD_TCPPORT" ] && \
/sbin/sysctl -w fs.nfs.nlm_tcpport=$LOCKD_TCPPORT >/dev/null 2>&1
[ -n "$LOCKD_UDPPORT" ] && \
/sbin/sysctl -w fs.nfs.nlm_udpport=$LOCKD_UDPPORT >/dev/null 2>&1
fi
# Load the nfsd module so /proc/fs/nfsd will exist
[ "$NFSD_MODULE" != "noload" -a -x /sbin/modprobe ] && {
/sbin/modprobe nfsd
[ -n "$RDMA_PORT" ] && /sbin/modprobe svcrdma
}
# Set v4 grace period if requested
[ -n "$NFSD_V4_GRACE" ] && {
echo "$NFSD_V4_GRACE" > /proc/fs/nfsd/nfsv4gracetime
}
action $"Starting NFS services: " /usr/sbin/exportfs -r
if [ -n "$RQUOTAD" -a "$RQUOTAD" != "no" ]; then
echo -n $"Starting NFS quotas: "
[ -n "$RQUOTAD_PORT" ] \
&& RPCRQUOTADOPTS="$RPCRQUOTADOPTS -p $RQUOTAD_PORT"
daemon rpc.rquotad $RPCRQUOTADOPTS
RETVAL=$?
echo
fi
echo -n $"Starting NFS daemon: "
daemon rpc.nfsd $RPCNFSDARGS $RPCNFSDCOUNT
RETVAL=$?
echo
[ $RETVAL -ne 0 ] && exit $RETVAL
[ -n "$RDMA_PORT" ] && echo "rdma $RDMA_PORT" > /proc/fs/nfsd/portlist
[ -n "$MOUNTD_PORT" ] \
&& RPCMOUNTDOPTS="$RPCMOUNTDOPTS -p $MOUNTD_PORT"
case $MOUNTD_NFS_V2 in
no|NO)
RPCMOUNTDOPTS="$RPCMOUNTDOPTS --no-nfs-version 2" ;;
esac
case $MOUNTD_NFS_V3 in
no|NO)
RPCMOUNTDOPTS="$RPCMOUNTDOPTS --no-nfs-version 3" ;;
esac
echo -n $"Starting NFS mountd: "
daemon rpc.mountd $RPCMOUNTDOPTS
RETVAL=$?
echo
touch /var/lock/subsys/rpc.mountd
touch /var/lock/subsys/nfs
# Let rpc.idmapd know that rpc.mountd just started
[ -x /usr/sbin/rpc.idmapd ] && /sbin/service rpcidmapd condstart
;;
stop)
# Only root can stop the service
[ $uid -ne 0 ] && exit 4
# Stop daemons.
echo -n $"Shutting down NFS mountd: "
killproc rpc.mountd
RETVAL=$?
echo
echo -n $"Shutting down NFS daemon: "
killproc nfsd -2
rval=$?
[ $RETVAL -eq 0 ] && RETVAL=$rval
echo
if [ -n "$RQUOTAD" -a "$RQUOTAD" != "no" ]; then
echo -n $"Shutting down NFS quotas: "
killproc rpc.rquotad
rval=$?
[ $RETVAL -eq 0 ] && RETVAL=$rval
echo
fi
# Reset the lockd ports if they were set
if [ -n "$LOCKD_TCPPORT" ]; then
/sbin/sysctl -w fs.nfs.nlm_tcpport=0 >/dev/null 2>&1
fi
if [ -n "$LOCKD_UDPPORT" ]; then
/sbin/sysctl -w fs.nfs.nlm_udpport=0 >/dev/null 2>&1
fi
# Do it the last so that clients can still access the server
# when the server is running.
cnt=`/usr/sbin/exportfs -v | /usr/bin/wc -l`
if [ $cnt -gt 0 ]; then
action $"Shutting down NFS services: " /usr/sbin/exportfs -au
rval=$?
[ $RETVAL -eq 0 ] && RETVAL=$rval
fi
[ -x /usr/sbin/rpc.svcgssd ] && /sbin/service rpcsvcgssd stop
rm -f /var/lock/subsys/nfs
rm -f /var/lock/subsys/rpc.mountd
;;
status)
[ -x /usr/sbin/rpc.svcgssd ] && /sbin/service rpcsvcgssd status
status rpc.mountd
RETVAL=$?
status nfsd
rval=$?
[ $RETVAL -eq 0 ] && RETVAL=$rval
if [ -n "$RQUOTAD" -a "$RQUOTAD" != "no" ]; then
status rpc.rquotad
rval=$?
[ $RETVAL -eq 0 ] && RETVAL=$rval
fi
;;
restart)
$0 stop
$0 start
;;
reload | force-reload)
/usr/sbin/exportfs -r
touch /var/lock/subsys/nfs
;;
probe)
if [ ! -f /var/lock/subsys/nfs ] ; then
echo $"start"; exit 0
fi
/sbin/pidof rpc.mountd >/dev/null 2>&1; MOUNTD="$?"
/sbin/pidof nfsd >/dev/null 2>&1; NFSD="$?"
if [ $MOUNTD = 1 -o $NFSD = 1 ] ; then
echo $"restart"; exit 0
fi
if [ /etc/exports -nt /var/lock/subsys/nfs ] ; then
echo $"reload"; exit 0
fi
;;
condrestart | try-restart)
[ -x /usr/sbin/rpc.svcgssd ] && /sbin/service rpcsvcgssd condrestart
[ -f /var/lock/subsys/nfs ] && {
$0 stop
$0 start
RETVAL=$?
}
;;
condstop)
[ -x /usr/sbin/rpc.svcgssd ] && /sbin/service rpcsvcgssd condstop
[ -f /var/lock/subsys/nfs ] && {
$0 stop
RETVAL=$?
}
;;
*)
echo $"Usage: nfs {start|stop|status|restart|reload|force-reload|condrestart|try-restart|condstop}"
RETVAL=2
;;
esac
exit $RETVAL

View File

@ -1,18 +1,10 @@
#
# Define which protocol versions mountd
# will advertise. The values are "no" or "yes"
# with yes being the default
#MOUNTD_NFS_V2="no"
#MOUNTD_NFS_V3="no"
#
#
# Path to remote quota server. See rquotad(8)
#RQUOTAD="/usr/sbin/rpc.rquotad"
# Port rquotad should listen on.
#RQUOTAD_PORT=875
# Optinal options passed to rquotad
#RPCRQUOTADOPTS=""
#
RPCRQUOTADOPTS=""
#
# Optional arguments passed to in-kernel lockd
#LOCKDARG=
@ -21,46 +13,28 @@
# UDP port rpc.lockd should listen on.
#LOCKD_UDPPORT=32769
#
#
# Optional arguments passed to rpc.nfsd. See rpc.nfsd(8)
# Turn off v2 and v3 protocol support
#RPCNFSDARGS="-N 2 -N 3"
# Turn off v4 protocol support
#RPCNFSDARGS="-N 4"
RPCNFSDARGS=""
# Number of nfs server processes to be started.
# The default is 8.
#RPCNFSDCOUNT=8
# Stop the nfsd module from being pre-loaded
#NFSD_MODULE="noload"
RPCNFSDCOUNT=8
# Set V4 grace period in seconds
#NFSD_V4_GRACE=90
#
#
# Optional arguments passed to rpc.mountd. See rpc.mountd(8)
#RPCMOUNTDOPTS=""
# Port rpc.mountd should listen on.
#MOUNTD_PORT=892
#
RPCMOUNTDOPTS=""
#
# Optional arguments passed to rpc.statd. See rpc.statd(8)
#STATDARG=""
# Port rpc.statd should listen on.
#STATD_PORT=662
# Outgoing port statd should use. The default port is random.
#STATD_OUTGOING_PORT=2020
# Specify callout program
#STATD_HA_CALLOUT="/usr/local/bin/foo"
#
STATDARG=""
#
# Optional arguments passed to rpc.idmapd. See rpc.idmapd(8)
#RPCIDMAPDARGS=""
RPCIDMAPDARGS=""
#
# Set to turn on Secure NFS mounts.
#SECURE_NFS="yes"
# Optional arguments passed to rpc.gssd. See rpc.gssd(8)
#RPCGSSDARGS=""
RPCGSSDARGS=""
#
# Optional arguments passed to rpc.svcgssd. See rpc.svcgssd(8)
#RPCSVCGSSDARGS=""
RPCSVCGSSDARGS=""
#
# To enable RDMA support on the server by setting this to
# the port the server should listen on

View File

@ -1,154 +0,0 @@
#!/bin/sh
#
# nfslock This shell script takes care of starting and stopping
# the NFS file locking service.
#
# chkconfig: 345 14 86
# description: NFS is a popular protocol for file sharing across \
# networks. This service provides NFS file locking \
# functionality.
# probe: true
### BEGIN INIT INFO
# Provides: nfslock
# Required-Start: $network $syslog $rpcbind
# Required-Stop: $network $syslog $rpcbind
# Default-Start: 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start up the NFS file locking sevice
# Description: NFS is a popular protocol for file sharing across \
# networks. This service provides NFS file locking \
# functionality.
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
if [ ! -f /etc/sysconfig/network ]; then
exit 6
fi
# Check for and source configuration file
LOCKDARG=""
STATDARG=""
[ -f /etc/sysconfig/nfs ] && . /etc/sysconfig/nfs
[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
uid=`id | cut -d\( -f1 | cut -d= -f2`
RETVAL=0
start() {
# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 6
[ -x /sbin/rpc.statd ] || exit 5
# Only root can start the service
[ $uid -ne 0 ] && exit 4
# Make sure the rpc.statd is not already running.
if status rpc.statd > /dev/null ; then
exit 0
fi
rm -f /var/lock/subsys/rpc.statd
# Make sure locks are recovered
rm -f /var/run/sm-notify.pid
# Start daemons.
# See if the kernel lockd should start up
# listening on a particular port
#
if [ -n "$LOCKD_TCPPORT" -o -n "$LOCKD_UDPPORT" ]; then
[ -x /sbin/modprobe ] && /sbin/modprobe lockd $LOCKDARG
[ -n "$LOCKD_TCPPORT" ] && \
/sbin/sysctl -w fs.nfs.nlm_tcpport=$LOCKD_TCPPORT >/dev/null 2>&1
[ -n "$LOCKD_UDPPORT" ] && \
/sbin/sysctl -w fs.nfs.nlm_udpport=$LOCKD_UDPPORT >/dev/null 2>&1
fi
echo -n $"Starting NFS statd: "
# Set statd's local hostname if defined
[ -n "${STATD_HOSTNAME}" ] && STATDARG="$STATDARG -n ${STATD_HOSTNAME}"
# See if a statd's ports has been defined
[ -n "$STATD_PORT" ] && STATDARG="$STATDARG -p $STATD_PORT"
[ -n "$STATD_OUTGOING_PORT" ] \
&& STATDARG="$STATDARG -o $STATD_OUTGOING_PORT"
# See if we have an HA-callout program specified
[ -n "$STATD_HA_CALLOUT" ] \
&& STATDARG="$STATDARG -H $STATD_HA_CALLOUT"
daemon rpc.statd "$STATDARG"
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/rpc.statd
return $RETVAL
}
stop() {
# Only root can stop the service
[ $uid -ne 0 ] && exit 4
# Stop daemons.
if [ -n "`pidofproc lockd`" ]; then
echo -n $"Stopping NFS locking: "
killproc lockd -KILL
echo
fi
echo -n $"Stopping NFS statd: "
killproc rpc.statd
RETVAL=$?
echo
rm -f /var/lock/subsys/rpc.statd
rm -f /var/run/sm-notify.pid
return $RETVAL
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status rpc.statd
RETVAL=$?
;;
restart | force-reload | reload)
stop
start
;;
probe)
if [ ! -f /var/lock/subsys/rpc.statd ] ; then
echo $"start"; exit 0
fi
/sbin/pidof rpc.statd >/dev/null 2>&1
if [ $? = 1 ] ; then
echo $"restart"; exit 0
fi
;;
condrestart | try-restart)
[ -f /var/lock/subsys/rpc.statd ] && {
stop
start
RETVAL=$?
}
;;
condstop)
[ -f /var/lock/subsys/rpc.statd ] && {
stop
RETVAL=$?
}
;;
*)
echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|probe|condrestart|try-restart|condstop}"
RETVAL=2
;;
esac
exit $RETVAL

View File

@ -1,116 +0,0 @@
#!/bin/bash
#
# rpcgssd Start up and shut down RPCSEC GSS daemon
#
# chkconfig: 345 19 85
# description: Starts user-level daemon that manages RPCSEC GSS contexts \
# for the NFS client.
### BEGIN INIT INFO
# Provides: rpcgssd
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
# Default-Start: 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts the RPCSEC GSS client daemon
# Description: NFS is a popular protocol for file sharing across \
# networks. This deamon manages RPCSEC GSS contexts on the
# client used by secure NFS mounts
### END INIT INFO
# Source function library.
. /etc/init.d/functions
# Source networking configuration.
[ -f /etc/sysconfig/network ]&& . /etc/sysconfig/network
# Check for and source configuration file otherwise set defaults
[ -f /etc/sysconfig/nfs ] && . /etc/sysconfig/nfs
# Try to use machine credentials by default
RETVAL=0
uid=`id | cut -d\( -f1 | cut -d= -f2`
prog="rpc.gssd"
LOCKFILE=/var/lock/subsys/$prog
case "$1" in
start|condstart)
# Check that networking is up.
[ "${NETWORKING}" != "yes" ] && exit 6
[ ! -x /usr/sbin/rpc.gssd ] && exit 5
# Only root can start the service
[ $uid -ne 0 ] && exit 4
# Make sure the daemon is not already running.
if status $prog > /dev/null ; then
exit 0
fi
# During condstart need to check again to see
# if we are configured to start
[ "${SECURE_NFS}" != "yes" ] && exit 6
rm -f $LOCKFILE
echo -n $"Starting RPC gssd: "
# Make sure the rpc_pipefs filesystem is available
/bin/mount -t rpc_pipefs sunrpc /var/lib/nfs/rpc_pipefs > /dev/null 2>&1
[ -x /sbin/lsmod -a -x /sbin/modprobe ] && {
if ! /sbin/lsmod | grep rpcsec_gss_krb5 > /dev/null ; then
/sbin/modprobe rpcsec_gss_krb5 || {
echo "Error: Unable to load rpcsec_gss_krb5."
exit 6;
}
fi
}
# Start daemon.
daemon $prog ${RPCGSSDARGS}
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch $LOCKFILE
;;
stop)
# Just exit if not configured
[ "${SECURE_NFS}" != "yes" ] && exit 6
# Only root can stop the service
[ $uid -ne 0 ] && exit 4
# Stop daemon.
echo -n $"Stopping RPC gssd: "
killproc $prog
RETVAL=$?
echo
rm -f $LOCKFILE
;;
status)
status rpc.gssd
RETVAL=$?
;;
restart|reload|force-reload)
$0 stop
$0 start
RETVAL=$?
;;
condrestart|try-restart)
if [ -f $LOCKFILE ]; then
$0 restart
RETVAL=$?
fi
;;
condstop)
if [ -f $LOCKFILE ]; then
$0 stop
RETVAL=$?
fi
;;
*)
echo $"Usage: $0 {start|stop|restart|force-reload|condstart|condrestart|try-restart|status|condstop}"
RETVAL=2
;;
esac
exit $RETVAL

View File

@ -1,106 +0,0 @@
#!/bin/bash
#
# rpcidmapd Start up and shut down RPC name to UID/GID mapper
#
# chkconfig: 345 18 85
# description: Starts user-level daemon for NFSv4 that maps user \
# names to UID and GID numbers.
### BEGIN INIT INFO
# Provides: rpcidmapd
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
# Default-Start: 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts the NFSv4 id mapping daemon
# Description: NFS is a popular protocol for file sharing across \
# networks. This deamon maps user names and groups to UID \
# and GID numbers on NFSv4 mounts.
### END INIT INFO
# Source function library.
. /etc/init.d/functions
# Source networking configuration.
[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
# Check for and source configuration file otherwise set defaults
[ -f /etc/sysconfig/nfs ] && . /etc/sysconfig/nfs
RETVAL=0
prog="rpc.idmapd"
LOCKFILE=/var/lock/subsys/$prog
uid=`id | cut -d\( -f1 | cut -d= -f2`
case "$1" in
start|condstart)
# Check that networking is up.
[ "${NETWORKING}" != "yes" ] && exit 6
[ ! -x /usr/sbin/rpc.idmapd ] && exit 5
# Only root can start the service
[ $uid -ne 0 ] && exit 4
# Make sure the daemon is not already running.
[ "$1" = "condstart" -a -n "`pidofproc $prog`" ] && {
killproc $prog "-SIGHUP" > /dev/null
exit 0
}
[ "$1" = "start" ] && {
if status $prog > /dev/null ; then
exit 0
fi
}
rm -f $LOCKFILE
echo -n $"Starting RPC idmapd: "
# Make sure the rpc_pipefs filesystem is available
/bin/mount -t rpc_pipefs sunrpc /var/lib/nfs/rpc_pipefs > /dev/null 2>&1
# Start daemon.
daemon $prog ${RPCIDMAPDARGS}
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch $LOCKFILE
;;
stop)
# Only root can stop the service
[ $uid -ne 0 ] && exit 4
# Stop daemon.
echo -n $"Stopping RPC idmapd: "
killproc $prog
RETVAL=$?
echo
rm -f $LOCKFILE
;;
status)
status rpc.idmapd
RETVAL=$?
;;
restart|reload|force-reload)
$0 stop
$0 start
RETVAL=$?
;;
condrestart|try-restart)
if [ -f $LOCKFILE ]; then
$0 restart
RETVAL=$?
fi
;;
condstop)
if [ -f $LOCKFILE ]; then
$0 stop
RETVAL=$?
fi
;;
*)
echo $"Usage: $0 {start|stop|restart|force-reload|condstart|condrestart|try-restart|status|condstop}"
RETVAL=2
;;
esac
exit $RETVAL

View File

@ -1,110 +0,0 @@
#!/bin/bash
#
# rpcsvcgssd Start up and shut down RPCSEC GSS daemon
#
# chkconfig: - 31 69
# description: Starts user-level daemon that manages RPCSEC GSS contexts \
# 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
# Source function library.
. /etc/init.d/functions
# Source networking configuration.
[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
# Check for and source configuration file otherwise set defaults
[ -f /etc/sysconfig/nfs ] && . /etc/sysconfig/nfs
RETVAL=0
prog="rpc.svcgssd"
LOCKFILE=/var/lock/subsys/$prog
uid=`id | cut -d\( -f1 | cut -d= -f2`
case "$1" in
start|condstart)
# Check that networking is up.
[ "${NETWORKING}" != "yes" ] && exit 6
[ "${SECURE_NFS}" != "yes" ] && exit 6
[ ! -x /usr/sbin/rpc.svcgssd ] && exit 5
# Only root can start the service
[ $uid -ne 0 ] && exit 4
# Make sure the daemon is not already running.
if status $prog > /dev/null ; then
exit 0
fi
rm -f $LOCKFILE
echo -n $"Starting RPC svcgssd: "
# Make sure the rpc_pipefs filesystem is available
/bin/mount -t rpc_pipefs sunrpc /var/lib/nfs/rpc_pipefs > /dev/null 2>&1
[ -x /sbin/lsmod -a -x /sbin/modprobe ] && {
if ! /sbin/lsmod | grep rpcsec_gss_krb5 > /dev/null ; then
/sbin/modprobe rpcsec_gss_krb5 || {
echo "Error: Unable to load rpcsec_gss_krb5."
exit 6;
}
fi
}
# Start daemon.
daemon $prog ${RPCSVCGSSDARGS}
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch $LOCKFILE
;;
stop)
# Just exit if not configured
[ "${SECURE_NFS}" != "yes" ] && exit 6
# Only root can stop the service
[ $uid -ne 0 ] && exit 4
# Stop daemon.
echo -n $"Shutting down RPC svcgssd: "
killproc $prog
RETVAL=$?
echo
rm -f $LOCKFILE
;;
status)
status rpc.svcgssd
RETVAL=$?
;;
restart|reload|force-reload)
$0 stop
$0 start
RETVAL=$?
;;
condrestart|try-restart)
if [ -f $LOCKFILE ]; then
$0 restart
RETVAL=$?
fi
;;
condstop)
if [ -f $LOCKFILE ]; then
$0 stop
RETVAL=$?
fi
;;
*)
echo $"Usage: $0 {start|stop|restart|force-reload|condstart|condrestart|try-restart|status|condstop}"
RETVAL=2
;;
esac
exit $RETVAL

View File

@ -0,0 +1,8 @@
[Unit]
Description=RPC Pipe File System
DefaultDependencies=no
[Mount]
What=sunrpc
Where=/var/lib/nfs/rpc_pipefs
Type=rpc_pipefs