voms proxies for the extra user certs too
authorAkos Frohner <akos.frohner@cern.ch>
Fri, 5 May 2006 12:22:06 +0000 (12:22 +0000)
committerAkos Frohner <akos.frohner@cern.ch>
Fri, 5 May 2006 12:22:06 +0000 (12:22 +0000)
bin/generate-test-certificates.sh

index bb8e706..a482fdc 100755 (executable)
@@ -262,10 +262,23 @@ function create_cert_proxy_proxy {
 function create_voms {
     filename=$1
     shift
+    
+    usercert='home/usercert.pem'
+    userkey='home/userkey.pem'
+    if [ "$1" = '-cert' ]; then
+        shift
+        usercert="$1"
+        shift
+    fi
+    if [ "$1" = '-key' ]; then
+        shift
+        userkey="$1"
+        shift
+    fi
 
     # checking then environment
-    if [ ! -r 'home/usercert.pem' -o ! -r 'home/userkey.pem' ]; then
-        echo "Error: cannot read 'home/usercert.pem' or 'home/userkey.pem'" >&2
+    if [ ! -r "$usercert" -o ! -r "$userkey" ]; then
+        echo "Error: cannot read '$usercert' or '$userkey'" >&2
         return
     fi
     if [ ! -r 'grid-security/hostcert.pem' -o ! -r 'grid-security/hostkey.pem' ]; then
@@ -283,7 +296,7 @@ function create_voms {
     export VOMSDIR='grid-security/vomsdir'
 
     CMD="voms-proxy-fake -pwstdin \
-                    -cert home/usercert.pem -key home/userkey.pem \
+                    -cert $usercert -key $userkey \
                     -certdir grid-security/certificates/ \
                     -hostcert grid-security/hostcert.pem \
                     -hostkey grid-security/hostkey.pem \
@@ -350,6 +363,16 @@ function create_some {
         create_voms home/voms-coyote-Radmin.pem /org.coyote /org.coyote/Role=Admin
         create_voms home/voms-coyote-Gproduction.pem /org.coyote /org.coyote/production
         create_voms home/voms-acme-coyote.pem /org.acme /org.coyote
+
+        # and some basics for the extra certs
+        if [ -n "$EXTRACERTS" ]; then
+            echo "Generating '$EXTRACERTS' vomsified extra certs"
+            for i in $(seq -f '%02g' 1 $EXTRACERTS); do
+                create_voms home/voms$i-acme.pem \
+                    -cert home/usercert$i.pem -key home/userkey$i.pem \
+                    /org.acme
+            done
+        fi
     fi
 }