home *** CD-ROM | disk | FTP | other *** search
/ ftp.rsa.com / 2014.05.ftp.rsa.com.tar / ftp.rsa.com / pub / agents / WebAgent_70_Apache_RHEL5_64_379_08201024.tar / CD / install next >
Text File  |  2010-08-23  |  37KB  |  1,321 lines

  1. #!/bin/sh 
  2. #
  3. # Installation script for the RSA Authentication Agent for Web Servers Plugin.
  4. #
  5. #
  6. #********************************************************************************
  7. #* COPYRIGHT (C) 2009  by RSA Security Inc.
  8. #*    ---ALL RIGHTS RESERVED---
  9. #********************************************************************************
  10. #
  11.  
  12. ############################################################
  13. # Set default values and commands for the shell script.
  14. ############################################################
  15. clear
  16.  
  17. UNAME=`uname`
  18. UNAMER=`uname -r`
  19. HOSTNAME=`hostname`
  20. WEBSERVER="apache"
  21. WEBSERVERNAME="Apache"
  22. if [ $WEBSERVER = "iplanet" ] ; then
  23. WEBSERVERNAME="Sun Java System"
  24. fi
  25. PROCESS_LIST="httpd"
  26. PLATFORM_OK=FALSE
  27. myNewVersion=
  28. myOldVersion=
  29. BACKUP_OLD=
  30. TEMP_WEB_AGENT=
  31.  
  32. HERE=`dirname $0` 
  33. THEPWD=`/bin/pwd`
  34. if [ "$HERE" = "." ]; then
  35.     HERE="$THEPWD"
  36. else
  37. #if $HERE isn't absolute path add `pwd` to it
  38.  
  39.     cd $HERE
  40.     HERE=`/bin/pwd`
  41.     cd $THEPWD
  42. fi
  43.  
  44. #suji needs to change
  45. ########################
  46. ########################
  47. APACHE_DOCS=""
  48. APACHE_CONFIG=""
  49. APACHE_EXEC=""
  50. APACHE_LIB=""
  51. CONF_FILE=""
  52. OBJCONF_FILE=""
  53. WEB_AGENT="/tmp/toto"
  54. WEB_AGENT_DIR="rsawebagent"
  55. WEB_AGENT_TAR="$WEB_AGENT_DIR.tar"
  56. WEB_AGENT_DOC="doc"
  57. WEB_AGENT_README="readme"
  58. WEB_AGENT_TAR_GZ="$WEB_AGENT_TAR.gz"
  59. LICENSE="$HERE/license.txt"
  60. LICENSE2="$HERE/license2.txt"
  61. PATH_ROOT=""
  62. DF="df -P -k"
  63. MPM_WORKER_CONFIG=FALSE
  64.  
  65. # Disk space require for the installation
  66. SPACE=3500
  67.  
  68. PLUG_IS_INSTLD=FALSE
  69. ADMIN_IS_INSTLD=FALSE
  70. BACKUP_CRTD=FALSE
  71. PREV_INSTL=FALSE
  72.  
  73. echo_no_nl_mode="unknown"
  74.  
  75. ##############################################################################
  76. # Trap 
  77. #    this will trap any escape characters, and allow the program to abort normally 
  78. #    by calling abort_installation
  79. ##############################################################################
  80. trap 'trap "" 1 2 15; abort_installation' 1 2 15
  81.  
  82. ##############################################################################
  83. # echo_no_nl()
  84. #       Echo a string with no carriage return (if possible).  Must set
  85. #       $echo_no_nl to "unknown" before using for the first time.
  86. ##############################################################################
  87. echo_no_nl()
  88. {
  89.   if [ "$echo_no_nl_mode" = "unknown" ] ; then
  90.      echo_test=`echo \\\c`
  91.      if [ "$echo_test" = "\c" ] ; then
  92.         echo_no_nl_mode="-n"
  93.      else
  94.         echo_no_nl_mode="\c"
  95.      fi
  96.   fi
  97.  
  98.   if [ "$echo_no_nl_mode" = "\c" ] ; then
  99.      echo $* \\c
  100.   else
  101.      echo -n $*
  102.   fi
  103. }
  104.  
  105.  
  106. ##############################################################################
  107. # getfilename()
  108. # Gets a filename
  109. #   $1  The string to print to prompt the user
  110. #   $2  The default value if user hits <Enter> (y/n)
  111. #   $3  Type : DIRECTORY, EXISTINGFILE, NEWFILE, NEWDIRECTORY
  112. # The variable $YESORNO is set in accordance to what the user entered.
  113. ##############################################################################
  114. getfilename()
  115. {
  116. #####################################################
  117. # Set up line parameters as $1 and $2 are overwritten
  118. #####################################################
  119.   theprompt=$1
  120.   thedefault=$2
  121.   thetype=$3
  122.  
  123.   theans=""
  124.   until [ -n "$theans" ] ;
  125.   do
  126.     echo ""
  127.     echo_no_nl "$theprompt [$thedefault] "
  128.     read theans
  129.  
  130.     if [ "$theans" = "" ] ; then
  131.       theans=$thedefault
  132.     fi
  133.     case $thetype in
  134.         DIRECTORY) if [ ! -d "$theans" ]; then
  135.                         echo Directory $theans doesn\'t exist
  136.                         theans=""
  137.                    fi;;
  138.         READFILE)  if [ ! -f "$theans" ]; then
  139.                         echo File $theans doesn\'t exist
  140.                         theans=""
  141.                    elif [ ! -r "$theans" ]; then
  142.                         echo File "$theans" isn\'t readable
  143.                         theans=""
  144.                    fi;;
  145.         WRITEFILE)  if [ ! -f "$theans" ]; then
  146.                         echo File $theans doesn\'t exist
  147.                         theans=""
  148.                    elif [ ! -w "$theans" ]; then
  149.                         echo File "$theans" isn\'t writable
  150.                         theans=""
  151.                    fi;;
  152.         EXECFILE)  if [ ! -f "$theans" ]; then
  153.                         echo File $theans doesn\'t exist
  154.                         theans=""
  155.                    elif [ ! -x "$theans" ]; then
  156.                         echo File "$theans" isn\'t writable
  157.                         theans=""
  158.                    fi;;
  159.         NEWFILE)   if [ -f "$theans" ]; then
  160.                         echo File $theans already exist
  161.                         theans=""
  162.                    elif [ ! -d `dirname $theans` ]; then
  163.                         echo Directory `dirname $theans` doesn\'t exist
  164.                         theans=""
  165.                    elif [ ! -w `dirname $theans` ]; then
  166.                         echo Directory `dirname $theans` isn\'t writable
  167.                         theans=""
  168.                    fi;;
  169.         *);;
  170.     esac
  171.   done
  172.  
  173. }
  174.  
  175.  
  176. ##########################################################################
  177. #
  178. # getservername()
  179. # The variable WEBSERVER is set to the name of the server being used
  180. ##########################################################################
  181. #getservername()
  182. #{
  183. #####################################################
  184. # Set up line parameters as $1 and $2 are overwritten
  185. #####################################################
  186. #  theprompt=$1
  187. #  thedefault=$2
  188.  
  189. #### asf
  190. #  theans=2
  191. #  echo ""
  192.   
  193. #  while [ "$theans" != "1" ] && [ "$theans" != "2" ]
  194. #  do
  195. #  echo
  196. #  echo " 1. Apache"
  197. #  echo " 2. Sun ONE"
  198. #  echo
  199. #  echo_no_nl "$theprompt [$thedefault] "
  200. #  read theans
  201. #  if [ "$theans" = "" ] ; then
  202. #    theans=1
  203. #  fi
  204. #  done
  205.   
  206. #  if [ "$theans" = "1" ] ; then
  207. #    WEBSERVER="apache"
  208. #    PROCESS_LIST=" httpd| aceapi_rpc_"
  209. #  else
  210. #    WEBSERVER="iplanet"
  211. #    PROCESS_LIST="ns-httpd| aceapi_rpc_"
  212. #  fi
  213. ##### This is modified during kit generation by the makefile
  214. # WEBSERVER=""
  215. #####
  216. #}
  217.  
  218. ##############################################################################
  219. # getAcceptDecline()
  220. # Gets either a "Accept" or a "Decline" in the traditional (a/d) pattern 
  221. #               $1      The default value if user hits <Enter> (TRUE/FALSE)
  222. #               $2      The string to print to prompt the user
  223. # The variable $AORD is set in accordance to what the user entered.
  224. ##############################################################################
  225. getAcceptDecline()
  226. {
  227. #####################################################
  228. # Set up line parameters as $1 and $2 are overwritten
  229. #####################################################
  230.   AorDdef=$1
  231.   AorDprompt=$2
  232.  
  233.   AORD=""
  234.   until [ -n "$AORD" ] ;
  235.   do
  236.     echo ""
  237.     echo_no_nl $AorDprompt
  238.     read AORD
  239.  
  240.     AORD=`echo $AORD | tr '[a-z]' '[A-Z]'`
  241.  
  242.     case "$AORD"
  243.     in
  244.       A|ACCEPT )  AORD=TRUE;;
  245.       D|DECLINE )  AORD=FALSE;;
  246.       ''  )  AORD=$AorDdef;;
  247.       *   )  echo ""
  248.              echo "Please enter 'A', 'D' or '<return>' "
  249.              AORD="";;
  250.     esac
  251.   done
  252.  
  253. }
  254.  
  255.  
  256. ##############################################################################
  257. # getyesorno()
  258. # Gets either a "yes" or a "no" in the traditional (y/n) pattern 
  259. #               $1      The default value if user hits <Enter> (TRUE/FALSE)
  260. #               $2      The string to print to prompt the user
  261. # The variable $YESORNO is set in accordance to what the user entered.
  262. ##############################################################################
  263. getyesorno()
  264. {
  265. #####################################################
  266. # Set up line parameters as $1 and $2 are overwritten
  267. #####################################################
  268.   yesornodef=$1
  269.   yesornoprompt=$2
  270.  
  271.   YESORNO=""
  272.   until [ -n "$YESORNO" ] ;
  273.   do
  274.     echo ""
  275.     echo_no_nl $yesornoprompt
  276.     read YESORNO
  277.  
  278.     case "$YESORNO"
  279.     in
  280.       y|Y )  YESORNO=TRUE;;
  281.       n|N )  YESORNO=FALSE;;
  282.       ''  )  YESORNO=$yesornodef;;
  283.       *   )  echo ""
  284.              echo "Please enter 'y', 'n' or '<return>' "
  285.              YESORNO="";;
  286.     esac
  287.   done
  288.  
  289. }
  290.  
  291.  
  292. ##############################################################################
  293. # abort_installation()
  294. # This subroutine removes files that were recently installed and restores
  295. # the previous installation files, if they existed.
  296. ##############################################################################
  297. abort_installation()
  298. {
  299.   echo ""
  300.   echo "Aborting Installation..."
  301.  
  302.   if [ "$BACKUP_CRTD" = TRUE ] ; then
  303.     echo "Restoring Config Files..."
  304.  
  305.     cp -pf $CONF_SAVE $CONF_FILE
  306.     rm -f $CONF_SAVE
  307.  
  308.     if [ $WEBSERVER = "iplanet" ] ; then
  309.       cp -pf $OBJCONF_SAVE $OBJCONF_FILE
  310.       rm -f $OBJCONF_SAVE
  311.     fi
  312.  
  313.   fi
  314.  
  315.   if [ "$PLUG_IS_INSTLD" = TRUE ] ; then
  316.     echo "Removing installed Files...."
  317.     rm -rf "$WEB_AGENT"
  318.   fi 
  319.  
  320.   if [ "$PREV_INSTL" = TRUE ] ; then
  321.     echo "Restoring Old Agent..."
  322.     cp -Rpf $TEMP_WEB_AGENT $WEB_AGENT
  323.     rm -rf $TEMP_WEB_AGENT
  324.   fi
  325.  
  326.   exit 1
  327. }
  328.  
  329.  
  330. ############################################################
  331. # Display the License and Copyright files.
  332. ############################################################
  333. startup_screen()
  334. {
  335.  
  336.     # Changed so that we could have both license files shown
  337.     getyesorno TRUE "ARE YOU A CUSTOMER ORDERING THIS RSA PRODUCT FROM RSA SECURITY INC., FROM EITHER NORTH AMERICA, SOUTH AMERICA OR THE PEOPLE'S REPUBLIC OF CHINA (EXCLUDING HONG KONG): (y/n) [y]"
  338.     if [ "$YESORNO" = TRUE ] ; then
  339.         if [ -f $LICENSE ] ; then
  340.         more $LICENSE 
  341.     else
  342.         echo "The License Agreement text file could not be found in the current directory."
  343.         echo "Installation is aborting..."
  344.             abort_installation
  345.     fi
  346.     else
  347.         if [ -f $LICENSE2 ] ; then
  348.         more $LICENSE2 
  349.     else
  350.         echo "The License Agreement text file could not be found in the current directory."
  351.         echo "Installation is aborting..."
  352.         abort_installation
  353.     fi
  354.     fi
  355.  
  356.      getAcceptDecline FALSE "Do you accept the License Terms and Conditions stated above? (Accept/Decline) [D]"
  357.     if [ "$AORD" = FALSE ] ; then
  358.     abort_installation;
  359.     fi
  360. }
  361.  
  362. ############################################################
  363. # Check to see if the environment variable VAR_ACE is
  364. # defined and sdconf.rec exists
  365. ############################################################
  366. check_sdconf()
  367. {
  368. noerror=0
  369. if [ ! -n "$VAR_ACE" ]; then
  370.     VAR_ACE="/var/ace"
  371. fi
  372. theans=""
  373. while [ "$theans" = "" ] 
  374. do
  375.     getfilename "Enter Directory where sdconf.rec is located" $VAR_ACE DIRECTORY
  376.     if [ ! -f "$theans/sdconf.rec" ]; then 
  377.     echo file "$theans/sdconf.rec" not found
  378.     theans=""
  379.     elif [ ! -r "$theans/sdconf.rec" ]; then
  380.     echo file "$theans/sdconf.rec" not readable: change protection if needed
  381.         VAR_ACE="$theans"
  382.     theans=""
  383.     else
  384.     if [ "$theans" != "" ]; then
  385.             VAR_ACE="$theans"
  386.     fi
  387.     break
  388.     fi
  389.     
  390. done
  391.     
  392. }
  393.  
  394. ############################################################
  395. # Check to see if this is a supported platform.
  396. ############################################################
  397. check_platform()
  398. {
  399. case $UNAME in
  400. SunOS) 
  401.     ARCH=`uname -p`
  402.     if [ "$ARCH" = "i386" ] ; then
  403.         if [ `/usr/bin/isainfo -kv | cut -f 1 -d '-'` = "32" ] ; then
  404.             OS_DIR=sol-10-x86-32
  405.         else
  406.             OS_DIR=sol-10-x86-64
  407.         fi
  408.     else
  409.         if [ `/usr/bin/isainfo -kv | cut -f 1 -d '-'` = "64" ] ; then
  410.             OS_DIR=sol-10-sparc-64
  411.         else
  412.             OS_DIR=sol-9-sparc-32
  413.         fi
  414.     fi
  415.        DF="/usr/xpg4/bin/df -P -k";;
  416. Linux)
  417.     case $UNAMER in
  418.     2.4.* )
  419.        OS_DIR=lnxas3;;
  420.     2.6.* ) 
  421.         if [ `uname -r | cut -f 1 -d '-'` = "2.6.18" ] ; then
  422.             if [ `getconf LONG_BIT` = "32" ] ; then
  423.                 OS_DIR=rhel-5.1-x86-32
  424.                         else
  425.                 OS_DIR=rhel-5.1-x86-64
  426.             fi
  427.         else
  428.             OS_DIR=rhel-4-x86-32
  429.         fi;;
  430.     * )
  431.        OS_DIR=lnx;;
  432.     esac;;
  433. HP*) OS_DIR=hp11;;
  434. esac
  435. case $WEBSERVER
  436.    in
  437.      apache )
  438.         case $UNAME in
  439.                 Linux|SunOS);;
  440.                 *)
  441.                       echo ""
  442.                       echo "Sorry, $UNAME is not currently supported for $WEBSERVERNAME."
  443.                       echo ""
  444.                       abort_installation;;
  445.         esac ;;
  446.  
  447.      iplanet )
  448.         case $UNAME in
  449.                 HP*|SunOS);;
  450.                 *)
  451.                    echo ""
  452.                    echo "Sorry, $UNAME is not currently supported for $WEBSERVERNAME
  453. ."
  454.                    echo ""
  455.                    abort_installation;;
  456.         esac ;;
  457.  
  458.      * ) echo ""
  459.          echo "Sorry, $WEBSERVERNAME Web Server is not currently supported."
  460.  echo ""
  461.          abort_installation
  462.          ;;
  463.  
  464. esac
  465. }
  466.  
  467.  
  468.  
  469. ############################################################
  470. # Check to see if webserver is running.
  471. ############################################################
  472. check_if_webserver_running()
  473. {
  474. a=`ps -ecf | grep -v grep | egrep "$PROCESS_LIST" | egrep -v "https-adms" | wc -l`
  475. if [ $a != 0 ] ; then
  476.     echo
  477.     echo "We recommend you stop the Web server before installing the Agent."
  478.     getyesorno FALSE "Do you want to continue (y/n) [n]:"
  479.     if [ "$YESORNO" = FALSE ] ; then
  480.             abort_installation 
  481.     fi
  482. fi
  483. }
  484.  
  485.  
  486. ############################################################
  487. # Check to see if this is a supported webserver platform.
  488. ############################################################
  489. check_webserver()
  490. {
  491. case $WEBSERVER in
  492.  'apache' )
  493.     apachevers=`$APACHE_EXEC -v | grep Apache | sed "s/.*Apache\///" | awk ' {print $1} '`
  494.     case $apachevers in
  495.        2.2.*) ;;
  496.          *)  echo ""
  497.         echo "Sorry, $WEBSERVERNAME version $apachevers is not currently supported."
  498.         echo "The install script will abort the installation"
  499.         echo "process. Please update the $WEBSERVERNAME web server"
  500.         echo "to version $WEBSERVERNAME/2.2 or patch of this version and reinstall the web agent."
  501.         echo ""
  502.         abort_installation ;;                                                
  503.     esac 
  504. ########################
  505. # Check whether Apache has been installed to allow shared modules
  506. ########################
  507.     if [ ! -n "`$APACHE_EXEC -l | grep -v grep | grep mod_so.c`" ] ; then
  508.        echo "" 
  509.        echo "RSA Authentication Agent v7.0 for Web for $WEBSERVERNAME can not be installed on your system"
  510.        echo "The current installation of $WEBSERVERNAME Web Server does not"
  511.        echo "allow for shared modules."
  512.        echo "Please re-install $WEBSERVERNAME to enable shared modules"
  513.        echo "and try again"
  514.        abort_installation
  515.     fi
  516.  
  517. ########################
  518. # Check to see if Apache is installed in worker MPM configuration.
  519. # If so, we must install the threaded libaceauth.so instead of
  520. # using the rpc server.
  521. ########################
  522. ##    if [ -n "`$APACHE_EXEC -l | grep -v grep | grep worker.c`" ] ; then
  523.     if [ -n "`$APACHE_EXEC -l | grep -v grep | grep worker.c`" ] ; then
  524.         MPM_WORKER_CONFIG=TRUE
  525.     fi
  526.  
  527.    ;;
  528.  
  529.    'iplanet' ) 
  530.      ipvers=`$WEB_SERVER_ROOT/start -version | grep iPlanet | cut -d/ -f2 | awk ' {print $1} '`
  531.      if [ ! -n "$ipvers" ] ; then
  532.         ipvers=`$WEB_SERVER_ROOT/start -version | grep "Sun ONE Web Server" | cut -d" " -f5 | awk ' {print $1} '`
  533.      fi
  534.  
  535.      case $ipvers in
  536.     6.0* | 6.1* ) ;;
  537.     * ) echo ""
  538.         echo "Sorry, $WEBSERVERNAME version $ipvers is not currently supported."        echo "The install script will abort the installation"
  539.         echo "process. Please update the $WEBSERVERNAME web server"
  540.         echo "to version Sun Java System Web Server 6.x and reinstall the web agent."
  541.         echo ""
  542.         abort_installation
  543.    ;;
  544.    esac
  545.  
  546. ;;
  547. esac
  548. }
  549.  
  550.  
  551.  
  552. ############################################################
  553. # Ask the user for the Web Server Root and setup
  554. # other installation information
  555. ############################################################
  556. setup_paths()
  557. {
  558. WEB_SERVER_ROOT=""
  559.  
  560. #############################################################
  561. ###############  A P A C H E  ###############################
  562. #############################################################
  563. case $WEBSERVER in
  564.    'apache' )
  565.  
  566. ###########################################
  567. # Get the Apache Server Root directory path
  568. ###########################################
  569. DEFAULT_ROOT="/etc/httpd"
  570. if [ ! -d  "$DEFAULT_ROOT" ] ; then
  571.     DEFAULT_ROOT="/usr/local/apache2"
  572.     if [ ! -d  "$DEFAULT_ROOT" ] ; then
  573.     DEFAULT_ROOT="/usr/apache2"
  574.     if [ ! -d  "$DEFAULT_ROOT" ] ; then
  575.         DEFAULT_ROOT="/usr/local/apache"
  576.         if [ ! -d  "$DEFAULT_ROOT" ] ; then
  577.         DEFAULT_ROOT="/usr/apache"
  578.             if [ ! -d  "$DEFAULT_ROOT" ] ; then
  579.             DEFAULT_ROOT="/usr/apache2"
  580.             fi
  581.         fi
  582.     fi
  583.     fi
  584. fi
  585.  
  586. #####################################
  587. # Easiest fix for DOC Apache, Readme
  588. # versus DOC everything else, readme.
  589. #####################################
  590. WEB_AGENT_README="Readme"
  591.  
  592. until [ -n "$WEB_SERVER_ROOT" ] ;
  593. do
  594.     echo ""
  595.     getfilename "Please enter the path for the $WEBSERVERNAME installation directory" $DEFAULT_ROOT DIRECTORY
  596.     WEB_SERVER_ROOT=$theans
  597.     
  598. # The following logic has been disabled because it causes
  599. # problems across differing valid environments.  Later
  600. # prompts resolve all necessary input for the Agent install,
  601. # even if the Apache install directory does not follow the
  602. # form implied in the below checking.
  603. #
  604. #    if [ ! -f $WEB_SERVER_ROOT/conf/httpd.conf ] ; then
  605. #      if [ ! -f $WEB_SERVER_ROOT/bin/httpd ] ; then
  606. #        echo ""
  607. #        echo "The path, $WEB_SERVER_ROOT, is not a valid path to your $WEBSERVERNAME root dir."
  608. #        WEB_SERVER_ROOT=""
  609. #      fi
  610. #    fi
  611.  
  612.     if [ "$WEB_SERVER_ROOT" != "" ]; then
  613.          dir="`$DF $WEB_SERVER_ROOT | sed -e "1,1d" | awk '{print($4)}'`"
  614.         if [ $dir -lt $SPACE ] ; then
  615.             echo ""
  616.               echo "The path, $WEB_SERVER_ROOT, does not have enough disk space to install the web agent."
  617.                 WEB_SERVER_ROOT=""
  618.          fi
  619.     fi
  620.  
  621. done
  622.  
  623. ##############################
  624. # Now find the httpd.conf file
  625. ##############################
  626. CONFIG_TMP="/usr/local/apache/conf/httpd.conf" 
  627. if [ -f $WEB_SERVER_ROOT/conf/httpd.conf ]; then
  628.    CONFIG_TMP=$WEB_SERVER_ROOT/conf/httpd.conf
  629. fi
  630.  
  631. #############
  632. # Now Confirm
  633. #############
  634.  
  635. echo ""
  636. getfilename "Please enter the path for the $WEBSERVERNAME Configuration File " $CONFIG_TMP WRITEFILE
  637. CONF_FILE=$theans
  638.  
  639. INSTALL_USER=`ps -f | awk '{ print $1 " " $2 }' | grep $$ | awk '{ print $1 }'`
  640. SERVER_USER=`grep "^User " $CONF_FILE | awk '{print $2}' | sed "s/#//" `
  641. SERVER_GROUP=`grep "^Group " $CONF_FILE | awk '{print $2}' | sed "s/#//" `
  642. if [ "$INSTALL_USER" = "root" ]; then
  643.     if [ "$SERVER_USER" = ""  ] || [ "$SERVER_USER" = "-1"  ]  ; then
  644.        echo "Error: could not find a valid User in $CONF_FILE"
  645.         echo
  646.         echo "You need to set a valid User directive in the $CONF_FILE file"
  647.         abort_installation 
  648.     fi
  649.     if [ "$SERVER_GROUP" = ""  ] || [ "$SERVER_GROUP" = "-1"  ]  ; then
  650.        echo "Error: could not find a valid Group in $CONF_FILE"
  651.         echo
  652.         echo "We recommend you set a valid Group directive in the $CONF_FILE file"
  653.         getyesorno FALSE "Do you want to continue (y/n) [n]:"
  654.         if [ "$YESORNO" = FALSE ] ; then
  655.             abort_installation 
  656.         fi
  657.     fi
  658. fi
  659. CONF_TMP="$CONF_FILE.tmp"
  660. CONF_SAVE="$CONF_FILE."`date +%D%T | sed "s/\//-/g" `
  661. ##############################
  662. # Now find the httpd executable
  663. ##############################
  664. EXEC_TMP="" 
  665. EXEC_TMP=$WEB_SERVER_ROOT/bin/httpd
  666. if [ ! -x $EXEC_TMP ]; then
  667.     EXEC_TMP=$WEB_SERVER_ROOT/src/httpd
  668.     if [ ! -x $EXEC_TMP ]; then
  669.         EXEC_TMP=`whereis httpd | awk '{print $2}'`
  670.         if [ "$EXEC_TMP" = "" ]; then
  671.             EXEC_TMP="/usr/bin/httpd"
  672.         fi
  673.     fi
  674. fi
  675.  
  676. echo ""
  677. getfilename "Please enter the path for the $WEBSERVERNAME httpd binary file" $EXEC_TMP EXECFILE
  678. APACHE_EXEC=$theans
  679.  
  680. APACHE_LIB=""
  681. if [ "$UNAME" = "SunOS" ]; then
  682. ##############################
  683. # Now find the apache lib directory
  684. ##############################
  685. LIB_TMP="" 
  686. LIB_TMP=$WEB_SERVER_ROOT/lib
  687. if [ ! -d $LIB_TMP ]; then
  688.     LIB_TMP=`dirname $APACHE_EXEC`
  689.     LIB_TMP=$LIB_TMP/../lib
  690.     if [ ! -d $LIB_TMP ]; then
  691.     LIB_TMP=$WEB_SERVER_ROOT/lib
  692.     fi
  693. fi
  694.  
  695. echo ""
  696. getfilename "Please enter the path for the $WEBSERVERNAME library directory" $LIB_TMP DIRECTORY
  697. APACHE_LIB=$theans
  698. fi
  699.  
  700.    ;;
  701.  
  702. #############################################################
  703. ###############  I P L A N E T  #############################
  704. #############################################################
  705.   iplanet )
  706. ################################
  707. # Get the Web Server root directory path
  708. ################################
  709.     DEFAULT_ROOT="/etc/iplanet/servers"
  710.     if [ ! -d  "$DEFAULT_ROOT" ] ; then
  711.         DEFAULT_ROOT="/usr/iplanet/servers"
  712.         if [ ! -d  "$DEFAULT_ROOT" ] ; then
  713.             DEFAULT_ROOT="/usr/local/iplanet/servers"
  714.         fi
  715.     fi
  716.     DEFAULT_ROOT=`ls -1d $DEFAULT_ROOT/https-* 2>/dev/null| grep -v admserv 2>/dev/null| head -1 2>/dev/null` 
  717.  
  718.     WEB_SERVER_ROOT=""
  719.     while [ "$WEB_SERVER_ROOT" = "" ] ;
  720.     do
  721.         echo ""
  722.         getfilename "Please enter the path for the $WEBSERVERNAME servername directory" $DEFAULT_ROOT DIRECTORY
  723.         WEB_SERVER_ROOT=$theans
  724.         if [ ! -f $WEB_SERVER_ROOT/config/magnus.conf ] ; then
  725.             echo ""
  726.             echo "The path, $WEB_SERVER_ROOT, is not a valid path to your $WEBSERVERNAME root dir."
  727.             WEB_SERVER_ROOT=""
  728.         else
  729.             dir="`$DF $theans | sed -e "1,1d" | awk '{print($4)}'`"
  730.            if [ $dir -lt $SPACE ] ; then
  731.             echo ""
  732.               echo "The path, $WEB_SERVER_ROOT, does not have enough disk space to install the web agent."
  733.                 WEB_SERVER_ROOT=""
  734.             fi
  735.         fi
  736.  
  737.     done
  738.  
  739.     CONF_FILE=$WEB_SERVER_ROOT/config/magnus.conf
  740.     OBJCONF_FILE=$WEB_SERVER_ROOT/config/obj.conf
  741.  
  742. #############
  743. # Now Confirm
  744. #############
  745.  
  746.  
  747.     INSTALL_USER=`ps -f | awk '{ print $1 " " $2 }' | grep $$ | awk '{ print $1 }'`
  748.     SERVER_USER=`grep "^User " $CONF_FILE | awk '{print $2}'`
  749.     SERVER_GROUP=`ls -l $CONF_FILE | awk '{print $4}'`
  750.     if [ "$SERVER_USER" = "" ] ; then
  751.        echo "Error could find User in $CONF_FILE"
  752.        abort_installation;
  753.     
  754.     fi
  755.     CONF_TMP="$CONF_FILE.tmp"
  756.     CONF_SAVE="$CONF_FILE."`date +%D%T | sed "s/\//-/g" `
  757.  
  758.     OBJCONF_TMP="$OBJCONF_FILE.tmp"
  759.     OBJCONF_SAVE="$OBJCONF_FILE."`date +%D%T | sed "s/\//-/g" `
  760.   
  761.     ;;
  762.  
  763. esac
  764.  
  765. WEB_AGENT="$WEB_SERVER_ROOT/$WEB_AGENT_DIR"
  766. OLD_WEB_AGENT="$WEB_AGENT.old"
  767. TEMP_WEB_AGENT="$WEB_AGENT.temp"
  768. echo ""
  769. echo "The Web Agent will be installed in the $WEB_AGENT directory."
  770.  
  771. }
  772.  
  773. construct_apache_conf_str()
  774. {
  775.   RSA_CONF_STR="###### BEGIN_RSA_BLOCK
  776. ###### WARNING: DO NOT EDIT THIS BLOCK. ANYTHING ADDED WILL BE REMOVED BY
  777. ######          THE NEXT INSTALLATION OF RSA WEB AGENT
  778. include $WEB_AGENT/rsawebagent.conf
  779. ###### END_RSA_BLOCK"
  780.  
  781.   RSAWEBAGENT_CONF_STR="#
  782. # RSA Authentication Agent for Web configuration information
  783. # This file is included by the current httpd.conf file
  784. #
  785. # Load and add the web agent module in the configuration
  786. LoadModule rsawebagent_module $WEB_AGENT/mod_rsawa_apache.so
  787. #
  788. # RSA Authentication Agent for Web installation directory
  789. #
  790. <IfModule mod_rsawebagent.c>
  791. RSAWebAgentInstallPath $WEB_AGENT
  792. VAR_ACEPath $VAR_ACE
  793. </IfModule> "
  794. }
  795.  
  796. construct_iplanet_conf_str()
  797. {
  798. RSAWEBAGENT_CONF_STR="\\
  799. Init fn=\"load-modules\" shlib=\"$WEB_AGENT/mod_rsawa_iplanet.so\" funcs=\"mod_rsawa_init,mod_rsawa_url_translator,mod_rsawa_service_auth\"\\
  800. Init fn=\"mod_rsawa_init\" RSAWebAgentInstallPath=\"$WEB_AGENT\" VAR_ACEPath=\"$VAR_ACE\" "
  801.  
  802. NAME_TRANS_STR="NameTrans fn=\"mod_rsawa_url_translator\""
  803.  
  804. SERVICE_AUTH_STR="Service method=\"(GET|POST)\" type=\"magnus-internal/auth\" fn=\"mod_rsawa_service_auth\""
  805. }
  806.  
  807. delete_lines()
  808. {
  809.   FILE_TO_EDIT="$1"
  810.   LINE_TO_REMOVE="$2"
  811.   egrep -v "$LINE_TO_REMOVE" "$FILE_TO_EDIT" >  $CONF_TMP
  812.   if cp -f $CONF_TMP $FILE_TO_EDIT
  813.   then :
  814.   else
  815.     rm $CONF_TMP
  816.     echo "Error modifying $FILE_TO_EDIT"
  817.     abort_installation;
  818.   fi
  819.   rm $CONF_TMP
  820.  
  821. }
  822. delete_rsa_lines()
  823. {
  824.   ###################
  825.   # Now delete our lines if there are any
  826.   ###################
  827.  
  828.   ############
  829.   # First find our lines and delete them
  830.   ############
  831.   cat $FILE_TO_EDIT | awk 'BEGIN   {
  832.   printon = 1
  833.   }
  834.   {
  835.   if ( $0 ~ /BEGIN_RSA_BLOCK/ ) printon = 0
  836.   if ( printon == 1 ) print
  837.   if ( $0 ~ /END_RSA_BLOCK/ ) printon = 1
  838.   }' > $CONF_TMP
  839.  
  840.   if cp -f $CONF_TMP $FILE_TO_EDIT
  841.   then :
  842.   else
  843.     rm $CONF_TMP
  844.     echo "Error modifying $FILE_TO_EDIT"
  845.     abort_installation;
  846.   fi
  847.   rm $CONF_TMP
  848. }
  849.  
  850.  
  851. save_conf_file()
  852. {
  853.     if cp -p $ORIG_FILE $SAVE_FILE ; then
  854.        echo "Backup of $ORIG_FILE copied to $SAVE_FILE"
  855.     else
  856.        echo "Error backing up $ORIG_FILE"
  857.        abort_installation;
  858.     fi
  859.  
  860.     BACKUP_CRTD=TRUE
  861.                
  862. }
  863.  
  864.  
  865. ############################################################
  866. # Edit httpd.conf file to complete the install process
  867. ############################################################
  868. edit_conf()
  869. {
  870. #################
  871. # Construct the new configuration entries
  872. #################
  873. case $WEBSERVER in
  874.   'apache' )
  875.     construct_apache_conf_str
  876.  
  877.     #################
  878.     # create rsawebagent.conf
  879.     #################
  880.     echo "$RSAWEBAGENT_CONF_STR" > $WEB_AGENT/rsawebagent.conf
  881.     
  882.     #####################
  883.     # Save a copy of the original httpd.conf file
  884.     #####################
  885.     ORIG_FILE=$CONF_FILE
  886.     SAVE_FILE=$CONF_SAVE
  887.     save_conf_file
  888.  
  889.     echo ""
  890.     echo "Editing httpd.conf file...."
  891.  
  892.     ###################
  893.     # Now perform the necessary httpd.conf edits
  894.     ###################
  895.     if [ -n "`egrep 'mod_rsawa_apache.so|rsawebagent.conf' $CONF_FILE`" ] ; then
  896.  
  897.       PREV_INSTL=TRUE
  898.    
  899.       FILE_TO_EDIT=$CONF_FILE
  900.  
  901.       delete_rsa_lines
  902.     fi
  903.  
  904.     ################
  905.     # Always add our lines at the end
  906.     ################
  907.     if echo "$RSA_CONF_STR" >> $CONF_FILE
  908.     then :
  909.     else
  910.        echo "Error modifying $CONF_FILE"
  911.        abort_installation;
  912.     fi
  913.  
  914.     echo "Done editing httpd.conf file"
  915.     ;;
  916.  
  917.   'iplanet' )
  918.     construct_iplanet_conf_str
  919.  
  920.     #####################
  921.     # Save a copy of the original magnus/obj.conf file
  922.     #####################
  923.     ORIG_FILE=$CONF_FILE
  924.     SAVE_FILE=$CONF_SAVE
  925.     save_conf_file
  926.  
  927.     ORIG_FILE=$OBJCONF_FILE
  928.     SAVE_FILE=$OBJCONF_SAVE
  929.     save_conf_file
  930.  
  931.     echo ""
  932.     echo "Editing magnus.conf file...."
  933.  
  934.     ###################
  935.     # Now perform the necessary magnus.conf edits
  936.     ###################
  937.     if [ -n "`egrep 'mod_rsawa_iplanet.so|rsawebagent.conf' $CONF_FILE`" ] ; then
  938.       PREV_INSTL=TRUE
  939.       delete_lines $CONF_FILE "mod_rsawa_iplanet.so|rsawebagent.conf"
  940.     fi
  941.  
  942.  
  943.     ################
  944.     # Now add our lines
  945.     ################
  946.     insert_lines "$CONF_FILE" "Init fn" "$RSAWEBAGENT_CONF_STR"
  947.  
  948.     echo "Done editing magnus.conf file"
  949.     ;;
  950. esac
  951.  
  952. }
  953.  
  954.  
  955. insert_lines()
  956. {
  957.   FILE_TO_EDIT=$1
  958.   LINE_TO_FIND=$2
  959.   LINE_TO_ADD=$3
  960.   LINE_NO=`egrep -n "$LINE_TO_FIND" $FILE_TO_EDIT | head -1 | awk -F: '{print $1}'`
  961.   LINE_NO=`expr $LINE_NO - 1`
  962.  
  963.   ###########
  964.   # Now try to append our line
  965.   ###########
  966.   cat $FILE_TO_EDIT | sed "${LINE_NO}a\\
  967. $LINE_TO_ADD" > $CONF_TMP
  968.  
  969.   if cp -f $CONF_TMP $FILE_TO_EDIT
  970.   then :
  971.   else
  972.     rm $CONF_TMP
  973.     echo "Error modifying $FILE_TO_EDIT"
  974.     abort_installation;
  975.   fi
  976.   rm $CONF_TMP
  977. }
  978.  
  979. ###########################################################
  980. # Edit the INI file to add the protected URLs
  981. ###########################################################
  982. edit_ini()
  983. {
  984.  
  985.     echo "Configuring RSA Authentication Agent v7.0 for Web for $WEBSERVERNAME ...."
  986.  
  987.     #######################################
  988.     # Call config script
  989.     #######################################
  990.     if [ $WEBSERVER = "iplanet" ] ; then
  991.        CONF_LINK=magnus.conf
  992.     elif [ $WEBSERVER = "apache" ] ; then
  993.        CONF_LINK=httpd.conf
  994.     fi
  995.  
  996.     rm -f $WEB_AGENT/$CONF_LINK
  997.     ln -s $CONF_FILE $WEB_AGENT/$CONF_LINK
  998.     $WEB_AGENT/config  GlobalServerData 
  999.     if [ "$?" != "0" ]; then
  1000.         abort_installation;
  1001.     fi 
  1002.     echo "Done configuring RSA Authentication Agent v7.0 for Web for $WEBSERVERNAME"
  1003.  
  1004.  
  1005.  
  1006.  
  1007. ############################################################
  1008. # Install the RSA Authentication Agent for Web library and configuration.
  1009. ############################################################
  1010. install_webagent()
  1011. {
  1012. ##############
  1013. #untar the RPM file
  1014. ##############
  1015.  
  1016. if [ -d  $WEB_AGENT ]; then
  1017.     echo "It appears that a Web Agent has already been installed."
  1018.     myOldVersion=`strings $WEB_AGENT/librsawa_apache.so  | grep "RSA Authentication Agent " | awk '{print $4$7}'`
  1019.     myOldVersion=`echo $myOldVersion | awk '{print $1}'`
  1020.     if [ "$myOldVersion" = "" ]; then
  1021.         OldVersion=`strings $WEB_AGENT/librsawa_apache.so  | grep "@(#)RSA" | awk '{print $4$7}'`
  1022.         OldVersion=`echo $OldVersion | awk '{print $1}'`
  1023.         myOldVersion=$OldVersion
  1024.     fi
  1025.     if [ -f $HERE/$OS_DIR/$WEB_AGENT_TAR ]; then
  1026.         cd  $HERE/$OS_DIR
  1027.         tar xvf $WEB_AGENT_TAR > /dev/null
  1028.         myNewVersion=`strings $HERE/$OS_DIR/$WEB_AGENT_DIR/librsawa_apache.so  | grep "RSA Authentication Agent " | awk '{print $4$7}'`
  1029.         myNewVersion=`echo $myNewVersion | awk '{print $1}'`
  1030.         rm -rf "$WEB_AGENT_DIR"
  1031.         cd - > /dev/null
  1032.         if [ "$myOldVersion" = "$myNewVersion" ]; then
  1033.             echo ""
  1034.             echo "RSA Authentication Agent $myOldVersion has already installed."
  1035.             abort_installation
  1036.         fi
  1037.  
  1038.         #echo "Refer Migrating Web Agent Configuration Information section in Apache I&C guide"
  1039.         #abort_installation
  1040.     fi
  1041.  
  1042.     getyesorno FALSE "Should the installation upgrade the Web Agent ? (y/n) [n]:"
  1043.     if [ "$YESORNO" = FALSE ] ; then
  1044.         abort_installation
  1045.     fi
  1046.  
  1047.     getyesorno TRUE "The upgradation will overwrite the old files.  Do you want to backup the current rsawebagent to rsawebagent.old ? (y/n) [y]:"
  1048.     if [ "$YESORNO" = TRUE ] ; then
  1049.         if [ -d  $OLD_WEB_AGENT ]; then
  1050.             echo ""
  1051.             echo "Another Web Agent has already been backed up into $OLD_WEB_AGENT."
  1052.             echo "Please remove or rename existing $OLD_WEB_AGENT directory."
  1053.             abort_installation
  1054.         fi
  1055.         BACKUP_OLD=TRUE
  1056.     else
  1057.         BACKUP_OLD=FALSE
  1058.     fi
  1059.  
  1060.     cp -r $WEB_AGENT $TEMP_WEB_AGENT
  1061.     PREV_INSTL=TRUE
  1062. fi
  1063.  
  1064. echo ""
  1065. echo "Now installing the Web Agent for $WEBSERVERNAME Server Files."
  1066. echo ""
  1067.  
  1068. PLUG_IS_INSTLD=TRUE
  1069. cd $WEB_SERVER_ROOT/
  1070. if [ -f $HERE/$OS_DIR/$WEB_AGENT_TAR ]; then
  1071.     tar xvf $HERE/$OS_DIR/$WEB_AGENT_TAR
  1072. elif [ -f $HERE/$OS_DIR/$WEB_AGENT_TAR_GZ ]; then
  1073.     tar xzvf $HERE/$OS_DIR/$WEB_AGENT_TAR_GZ
  1074. elif [ -f $HERE/$WEB_AGENT_TAR ]; then
  1075.     tar xvf $HERE/$WEB_AGENT_TAR
  1076. elif [ -f $HERE/$WEB_AGENT_TAR_GZ ]; then
  1077.     tar xzvf $HERE/$WEB_AGENT_TAR_GZ
  1078. elif [ -d $HERE/$WEB_AGENT_DIR ]; then
  1079.     cp -r $HERE/$WEB_AGENT_DIR .
  1080. else
  1081.     echo Error $HERE/$WEB_AGENT_TAR, $HERE/$WEB_AGENT_TAR_GZ or $HERE/$WEB_AGENT_DIR does not exist
  1082. fi
  1083. if [ -d $HERE/$WEB_AGENT_DOC ]; then
  1084.     cp -r $HERE/$WEB_AGENT_DOC $WEB_AGENT_DIR
  1085. fi
  1086. if [ -d $HERE/$WEB_AGENT_README ]; then
  1087.     cp -r $HERE/$WEB_AGENT_README $WEB_AGENT_DIR
  1088. fi
  1089. if [ -f $WEB_AGENT_DIR/librwtool.so.2 ]; then
  1090.    chmod +x $WEB_AGENT_DIR/librwtool.so.2
  1091.    if [ "$APACHE_LIB" != "" ]; then
  1092.         if [ -d $APACHE_LIB ]; then
  1093.            cp $WEB_AGENT_DIR/librwtool.so.2 $APACHE_LIB
  1094.         fi
  1095.       if [ ! -f $APACHE_LIB/librwtool.so.2 ]; then
  1096.           echo Error: Could not copy $WEB_AGENT_DIR/librwtool.so.2 into $APACHE_LIB
  1097.       fi
  1098.    fi
  1099. fi
  1100.  
  1101. if [ "$MPM_WORKER_CONFIG" = TRUE ] ; then
  1102.     cd $WEB_SERVER_ROOT/$WEB_AGENT_DIR
  1103.     mv aceapi_rpc_server aceapi_rpc_server.org
  1104.     cd $WEB_SERVER_ROOT/$WEB_AGENT_DIR/Plugins
  1105.     mv libaceauth.so libaceauth_pre_fork_mpm.so.org
  1106.     tar xvf libaceauth_mpm_worker.tar
  1107.     echo "The Web Agent is setup for Apache worker MPM cofiguration."
  1108. else
  1109.     echo "The Web Agent is setup for Apache pre-fork MPM cofiguration."
  1110. fi
  1111.     chmod -R 700 $WEB_AGENT
  1112. }
  1113.  
  1114.  
  1115.  
  1116. ############################################################
  1117. # All done now create uninstall script.
  1118. ############################################################
  1119. create_uninstall()
  1120. {
  1121. ############################################################
  1122. thedate=`date`
  1123. UNINSTALL_SCRIPT=$WEB_AGENT/uninstall
  1124. echo "Creating uninstall script $UNINSTALL_SCRIPT...."
  1125. if [ -f $UNINSTALL_SCRIPT ] ; then
  1126.     mv $UNINSTALL_SCRIPT $UNINSTALL_SCRIPT.old
  1127. fi
  1128.  
  1129. cat > $UNINSTALL_SCRIPT     <<DEBUT
  1130. #!/bin/sh
  1131. # Created by RSA Authentication Agent for Web install script on $thedate
  1132. # to be used to uninstall Web Agent
  1133. #
  1134. DEBUT
  1135.  
  1136. if [ "$PREV_INSTL" = TRUE ] ; then
  1137. cat >> $UNINSTALL_SCRIPT     <<DEBUT
  1138. # RSA Authentication Agent Upgraded from version $myOldVersion to $myNewVersion
  1139. #
  1140. DEBUT
  1141. fi
  1142.  
  1143. cat >> $UNINSTALL_SCRIPT     <<DEBUT
  1144.  
  1145. ############
  1146. # First check if httpd is running
  1147. ############
  1148. a=\`ps -ecf | grep -v grep | egrep "$PROCESS_LIST" | egrep -v "https-adms" | wc -l\`
  1149. if [ \$a != 0 ] ; then
  1150.     ans=""
  1151.     until [ "\$ans" = "y" ] || [ "\$ans" = "n" ]
  1152.     do
  1153.     echo
  1154.         echo "We recommend you stop the Web server before un-installing the Agent."
  1155.         echo "Do you want to continue (y/n)"
  1156.         read ans
  1157.     ans=\`echo \$ans | tr '[A-Z]' '[a-z]'\`
  1158.     done
  1159.     if [ "\$ans" = "n" ] ; then
  1160.             exit 1 
  1161.     fi
  1162.     isrunning="1"
  1163. fi
  1164. ############
  1165. # Second verify need to uninstall 
  1166. ############
  1167. ans=""
  1168. until [ "\$ans" = "y" ] || [ "\$ans" = "n" ]
  1169. do
  1170.         echo "Uninstalling Web Agent."
  1171.         echo "Are you sure you want to continue (y/n)"
  1172.         read ans
  1173.     ans=\`echo \$ans | tr '[A-Z]' '[a-z]'\`
  1174. done
  1175. if [ "\$ans" != "y" ] ; then
  1176.             exit 1 
  1177. fi
  1178.  
  1179.  
  1180. ###########
  1181. # Stop the RSALogoffCookieService if it is running.
  1182. ###########
  1183. a=\`ps -ecf | grep -v grep | egrep "RSALogo" | wc -l\`
  1184. if [ \$a != 0 ] ; then
  1185.     a=\`ps -e | grep "RSALogo" | sort -u | sed -e 's:?::' -e 's:[a-z]*[A-Z]*\/[0-9]*[a-z]*[A-Z]*::' -e 's:[0-9]*\:[0-9]*\:*[0-9]*::' -e 's:RSALogoffCookie::' -e 's:RSALog[a-z]*[A-Z]*::'\`
  1186.  
  1187.     kill -9 \$a
  1188. fi
  1189.  
  1190.  
  1191. ######
  1192. # The logic for putting back the "old", (saved).
  1193. # Web Agent seems incomplete for the "old"
  1194. # Agent files and configuration are not propertly
  1195. # restored.  ...So, for now, we will not enable
  1196. # the "putting back".
  1197. ######
  1198.  
  1199. #if [ -d $OLD_WEB_AGENT ] ; then 
  1200. ############
  1201. # There is an old agent let's put back in place 
  1202. ############
  1203. #    mv $OLD_WEB_AGENT $WEB_AGENT
  1204. #else
  1205. ##################################
  1206.  
  1207. ############
  1208. # Third find RSA lines in httpd.conf and delete them
  1209. ############
  1210. DEBUT
  1211.  
  1212.  
  1213. if [ "$WEBSERVER" = "iplanet" ] ; then
  1214. cat >> $UNINSTALL_SCRIPT     <<DEBUT
  1215.       egrep -v "mod_rsawa_iplanet.so|RSAWebAgentInstallPath" $CONF_FILE > $CONF_TMP
  1216.       cp -f $CONF_TMP $CONF_FILE
  1217.       for i in \`ls $WEB_SERVER_ROOT/config/*obj.conf \`
  1218.       do
  1219.     
  1220.           egrep -v "mod_rsawa_url_translator|mod_rsawa_service_auth" "\$i" > $OBJCONF_TMP
  1221.           cp -f $OBJCONF_TMP "\$i"
  1222.       done
  1223.       rm $OBJCONF_TMP
  1224. DEBUT
  1225. else
  1226. cat >> $UNINSTALL_SCRIPT     <<DEBUT
  1227.     cat $CONF_FILE | awk 'BEGIN   {
  1228.     printon = 1
  1229.     }
  1230.     {
  1231.     if ( \$0 ~ /BEGIN_RSA_BLOCK/ ) printon = 0
  1232.     if ( printon == 1 ) print
  1233.     if ( \$0 ~ /END_RSA_BLOCK/ ) printon = 1
  1234.     }' > $CONF_TMP
  1235.     
  1236.     cp -f $CONF_TMP $CONF_FILE
  1237. DEBUT
  1238. fi
  1239. cat >> $UNINSTALL_SCRIPT     <<DEBUT
  1240.     if [ "\$isrunning" = "1" ] ; then
  1241.         $WEB_AGENT/reloadWebAgent
  1242.     fi
  1243.     rm $CONF_TMP
  1244. ############
  1245. # Fourth remove rsawebagent directory 
  1246. ############
  1247.  
  1248.     cd "${WEB_AGENT}/.."
  1249.     rm -rf $WEB_AGENT
  1250.  
  1251. ######
  1252. # "fi" belongs to the blocked out functionality to
  1253. # restore the "old" Web Agent.  See prior comments
  1254. # on "old" Web Agent.
  1255. ######
  1256. ####fi
  1257.  
  1258. echo ""
  1259. echo "************************************************************************"
  1260. echo "* Successfully uninstalled RSA Authentication Agent v7.0 for Web for $WEBSERVERNAME"
  1261. echo "************************************************************************"
  1262. DEBUT
  1263. chmod 500 $UNINSTALL_SCRIPT
  1264. echo "Done creating uninstall script $UNINSTALL_SCRIPT"
  1265. }
  1266. umask 077
  1267. #getservername "Please enter the Web Server " 1
  1268. #echo "Installing WebAgent for $WEBSERVERNAME"
  1269. check_if_webserver_running
  1270. startup_screen
  1271. check_sdconf
  1272. check_platform
  1273. setup_paths
  1274. check_webserver
  1275. install_webagent
  1276. create_uninstall
  1277. edit_conf
  1278. edit_ini
  1279.  
  1280. if [ "$INSTALL_USER" = "root" ]; then
  1281.     if [ "$INSTALL_USER" != "$SERVER_USER" ]; then
  1282.         chown -R $SERVER_USER $WEB_AGENT
  1283.     fi
  1284.     if [ "$SERVER_GROUP" != "" ]; then
  1285.         chgrp -R $SERVER_GROUP  $WEB_AGENT
  1286.     fi
  1287. fi
  1288. chmod -R 4700  $WEB_AGENT/ace*
  1289.  
  1290. $WEB_AGENT/registerWA
  1291. if [ "$BACKUP_OLD" = FALSE ] ; then
  1292.         if [ -d $TEMP_WEB_AGENT ] ; then
  1293.             rm -rf $TEMP_WEB_AGENT
  1294.         fi
  1295. elif [ "$BACKUP_OLD" = TRUE ] ; then
  1296.         if [ -d $TEMP_WEB_AGENT ] ; then
  1297.             mv $TEMP_WEB_AGENT $OLD_WEB_AGENT
  1298.             echo "Your previous installation has been backed up to $OLD_WEB_AGENT directory."
  1299.         fi
  1300. fi
  1301.  
  1302. if [ "$PREV_INSTL" = TRUE ] ; then
  1303. echo ""
  1304. echo "************************************************************************"
  1305. echo "* Successfully upgraded RSA Authentication Agent v7.0 for Web for $WEBSERVERNAME"
  1306. echo "************************************************************************"
  1307. else
  1308. echo ""
  1309. echo "************************************************************************"
  1310. echo "* Successfully installed RSA Authentication Agent v7.0 for Web for $WEBSERVERNAME"
  1311. echo "************************************************************************"
  1312. fi
  1313.  
  1314. echo "* By default every URL is protected "
  1315. echo "* If you want to unprotect specific URL, run the command :"
  1316. echo "*"
  1317. echo "* $WEB_AGENT/protectURL"
  1318. echo "*"
  1319. echo "************************************************************************"
  1320.