# # Copyright 02/26/99 Sun Microsystems, Inc. All Rights Reserved. #pragma ident "@(#)request 1.16 99/02/26 Sun Microsystems" # # Purpose: SUNWsnrp package request script # Author: Dan Gordon # Creation date: 08/02/98 # # Details: # # Prompts the installer for necessary information. # # This script is meant to be run as part of the SUNWsnrp package # installation. # # History: # # 09/29/98 - dan.gordon - Added check for chroot. # # 10/06/98 - dan.gordon - Changed so web-proxy is now required. # PATH=/bin:/usr/bin:/sbin:/usr/sbin echo echo "Collecting data for installation . . ." # # Get CHROOTED # # chrooted=1 means we will be chrooted. # chrooted=0 means we will not be chrooted. # echo echo "Is the reverse proxy going to be run from a chroot environment?" goodcha=0 while [ $goodcha -eq 0 ] do echo echo "Run from a chroot environment? [y/n] > \c" read chroot_answer chaverified="`echo \"$chroot_answer\" | sed 's/^\(.\).*/\1/'`" case "$chaverified" in [Yy]) chrooted=1; goodcha=1;; [Nn]) chrooted=0; goodcha=1;; *) echo "Invalid answer. Please answer with Y or N.";; esac done # # get CHROOTDIR # if [ "$chrooted" -eq 1 ]; then echo echo "Enter the directory of the chroot environment." goodchdir=0 while [ $goodchdir -eq 0 ] do echo echo "chroot environment dir > \c" read newchdir chdirverified="`echo \"$newchdir\" | egrep \"^/([-0-9a-zA-Z]+/?)*\"`" if [ -n "$chdirverified" -a -d $newchdir ]; then chrootdir="$newchdir" goodchdir=1 else echo "Invalid directory specified." fi done else chrootdir=NA fi # # Get BASEDIR # echo echo "What BASE INSTALLATION DIRECTORY would you like to use?" if [ "$chrooted" -eq 1 ] ; then echo "Whatever you put here will be added on to your already" echo "specified chroot directory of $chrootdir." fi echo echo "The base installation directory is currently set to $BASEDIR." echo "Enter a new directory if desired or return to accept the default." goodbase=0 while [ $goodbase -eq 0 ] do echo echo "Install base dir [$BASEDIR] > \c" read newbasedir if [ "$newbasedir" = "" ]; then newbasedir=$BASEDIR fi baseverified="`echo \"$newbasedir\" | egrep \"^/([-0-9a-zA-Z]+/?)*\"`" if [ "$chrooted" -eq 1 ] ; then testdir=${chrootdir}${newbasedir} # should already have a slash else testdir=$newbasedir fi if [ -n "$baseverified" -a -d "$testdir" ]; then basedir=$testdir relbasedir=$newbasedir goodbase=1 else echo "Invalid directory specified." fi done # # Get FQDNHOSTNAME # # # Try to determine fqdnhostname from dns first # Get all active IP's and take first one hostiplist=`ifconfig -au | grep -v "127\.0\.0\.1" | awk '/inet/ {print $2}'` hostip=`echo $hostiplist | awk '{print $1}'` fqdnhname=`nslookup $hostip 2> /dev/null | awk '/Name:/ {print $2}'` goodhost1=0 while [ $goodhost1 -eq 0 ] do echo echo "Please enter the fully qualified domain name of the host this" if [ -n "$fqdnhname" ] then echo "is being installed on [$fqdnhname]." else echo "is being installed on." echo echo "For example: rproxyhost.corp.sun.com" fi echo "> \c" read fqdnname fqdnhostname=${fqdnname:-$fqdnhname} hostverified="`echo \"$fqdnhostname\" | \ egrep \"^[a-zA-Z0-9][-a-zA-Z0-9]*\.([a-zA-Z0-9][-a-zA-Z0-9]*\.)*[a-zA-Z0-9][a-zA-Z0-9]*$\"`" if [ -n "$hostverified" ] then echo echo "Using $fqdnhostname as host." goodhost1=1 else echo echo "Problem with format of host." fi done # # Get EPROXYPORT # goodport1=0 while [ $goodport1 -eq 0 ] do echo echo "Please enter the number of the port you would like the" echo "encrypting proxy to run on on host $fqdnhostname." echo echo "eproxy port [443] > \c" read port1 if [ "$port1" = "" ] then port1=443 echo echo "Using $port1 as eproxy port." goodport1=1 else port1verified="`echo \"$port1\" | egrep \"[0-9]+\"`" if [ -n "$port1verified" ] then echo echo "Using $port1 as eproxy port." goodport1=1 else echo echo "Problem with format of port." fi fi done # # Get RPROXYPORT # goodport2=0 while [ $goodport2 -eq 0 ] do echo echo "Please enter the number of the port you would like the" echo "reverse proxy to run on on host $fqdnhostname. This must" echo "be a different port number than the encrypting proxy." echo echo "rproxy port [10443] > \c" read port2 if [ "$port2" = "" ] then port2=10443 echo echo "Using $port2 as rproxy port." goodport2=1 else port2verified="`echo \"$port2\" | egrep \"[0-9]+\"`" if [ -n "$port2verified" ] then if [ "$port2" != "EPROXYPORT" ] then echo echo "Using $port2 as rproxy port." goodport2=1 else echo echo "reverse proxy port must not be the same a encrypting proxy port." fi else echo echo "Problem with format of port." fi fi done # # Get AUTHSSLMODE # # authsslmode=1 means we will use ssl to the platform server # authsslmode=0 means we will not use ssl to the platform server # echo echo "Is the reverse proxy going to use ssl to communicate with the platform server?" goodssl=0 while [ $goodssl -eq 0 ] do echo echo "Use ssl from reverse proxy to platform server? [y/n] > \c" read ssl_answer sslverified="`echo \"$ssl_answer\" | sed 's/^\(.\).*/\1/'`" case "$sslverified" in [Yy]) authsslmode=1; goodssl=1;; [Nn]) authsslmode=0; goodssl=1;; *) echo "Invalid answer. Please answer with Y or N.";; esac done # # Generate RELRPPATH # relrppath=${relbasedir}/${PKG} # # Generate ABSRPPATH # absrppath=${basedir}/${PKG} # # Get NSPROXYHOST # goodhost2=0 while [ $goodhost2 -eq 0 ] do echo echo "Please enter the name and domain name of the host" echo "which will be used as a web proxy host." echo echo "For example: web-proxyhost.corp" echo echo "If a web proxy is not available, or one is not required" echo "hit enter to continue. [] > \c" read nsproxyhost if [ "$nsproxyhost" != "" ] then hostverified="`echo \"$nsproxyhost\" | \ egrep \"^[a-zA-Z0-9][-a-zA-Z0-9]*\.([a-zA-Z0-9][-a-zA-Z0-9]*\.)*[a-zA-Z0-9][a-zA-Z0-9]*$\"`" if [ -n "$hostverified" ] then echo echo "Using $nsproxyhost as host." goodhost2=1 else echo echo "Problem with format of host." fi else echo echo "Not using a web proxy" goodhost2=1 fi done # # Get NSPROXYPORT if a web proxy was specified # if [ "$nsproxyhost" != "" ] then goodport3=0 while [ $goodport3 -eq 0 ] do echo echo "Please enter the number of the port which the web" echo "proxy runs on on host $nsproxyhost." echo echo "web proxy port > \c" read port3 port3verified="`echo \"$port3\" | egrep \"[0-9]+\"`" if [ -n "$port3verified" ] then echo echo "Using $port3 as web proxy port." goodport3=1 else echo echo "Problem with format of port." fi done nsproxyhost_and_port="${nsproxyhost}:${port3}" usensproxy="true" else nsproxyhost_and_port="" usensproxy="false" fi # # Get FQDNAUTHSERVER # goodhost3=0 while [ $goodhost3 -eq 0 ] do echo echo "Please enter the fully qualified domain name of the auth server" echo "which will be used." echo echo "For example: authhost.corp.sun.com" echo "> \c" read fqdnauthserver hostverified="`echo \"$fqdnauthserver\" | \ egrep \"^[a-zA-Z0-9][-a-zA-Z0-9]*\.([a-zA-Z0-9][-a-zA-Z0-9]*\.)*[a-zA-Z0-9][a-zA-Z0-9]*$\"`" if [ -n "$hostverified" ] then echo echo "Using $fqdnauthserver as auth host." goodhost3=1 else echo echo "Problem with format of host." fi done # # Generate AUTHHOST # authhost="`echo $fqdnauthserver | awk -F. '{print $1}'`" # # Get AUTHPORT # goodport4=0 while [ $goodport4 -eq 0 ] do echo echo "Please enter the number of the port which the auth." echo "server runs on host $fqdnauthserver." echo echo "auth. port [8080] > \c" read port4 if [ "$port4" != "" ] then port4verified="`echo \"$port4\" | egrep \"[0-9]+\"`" if [ -n "$port4verified" ] then echo echo "Using $port4 as port on auth. server." goodport4=1 else echo echo "Problem with format of port." fi else port4="8080" goodport4=1 fi done # # Get AUTHSSLPORT # goodport6=0 while [ $goodport6 -eq 0 ] do echo echo "Please enter the number of the port which the auth." echo "secure server runs on host $fqdnauthserver." echo echo "auth. port [443] > \c" read port6 if [ "$port6" != "" ] then port6verified="`echo \"$port6\" | egrep \"[0-9]+\"`" if [ -n "$port6verified" ] then echo echo "Using $port6 as port on auth. server." goodport6=1 else echo echo "Problem with format of port." fi else port6="443" goodport6=1 fi done # # get preferences host # # # Get FQDNAUTHSERVER # goodhost4=0 while [ $goodhost4 -eq 0 ] do echo echo "Please enter the fully qualified domain name of the preference server" echo "which will be used." echo echo "For example: authhost.corp.sun.com" echo "> \c" read prefserver hostverified="`echo \"$prefserver\" | \ egrep \"^[a-zA-Z0-9][-a-zA-Z0-9]*\.([a-zA-Z0-9][-a-zA-Z0-9]*\.)*[a-zA-Z0-9][a-zA-Z0-9]*$\"`" if [ -n "$hostverified" ] then echo echo "Using $prefserver as preferences host." goodhost4=1 else echo echo "Problem with format of host." fi done # # Get preferences port # goodport5=0 while [ $goodport5 -eq 0 ] do echo echo "Please enter the number of the port which the preference" echo "server runs on host $fqdnauthserver." echo echo "auth. port [8080] > \c" read port5 if [ "$port5" != "" ] then port5verified="`echo \"$port5\" | egrep \"[0-9]+\"`" if [ -n "$port5verified" ] then echo echo "Using $port5 as port on preferences server." goodport5=1 else echo echo "Problem with format of port." fi else port5="8080" goodport5=1 fi done # # Get DOMAIN # dom="" gooddom=0 while [ $gooddom -eq 0 ] do echo echo "Enter the domain name for your network not including" echo " any subdomains. For example, xyz.com." echo echo "Domain name > \c" read dom if [ "$dom" != "" ] then numtok=`echo "$dom" | awk ' BEGIN { FS="." } { print NF }'` if [ $numtok -eq 2 ] then dom=".""$dom" gooddom=1 else echo "Invalid domain name entered, do not include subdomains" fi else echo "Invalid domain name entered" fi done # # Get SUBDOMAIN # echo echo "Enter the subdomains which reside on your private network" echo "that will be served by rproxy. Enter the subdomains one" echo "at at time. Hit enter at the prompt when finished. For" echo "example, corp." echo subdom="" goodsubdom=0 while [ $goodsubdom -eq 0 ] do echo echo "Subdomain (hit to end) > \c" read subd if [ "$subd" != "" ] then if [ "$subdom" = "" ] then subdom="$subd" else subdom="$subdom""|""$subd" fi else if [ "$subdom" = "" ] then echo "No subdomain entered" fi goodsubdom=1 fi done # # Make all vars available to rest of install program # cat > $1 <