Implementing switch -V to skip voms stuff (and avoid dependence on voms-clients)
authorZdeněk Šustr <sustr4@cesnet.cz>
Fri, 3 Feb 2012 12:39:19 +0000 (12:39 +0000)
committerZdeněk Šustr <sustr4@cesnet.cz>
Fri, 3 Feb 2012 12:39:19 +0000 (12:39 +0000)
org.glite.testsuites.ctb/LB/tests/lb-generate-fake-proxy.sh

index 5e79aa0..838aa9c 100755 (executable)
@@ -45,16 +45,19 @@ EndHelpHeader
         echo " -h | --help            Show this help message."
         echo " -H | --hours           Proxy will be valid for given No. of hours (default is 12)"
         echo " -l | --lsc             Generate VOMS lsc file."
+        echo " -V | --novoms          Skip VOMS stuff."
 
 }
 
 GENLSC=0
+VOMS=1
 while test -n "$1"
 do
         case "$1" in
                 "-h" | "--help") showHelp && exit 2 ;;
                 "-H" | "--hours") shift ; PROXYHOURS="-hours $1 " ;;
                 "-l" | "--lsc") GENLSC=1 ;;
+                "-V" | "--novoms") VOMS=0 ;;
         esac
         shift
 done
@@ -79,38 +82,43 @@ for p in $USER $VOMS_SERVER $USER_BOB; do
        chmod 600 ${p}.priv-clear
        done
 
-for p in $USER $USER_BOB; do
-       voms-proxy-fake -cert ${p}.cert -key ${p}.priv-clear \
-               -hostcert ${VOMS_SERVER}.cert -hostkey ${VOMS_SERVER}.priv-clear $PROXYHOURS\
-               -voms ${VO} -out /tmp/x509up_u${p} \
-               -fqan "/${VO}/Role=NULL/Capability=NULL" &> /dev/null || exit 1
-       done
-mv "/tmp/x509up_u${USER}" "/tmp/x509up_u${user_id}"
-mv "/tmp/x509up_u${USER_BOB}" "/tmp/x509up_u.${user_id}"
+if [ $VOMS -eq 1 ]; then
+       for p in $USER $USER_BOB; do
+               voms-proxy-fake -cert ${p}.cert -key ${p}.priv-clear \
+                       -hostcert ${VOMS_SERVER}.cert -hostkey ${VOMS_SERVER}.priv-clear $PROXYHOURS\
+                       -voms ${VO} -out /tmp/x509up_u${p} \
+                       -fqan "/${VO}/Role=NULL/Capability=NULL" &> /dev/null || exit 1
+               done
+       mv "/tmp/x509up_u${USER}" "/tmp/x509up_u${user_id}"
+       mv "/tmp/x509up_u${USER_BOB}" "/tmp/x509up_u.${user_id}"
+       export X509_USER_PROXY=/tmp/x509up_u${user_id}
+       export X509_USER_PROXY_BOB=/tmp/x509up_u.${user_id}
+       echo "/tmp/x509up_u${user_id} proxy certificate has been generated"
+       echo "/tmp/x509up_u${USER} proxy certificate has been generated" 
+fi
 
-export X509_USER_PROXY=/tmp/x509up_u${user_id}
-export X509_USER_PROXY_BOB=/tmp/x509up_u.${user_id}
 export x509_USER_CERT=$CERTS_ROOT/trusted-certs/trusted_client00.cert
 export x509_USER_KEY=$CERTS_ROOT/trusted-certs/trusted_client00.priv-clear
 
-echo "/tmp/x509up_u${user_id} proxy certificate has been generated"
-echo "/tmp/x509up_u${USER} proxy certificate has been generated" 
 echo ""
 echo "======================================================================"
 echo "Credentials have been generated, adapt your configuration accordingly:"
 echo "======================================================================"
 
 echo X509_CERT_DIR=$CERTS_ROOT/grid-security/certificates
-echo X509_USER_PROXY=/tmp/x509up_u${user_id}
-#BOB'S FAKE PROXY
-echo X509_USER_PROXY_BOB=/tmp/x509up_u.${user_id}
 echo TRUSTED_CERTS=$CERTS_ROOT/trusted-certs
-if [ $GENLSC -eq 1 ]; then
-       mkdir -p /etc/grid-security/vomsdir/$VO
-       openssl x509 -noout -subject -issuer -in $CERTS_ROOT/trusted-certs/${VOMS_SERVER}.cert | cut -d ' ' -f 2- > /etc/grid-security/vomsdir/$VO/`hostname -f`.lsc
-else
-       echo mkdir /etc/grid-security/vomsdir/$VO
-       echo "openssl x509 -noout -subject -issuer -in $CERTS_ROOT/trusted-certs/${VOMS_SERVER}.cert | cut -d ' ' -f 2- > /etc/grid-security/vomsdir/$VO/`hostname -f`.lsc"
+echo HOST_CERT_DIR=$CERTS_ROOT/grid-security
+if [ $VOMS -eq 1 ]; then
+       echo X509_USER_PROXY=/tmp/x509up_u${user_id}
+       #BOB'S FAKE PROXY
+       echo X509_USER_PROXY_BOB=/tmp/x509up_u.${user_id}
+       if [ $GENLSC -eq 1 ]; then
+               mkdir -p /etc/grid-security/vomsdir/$VO
+               openssl x509 -noout -subject -issuer -in $CERTS_ROOT/trusted-certs/${VOMS_SERVER}.cert | cut -d ' ' -f 2- > /etc/grid-security/vomsdir/$VO/`hostname -f`.lsc
+       else
+               echo mkdir /etc/grid-security/vomsdir/$VO
+               echo "openssl x509 -noout -subject -issuer -in $CERTS_ROOT/trusted-certs/${VOMS_SERVER}.cert | cut -d ' ' -f 2- > /etc/grid-security/vomsdir/$VO/`hostname -f`.lsc"
+       fi
 fi
 echo "======================================================================"
 echo ""