[OpenAFS] Apache token question (was AFS && Apache)

Stephen Joyce stephen@physics.unc.edu
Thu, 26 Dec 2002 23:53:13 -0500 (EST)


Happy Holidays!

I've got some weirdness I'm hoping someone on the list can help with:

Scenario:  I've got an init script which should start an authenticated
instance of apache at system-boot.  (Grab a new pag, read a password from
a file, perform a klog to get tokens, start a reauth to renew the tokens
before they expire, and start apache).  This init script works fine on
solaris 2.6 and solaris 7.

Problem:  The exact same script doesn't work on solaris 8 or 9--Apache
doesn't inherit the tokens from the pag--even though the script DOES get
tokens.

I've tried different versions of apache (1.3.12 to 1.3.26) and the version
of apache doesn't seem to matter; only the version of solaris.  I have
tried both OpenAFS and Transarc AFS clients with the same result.

The script functions perfectly on solaris 8/9 when root logs in and runs it
manually, it simply fails when the machine boots.

This is probably a solaris issue rather than an AFS issue, but just
in case.... Anyone else seen this problem?  Have a solution?

Script follows:

#!/usr/bin/pagsh
#
#
# start/stop the http daemon
umask 022
PATH=/bin:/usr/bin:/usr/ucb:/usr/bsd:/usr/local/bin
export PATH
PASSWORD=/etc/security/www.password
SSLPASSWORD=/etc/security/wwwssl.password

case "$1" in

'start')
	# Start WWW server
        if [ -f /usr/local/apache/bin/httpd -a -f /usr/local/apache/conf/httpd.conf ] ; then
                echo "Starting WWW server"
		echo "Authenticating to www"
		cat $PASSWORD | /afs/physics.unc.edu/software/reauth/bin/reauth 36001 www
		/usr/afsws/bin/tokens
                /usr/local/apache/bin/httpd -f /usr/local/apache/conf/httpd.conf -DSSL
		/usr/afsws/bin/tokens
        fi
        ;;

'stop')
	# Kill the WWW server
        echo "Stopping WWW server"
	PID=`cat /usr/local/apache/logs/httpd.pid`
	if [ ! -z "$PID" ] ; then
		/usr/bin/kill ${PID} 1>/dev/null 2>&1
	fi
	# Kill the REAUTH
	RPID=`/usr/bin/ps -ef -u 0|/usr/bin/fgrep "reauth 36001 www" | /usr/bin/awk '{print $2}'`
	if [ ! -z "$RPID" ] ; then
		/usr/bin/kill ${RPID} 1>/dev/null 2>&1
	fi
        ;;
*)
	echo "Usage: /etc/init.d/httpd { start | stop }"
	;;
esac