--- /dev/null
+#!/bin/sh\r
+# $Header$\r
+#\r
+# Installation and Configuration script for AFS Web Security Pack\r
+#\r
+# History:\r
+#\r
+# 19-Mar-1998 Created. (wvh@transarc.com)\r
+#\r
+# 06-May-1998 Added tar file stuff and tweaked to add CellServDb \r
+# edits, etc. \r
+#\r
+# The suggested procedure would be to install everything from the CD\r
+# (maybe using tar?), and then run the this script.\r
+#\r
+# Suggested final installation heirarchy would look like:\r
+#\r
+# /usr/<something>/etc - conf files for AFSWebSecure\r
+# /usr/<something>/lib - location of shared library\r
+# /usr/<something>/cache - real cache or symlink elsewhere\r
+# /usr/<something>/log - log files\r
+#\r
+##########################################################################\r
+#\r
+# Actual install script begins here.\r
+#\r
+##########################################################################\r
+\r
+PRODUCT="AFS Web Security Pack"\r
+\r
+#\r
+# Handle various types of failures\r
+#\r
+trap 'echo "" ; \\r
+ echo "$PRODUCT Installation cancelled." ; \\r
+ echo "" ; \\r
+ exit 1' 1 2 3 6 9 12 13 15 16 17 24 25 29\r
+\r
+rm -f /tmp/newconf\r
+\r
+#\r
+# Figure out what OS we're running on so that we try to\r
+# exec the right binaries in the script. (The uname\r
+# binary lives in the same place on AIX and SunOS \r
+# (Solaris) systems, else we'd have to conditionalize \r
+# that, too.)\r
+#\r
+OSTYPE=`/usr/bin/uname | sed -e 's;\([a-zA-Z]*\).*;\1;'`\r
+\r
+if [ x$OSTYPE = "xSunOS" ] ; then\r
+ HOSTNAME=/usr/ucb/hostname\r
+ NSLOOKUP=/usr/sbin/nslookup\r
+ EX=/usr/ucb/ex\r
+ ECHO=/bin/echo\r
+ ECHOFLAG="\c"\r
+ AFSWSLIB=nsafs.so\r
+elif [ x$OSTYPE = "xAIX" ] ; then\r
+ HOSTNAME=/usr/bin/hostname\r
+ NSLOOKUP=/usr/bin/nslookup\r
+ EX=/usr/bin/ex\r
+ ECHO=echo\r
+ ECHOFLAG=""\r
+ AFSWSLIB=nsafs.a\r
+else\r
+ $ECHO " ERROR: unsupported OSTYPE \"$OSTYPE\" returned by /usr/bin/uname."\r
+ exit 1\r
+fi\r
+\r
+#\r
+# Check for the existence of the file to install from, and exit \r
+# if not in pwd.\r
+#\r
+ if [ ! -f ns_afswebsecure.tar ] ; then\r
+ $ECHO " File ns_afswebsecure.tar not found in working directory."\r
+ $ECHO ""\r
+ exit 1\r
+ fi\r
+#\r
+# Find out where the server is installed\r
+#\r
+ $ECHO "Enter the directory where the Web server's bin directory is located [/usr/netscape/suitespot]: " $ECHOFLAG\r
+ read ws_srvdir\r
+ if [ x$ws_srvdir = "x" ] ; then\r
+ ws_srvdir="/usr/netscape/suitespot"\r
+ fi\r
+\r
+ $ECHO ""\r
+#\r
+# Find out the name of the Web server. Sets three variables for\r
+# the hostname: lhn, which is the full host name; shn, which is\r
+# the short (non-domain) host name; and dhn, which is the domain\r
+# name. This uses nslookup, since we can't depend on the host\r
+# actually being in /etc/hosts due to DNS and YP.\r
+#\r
+ tmp=`$HOSTNAME`\r
+ lhn=`$NSLOOKUP $tmp | grep Name: | sed -e 's;Name:[ ]*;;'`\r
+ shn=`echo $lhn | sed -e 's;\([-_a-zA-Z0-9]*\).*;\1;'`\r
+ dhn=`echo $lhn | sed -e "s;$shn\.;;"`\r
+\r
+# echo ""\r
+# echo "Long host name is $lhn."\r
+# echo "Short host name is $shn."\r
+# echo "Domain name is $dhn."\r
+# echo ""\r
+ \r
+ $ECHO "Enter the Web server to use to access AFS data [$shn]: " $ECHOFLAG\r
+ read ws_wsname\r
+ case $ws_wsname in\r
+ '') ;;\r
+ *) shn=$ws_wsname;;\r
+ esac\r
+\r
+ ws_conf=$ws_srvdir"/https-"$shn"/config/obj.conf"\r
+\r
+ if [ ! -f $ws_conf ] ; then\r
+ $ECHO " ERROR: server config file \"$ws_conf\" not found."\r
+ exit 1\r
+ else\r
+ $ECHO ""\r
+ fi\r
+#\r
+# Make sure we can actually modify the obj.conf file\r
+#\r
+\r
+ touch $ws_conf 1> /dev/null 2> /dev/null\r
+ if [ $? != 0 ] ; then\r
+ $ECHO " ERROR: No write permission to configuration file $ws_conf."\r
+ exit 1\r
+ fi\r
+\r
+#\r
+# Check if AFS WebSecure is already installed\r
+#\r
+ grep nsafs $ws_conf 1> /dev/null 2> /dev/null\r
+ if [ $? = 0 ] ; then\r
+ $ECHO " ERROR: $PRODUCT entries already exist in $ws_conf."\r
+ exit 1\r
+ fi\r
+\r
+#\r
+# Find out where the AFSWebSecure stuff should be installed.\r
+#\r
+\r
+ $ECHO "Enter the $PRODUCT installation directory [/usr/afsweb]: " $ECHOFLAG\r
+ read ws_wsdir\r
+ if [ x$ws_wsdir = "x" ] ; then\r
+ ws_wsdir="/usr/afsweb"\r
+ fi\r
+\r
+#\r
+# Install WebSecure from tar file in same directory from which the \r
+# ws_config script was started. The convoluted directory creation\r
+# loop lets people install in a directory tree that doesn't exist\r
+# yet, which would not typically be the case, but...\r
+#\r
+ if [ ! -d $ws_wsdir ] ; then\r
+ base=""\r
+ root=""\r
+ target=$ws_wsdir\r
+ while [ x$target != "x" ] ; do\r
+ base=`echo $target | sed -e 's;\(/[^/]*\)[-/a-zA-Z0-9_]*;\1;'`\r
+ target=`echo $target | sed -e 's;\(/[^/]*\)\([-/a-zA-Z0-9_]*\);\2;'`\r
+ if [ ! -d $root$base ] ; then\r
+ echo "Creating $root$base"\r
+ mkdir $root$base 1> /dev/null 2> /dev/null\r
+ if [ $? != 0 ] ; then\r
+ $ECHO "ERROR: Could not create $ws_wsdir. Check permissions and retry."\r
+ exit 1\r
+ fi\r
+ fi\r
+ root=$root$base\r
+ done\r
+ fi\r
+\r
+ $ECHO ""\r
+ wd=`pwd`\r
+ cd $ws_wsdir\r
+ tar xvf $wd"/ns_afswebsecure.tar"\r
+\r
+#\r
+# Use this as a check that everything went OK.\r
+#\r
+ if [ ! -f $ws_wsdir"/lib/${AFSWSLIB}" ] ; then\r
+ $ECHO " ERROR: $PRODUCT shared library \"$ws_wsdir/lib/${AFSWSLIB}\" not found."\r
+ exit 1\r
+ else\r
+ $ECHO ""\r
+ fi\r
+\r
+#\r
+# Ensure that the cache dir and log files are owned by the user\r
+# specified in magnus.conf that this server runs as\r
+#\r
+ ws_mconf=$ws_srvdir/https-$shn/config/magnus.conf\r
+ \r
+ if [ ! -f $ws_mconf ] ; then\r
+ $ECHO " ERROR: server config file \"$ws_mconf\" not found."\r
+ exit 1\r
+ else\r
+ $ECHO ""\r
+ fi\r
+\r
+ username=`grep -i User $ws_mconf | awk '{ print $2 }'`\r
+ chown $username $ws_wsdir/cache $ws_wsdir/log \r
+ \r
+#\r
+# Enter the size of the AFS cache in 1K blocks\r
+#\r
+\r
+ $ECHO "Enter the size of the $PRODUCT cache in 1K blocks [5000]: " $ECHOFLAG\r
+ read ws_csize\r
+ if [ x$ws_csize = "x" ] ; then\r
+ ws_csize="5000"\r
+ fi\r
+ $ECHO ""\r
+\r
+ expr $ws_csize + 1 1> /dev/null 2> /dev/null\r
+ if [ $? != 0 ] ; then\r
+ $ECHO " ERROR: Cache size must be numeric. You entered \"$ws_csize\"."\r
+ exit 1\r
+ fi\r
+\r
+#\r
+# Set default value for advanced options - number of files in the cache\r
+# and number of receiving threads.\r
+#\r
+ ws_cfiles=`expr $ws_csize / 10`\r
+ ws_numt="2"\r
+\r
+#\r
+# Enter the number of AFS daemon processes\r
+#\r
+\r
+ $ECHO "Enter the number of AFS daemons to run [3]: " $ECHOFLAG \r
+ read ws_numd\r
+ if [ x$ws_numd = "x" ] ; then\r
+ ws_numd="3"\r
+ fi\r
+ $ECHO ""\r
+\r
+ expr $ws_numd + 1 1> /dev/null 2> /dev/null\r
+ if [ $? != 0 ] ; then\r
+ $ECHO " ERROR: The number of AFS daemons must be numeric. You entered \"$ws_numd\"."\r
+ exit 1\r
+ fi\r
+\r
+#\r
+# Enter the number of entries in the AFS Stat cache\r
+# Default is the number of files in the cache.\r
+#\r
+\r
+ $ECHO "Enter the number of entries in the AFS stat cache [$ws_cfiles]: " $ECHOFLAG \r
+ read ws_nums\r
+ if [ x$ws_nums = "x" ] ; then\r
+ ws_nums=$ws_cfiles\r
+ fi\r
+ $ECHO ""\r
+\r
+ expr $ws_nums + 1 1> /dev/null 2> /dev/null\r
+ if [ $? != 0 ] ; then\r
+ $ECHO " ERROR: The number of entries in the stat cache must be numeric. You entered \"$ws_nums\"."\r
+ exit 1\r
+ fi\r
+\r
+#\r
+# Find out which cells $PRODUCT should work with\r
+#\r
+\r
+ $ECHO "Enter the AFS cell to access using $PRODUCT [$dhn]: " $ECHOFLAG\r
+ read ws_cell\r
+ if [ x$ws_cell = "x" ] ; then\r
+ ws_cell=$dhn\r
+ fi\r
+\r
+#\r
+# Create appropriate ThisCell file\r
+#\r
+ echo $ws_cell > $ws_wsdir"/etc/ThisCell"\r
+\r
+#\r
+# If necessary, add entries to generic cellServDB file\r
+#\r
+ grep $ws_cell $ws_wsdir"/etc/CellServDB" 1> /dev/null 2> /dev/null\r
+ if [ $? != 0 ] ; then\r
+ $ECHO " Cell $ws_cell not found in default CellServDB file."\r
+ $ECHO ""\r
+ $ECHO "Enter a one-line text description for this cell: " $ECHOFLAG\r
+ read exp\r
+ $ECHO ">$ws_cell # $exp" >> $ws_wsdir"/etc/CellServDB"\r
+ $ECHO ""\r
+ $ECHO "Enter the IP address of a database server for this cell ('.' to exit): " $ECHOFLAG\r
+ read ws_dbsrv \r
+ while [ x$ws_dbsrv != "x." ] ; do\r
+ ws_dbname=`grep $ws_dbsrv /etc/hosts | sed -e 's;[0-9\.]*[ ]*\([a-z\.A-Z0-9]*\).*;\1;'`\r
+ if [ x$ws_dbname = "x" ] ; then\r
+ ws_dbname="Unknown"\r
+ fi\r
+ $ECHO " Appending $ws_dbname, IP address $ws_dbsrv."\r
+ $ECHO "$ws_dbsrv #$ws_dbname" >> $ws_wsdir"/etc/CellServDB"\r
+ $ECHO "Enter the IP address of a database server for this cell ('.' to exit): " $ECHOFLAG\r
+ read ws_dbsrv \r
+ done\r
+ else\r
+ $ECHO " Found cell $ws_cell in $ws_wsdir/etc/CellServDB."\r
+ fi \r
+\r
+ $ECHO ""\r
+#\r
+#\r
+# "Advanced" configuration items - optional. These are:\r
+#\r
+# - number of RX threads\r
+# - number of files in the AFS WebSecure cache \r
+#\r
+# \r
+# $ECHO "Do you want to configure advanced options? (y/n): " $ECHOFLAG\r
+# read ans\r
+# let=`echo $ans | sed -e 's;\(.\).*;\1;' | tr [A-Z] [a-z]`\r
+# $ECHO ""\r
+# if [ x$let = "xy" ] ; then\r
+# \r
+#\r
+# Enter the number of files in the AFS cache - default is ws_csize/10\r
+#\r
+# \r
+# $ECHO "Enter the number of files in the Websecure cache [$ws_cfiles]: " $ECHOFLAG\r
+# read ws_cfiles\r
+# if [ x$ws_cfiles = "x" ] ; then\r
+# ws_cfiles=`expr $ws_csize / 10`\r
+# fi\r
+# $ECHO ""\r
+# \r
+# expr $ws_cfiles + 1 1> /dev/null 2> /dev/null\r
+# if [ $? != 0 ] ; then\r
+# $ECHO " ERROR: Number of cache files must be numeric. You entered \"$ws_cfiles\"."\r
+# exit 1\r
+# fi\r
+# \r
+#\r
+# Enter the number of threads to process RX packets\r
+#\r
+# \r
+# $ECHO "Enter the number of threads to process RX requests [2]: " $ECHOFLAG\r
+# read ws_numt\r
+# if [ x$ws_numt = "x" ] ; then\r
+# ws_numt="2"\r
+# fi\r
+# $ECHO ""\r
+# \r
+# expr $ws_numt + 1 1> /dev/null 2> /dev/null\r
+# if [ $? != 0 ] ; then\r
+# $ECHO " ERROR: The number of RX threads must be numeric. You entered \"$ws_numt\"."\r
+# exit 1\r
+# fi\r
+# \r
+# fi\r
+# \r
+# \r
+# Now that we have all the info we need, time to actually edit the obj.conf file\r
+#\r
+# Back up the old one if no previous backup exists\r
+#\r
+if [ -f $ws_conf".pre_ws" ] ; then\r
+ $ECHO "NOTE: Backup file \"$ws_conf.pre_ws\" already exists."\r
+ $ECHO " Not backing up current obj.conf file."\r
+else\r
+ cp $ws_conf $ws_conf".pre_ws"\r
+ $ECHO " Creating backup copy of obj.conf file..."\r
+fi\r
+\r
+$EX $ws_conf << END_OF_FILE 1> /dev/null\r
+1\r
+/mime-types\r
+a\r
+Init fn="load-modules" shlib="$ws_wsdir/lib/${AFSWSLIB}" funcs="nsafs-init,nsafs-basic,nsafs-mount,nsafs-public,nsafs-nolinks,nsafs-check,nsafs-nocheck,nsafs-find-index,nsafs-send,nsafs-force-type,nsafs-put,nsafs-delete,nsafs-move,nsafs-index,nsafs-mkdir,nsafs-rmdir"\r
+Init fn="nsafs-init" cell="$ws_cell" blocks="$ws_csize" files="$ws_cfiles" stat="$ws_nums" daemons="$ws_numd" cachedir="$ws_wsdir/cache" confdir="$ws_wsdir/etc" logfile="$ws_wsdir/log/nsafs.log" exp-max="120" timeout="30" rcvthreads="$ws_numt"\r
+.\r
+/default\r
+a\r
+AuthTrans fn="nsafs-basic"\r
+NameTrans fn="nsafs-mount" mount="/afs"\r
+PathCheck fn="nsafs-public" public="/afs"\r
+PathCheck fn="nsafs-nolinks" nolinks="/afs/$ws_cell/usr"\r
+.\r
+/Service\r
+i\r
+Service method="(GET|HEAD)" fn="nsafs-send" index="fancy"\r
+.\r
+w! /tmp/newconf\r
+q\r
+END_OF_FILE\r
+\r
+cp /tmp/newconf $ws_conf\r
+\r
+$ECHO ""\r
+\r
+$ECHO " Installation of $PRODUCT complete."\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r