4 # Installation and Configuration script for AFS Web Security Pack
8 # 19-Mar-1998 Created. (wvh@transarc.com)
10 # 06-May-1998 Added tar file stuff and tweaked to add CellServDb
13 # The suggested procedure would be to install everything from the CD
14 # (maybe using tar?), and then run the this script.
16 # Suggested final installation heirarchy would look like:
18 # /usr/<something>/etc - conf files for AFSWebSecure
19 # /usr/<something>/lib - location of shared library
20 # /usr/<something>/cache - real cache or symlink elsewhere
21 # /usr/<something>/log - log files
23 ##########################################################################
25 # Actual install script begins here.
27 ##########################################################################
29 PRODUCT
="AFS Web Security Pack"
32 # Handle various types of failures
35 echo "$PRODUCT Installation cancelled." ; \
37 exit 1' 1 2 3 6 9 12 13 15 16 17 24 25 29
42 # Figure out what OS we're running on so that we try to
43 # exec the right binaries in the script. (The uname
44 # binary lives in the same place on AIX and SunOS
45 # (Solaris) systems, else we'd have to conditionalize
48 OSTYPE
=`/usr/bin/uname | sed -e 's;\([a-zA-Z]*\).*;\1;'`
50 if [ x
$OSTYPE = "xSunOS" ] ; then
51 HOSTNAME
=/usr
/ucb
/hostname
52 NSLOOKUP
=/usr
/sbin
/nslookup
57 elif [ x
$OSTYPE = "xAIX" ] ; then
58 HOSTNAME
=/usr
/bin
/hostname
59 NSLOOKUP
=/usr
/bin
/nslookup
65 $ECHO " ERROR: unsupported OSTYPE \"$OSTYPE\" returned by /usr/bin/uname."
70 # Check for the existence of the file to install from, and exit
73 if [ ! -f ns_afswebsecure.
tar ] ; then
74 $ECHO " File ns_afswebsecure.tar not found in working directory."
79 # Find out where the server is installed
81 $ECHO "Enter the directory where the Web server's bin directory is located [/usr/netscape/suitespot]: " $ECHOFLAG
83 if [ x
$ws_srvdir = "x" ] ; then
84 ws_srvdir
="/usr/netscape/suitespot"
89 # Find out the name of the Web server. Sets three variables for
90 # the hostname: lhn, which is the full host name; shn, which is
91 # the short (non-domain) host name; and dhn, which is the domain
92 # name. This uses nslookup, since we can't depend on the host
93 # actually being in /etc/hosts due to DNS and YP.
96 lhn
=`$NSLOOKUP $tmp | grep Name: | sed -e 's;Name:[ ]*;;'`
97 shn
=`echo $lhn | sed -e 's;\([-_a-zA-Z0-9]*\).*;\1;'`
98 dhn
=`echo $lhn | sed -e "s;$shn\.;;"`
101 # echo "Long host name is $lhn."
102 # echo "Short host name is $shn."
103 # echo "Domain name is $dhn."
106 $ECHO "Enter the Web server to use to access AFS data [$shn]: " $ECHOFLAG
113 ws_conf
=$ws_srvdir"/https-"$shn"/config/obj.conf"
115 if [ ! -f $ws_conf ] ; then
116 $ECHO " ERROR: server config file \"$ws_conf\" not found."
122 # Make sure we can actually modify the obj.conf file
125 touch $ws_conf 1> /dev
/null
2> /dev
/null
126 if [ $?
!= 0 ] ; then
127 $ECHO " ERROR: No write permission to configuration file $ws_conf."
132 # Check if AFS WebSecure is already installed
134 grep nsafs
$ws_conf 1> /dev
/null
2> /dev
/null
136 $ECHO " ERROR: $PRODUCT entries already exist in $ws_conf."
141 # Find out where the AFSWebSecure stuff should be installed.
144 $ECHO "Enter the $PRODUCT installation directory [/usr/afsweb]: " $ECHOFLAG
146 if [ x
$ws_wsdir = "x" ] ; then
147 ws_wsdir
="/usr/afsweb"
151 # Install WebSecure from tar file in same directory from which the
152 # ws_config script was started. The convoluted directory creation
153 # loop lets people install in a directory tree that doesn't exist
154 # yet, which would not typically be the case, but...
156 if [ ! -d $ws_wsdir ] ; then
160 while [ x
$target != "x" ] ; do
161 base
=`echo $target | sed -e 's;\(/[^/]*\)[-/a-zA-Z0-9_]*;\1;'`
162 target
=`echo $target | sed -e 's;\(/[^/]*\)\([-/a-zA-Z0-9_]*\);\2;'`
163 if [ ! -d $root$base ] ; then
164 echo "Creating $root$base"
165 mkdir
$root$base 1> /dev
/null
2> /dev
/null
166 if [ $?
!= 0 ] ; then
167 $ECHO "ERROR: Could not create $ws_wsdir. Check permissions and retry."
178 tar xvf
$wd"/ns_afswebsecure.tar"
181 # Use this as a check that everything went OK.
183 if [ ! -f $ws_wsdir"/lib/${AFSWSLIB}" ] ; then
184 $ECHO " ERROR: $PRODUCT shared library \"$ws_wsdir/lib/${AFSWSLIB}\" not found."
191 # Ensure that the cache dir and log files are owned by the user
192 # specified in magnus.conf that this server runs as
194 ws_mconf
=$ws_srvdir/https-
$shn/config
/magnus.conf
196 if [ ! -f $ws_mconf ] ; then
197 $ECHO " ERROR: server config file \"$ws_mconf\" not found."
203 username
=`grep -i User $ws_mconf | awk '{ print $2 }'`
204 chown
$username $ws_wsdir/cache
$ws_wsdir/log
207 # Enter the size of the AFS cache in 1K blocks
210 $ECHO "Enter the size of the $PRODUCT cache in 1K blocks [5000]: " $ECHOFLAG
212 if [ x
$ws_csize = "x" ] ; then
217 expr $ws_csize + 1 1> /dev
/null
2> /dev
/null
218 if [ $?
!= 0 ] ; then
219 $ECHO " ERROR: Cache size must be numeric. You entered \"$ws_csize\"."
224 # Set default value for advanced options - number of files in the cache
225 # and number of receiving threads.
227 ws_cfiles
=`expr $ws_csize / 10`
231 # Enter the number of AFS daemon processes
234 $ECHO "Enter the number of AFS daemons to run [3]: " $ECHOFLAG
236 if [ x
$ws_numd = "x" ] ; then
241 expr $ws_numd + 1 1> /dev
/null
2> /dev
/null
242 if [ $?
!= 0 ] ; then
243 $ECHO " ERROR: The number of AFS daemons must be numeric. You entered \"$ws_numd\"."
248 # Enter the number of entries in the AFS Stat cache
249 # Default is the number of files in the cache.
252 $ECHO "Enter the number of entries in the AFS stat cache [$ws_cfiles]: " $ECHOFLAG
254 if [ x
$ws_nums = "x" ] ; then
259 expr $ws_nums + 1 1> /dev
/null
2> /dev
/null
260 if [ $?
!= 0 ] ; then
261 $ECHO " ERROR: The number of entries in the stat cache must be numeric. You entered \"$ws_nums\"."
266 # Find out which cells $PRODUCT should work with
269 $ECHO "Enter the AFS cell to access using $PRODUCT [$dhn]: " $ECHOFLAG
271 if [ x
$ws_cell = "x" ] ; then
276 # Create appropriate ThisCell file
278 echo $ws_cell > $ws_wsdir"/etc/ThisCell"
281 # If necessary, add entries to generic cellServDB file
283 grep $ws_cell $ws_wsdir"/etc/CellServDB" 1> /dev
/null
2> /dev
/null
284 if [ $?
!= 0 ] ; then
285 $ECHO " Cell $ws_cell not found in default CellServDB file."
287 $ECHO "Enter a one-line text description for this cell: " $ECHOFLAG
289 $ECHO ">$ws_cell # $exp" >> $ws_wsdir"/etc/CellServDB"
291 $ECHO "Enter the IP address of a database server for this cell ('.' to exit): " $ECHOFLAG
293 while [ x
$ws_dbsrv != "x." ] ; do
294 ws_dbname
=`grep $ws_dbsrv /etc/hosts | sed -e 's;[0-9\.]*[ ]*\([a-z\.A-Z0-9]*\).*;\1;'`
295 if [ x
$ws_dbname = "x" ] ; then
298 $ECHO " Appending $ws_dbname, IP address $ws_dbsrv."
299 $ECHO "$ws_dbsrv #$ws_dbname" >> $ws_wsdir"/etc/CellServDB"
300 $ECHO "Enter the IP address of a database server for this cell ('.' to exit): " $ECHOFLAG
304 $ECHO " Found cell $ws_cell in $ws_wsdir/etc/CellServDB."
310 # "Advanced" configuration items - optional. These are:
312 # - number of RX threads
313 # - number of files in the AFS WebSecure cache
316 # $ECHO "Do you want to configure advanced options? (y/n): " $ECHOFLAG
318 # let=`echo $ans | sed -e 's;\(.\).*;\1;' | tr [A-Z] [a-z]`
320 # if [ x$let = "xy" ] ; then
323 # Enter the number of files in the AFS cache - default is ws_csize/10
326 # $ECHO "Enter the number of files in the Websecure cache [$ws_cfiles]: " $ECHOFLAG
328 # if [ x$ws_cfiles = "x" ] ; then
329 # ws_cfiles=`expr $ws_csize / 10`
333 # expr $ws_cfiles + 1 1> /dev/null 2> /dev/null
334 # if [ $? != 0 ] ; then
335 # $ECHO " ERROR: Number of cache files must be numeric. You entered \"$ws_cfiles\"."
340 # Enter the number of threads to process RX packets
343 # $ECHO "Enter the number of threads to process RX requests [2]: " $ECHOFLAG
345 # if [ x$ws_numt = "x" ] ; then
350 # expr $ws_numt + 1 1> /dev/null 2> /dev/null
351 # if [ $? != 0 ] ; then
352 # $ECHO " ERROR: The number of RX threads must be numeric. You entered \"$ws_numt\"."
359 # Now that we have all the info we need, time to actually edit the obj.conf file
361 # Back up the old one if no previous backup exists
363 if [ -f $ws_conf".pre_ws" ] ; then
364 $ECHO "NOTE: Backup file \"$ws_conf.pre_ws\" already exists."
365 $ECHO " Not backing up current obj.conf file."
367 cp $ws_conf $ws_conf".pre_ws"
368 $ECHO " Creating backup copy of obj.conf file..."
371 $EX $ws_conf << END_OF_FILE 1> /dev/null
375 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"
376 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"
380 AuthTrans fn="nsafs-basic"
381 NameTrans fn="nsafs-mount" mount="/afs"
382 PathCheck fn="nsafs-public" public="/afs"
383 PathCheck fn="nsafs-nolinks" nolinks="/afs/$ws_cell/usr"
387 Service method="(GET|HEAD)" fn="nsafs-send" index="fancy"
393 cp /tmp
/newconf
$ws_conf
397 $ECHO " Installation of $PRODUCT complete."