#! /bin/bash # makegetlist -- bash shell script to create the getlist script. # # Marion Bates mbates@ists.dartmouth.edu # ISTS/Dartmouth College Hanover, NH # # makegetlist Copyright (C) 2001 Marion Bates GNU/GPL # # Last revision November 8, 2001. # If you need to change HOME, change the line below to reflect the path to the # reverse proxy stuff. HOME=/usr/mrp # Default to N so we loop through the question at least once CHECK0="N" CHECK1="N" # there is no CHECK2. I dunno why. CHECK3="N" CHECK4="N" echo "" echo "This script will generate getlist, which in turn will reside on the PROXY and will fetch the allowed-URL list from the WEBSERVER." echo "" echo "My HOME variable is set to $HOME, so this is where I will create getlist." echo "" echo "Is this correct? If so, please type Y or y and hit return. If that's NOT correct, please answer N or n and edit this script such that HOME is set correctly. (How about /usr/mrp?)" read CHECK1 if [ "$CHECK1" = "Y" ] || [ "$CHECK1" = "y" ] ; then echo "" echo "OK here we go! Please answer the following questions, and I will generate the getlist script based on your answers." echo "" while [ "$CHECK0" = "N" ] || [ "$CHECK0" = "n" ] ; do echo "Please specify HOME for getlist to use. This should be where your rev-proxy stuff is installed. This is also where the urls list will be created (and where Jeanne will look for it, as specified in jeanne.c), and it is where getlist will expect to find the start and stop scripts for squid and jeanne. In our examples, it is /usr/mrp." read GLHOME echo "You entered $GLHOME. Is this correct? Y(y) or N(n)" read CHECK0 done if [ "$CHECK0" = "Y" ] || [ "$CHECK0" = "y" ] ; then while [ "$CHECK3" = "N" ] || [ "$CHECK3" = "n" ] ; do echo "" echo "What is the IP address of the webserver?" read WEBSERVIP echo "You entered $WEBSERVIP. Is this correct? Y(y) or N(n)" read CHECK3 done if [ "$CHECK3" = "Y" ] || [ "$CHECK3" = "y" ] ; then while [ "$CHECK4" = "N" ] || [ "$CHECK4" = "n" ] ; do echo "" echo "What is the listening port of the webserver? In our examples, 8080." read WEBSERVPORT echo "You entered $WEBSERVPORT. Is this correct? Y(y) or N(n)" read CHECK4 done if [ "$CHECK4" = "Y" ] || [ "$CHECK4" = "y" ] ; then echo "" echo "Okay here we go..." echo "" echo "#! /bin/bash # getlist -- bash shell script to retrieve the URL list from the webserver # and restart the reverse proxy. # # Vincent Berk vberk@ists.dartmouth.edu # ISTS/Dartmouth College Hanover, NH # # getlist Copyright (C) 2001 Vincent Berk GNU/GPL # HOME=$GLHOME OLDURLSFILE=$GLHOME/urls NEWURLSFILE=$GLHOME/newurls echo -e \"GET /urls HTTP/1.0\n\n\" | nc $WEBSERVIP $WEBSERVPORT | tail +11 > \$NEWURLSFILE if [ -e \"\$NEWURLSFILE\" ]; then # If the file exists... if [ -s \"\$NEWURLSFILE\" ]; then # ...and if it's not 0 length... cat \$NEWURLSFILE > \$OLDURLSFILE # ...then overwrite old urls list with new. fi fi # Restart the squid server $HOME/squid stop sleep 1 $HOME/squid start " > $HOME/getlist # Make getlist executable chmod 755 $HOME/getlist echo "" sleep 1 echo "All done. Make sure that you have netcat (nc) installed and working before you run getlist. You will probably need to have root privileges in order for getlist to run properly." fi fi fi fi