Permalink
Browse files

sample usage

  • Loading branch information...
1 parent 30c31cf commit 01e15b15747e1d6a0dae1d76b1f4f18911cc5392 @timf timf committed Dec 18, 2009
Showing with 172 additions and 0 deletions.
  1. +47 −0 bin/create-ca.sh
  2. +35 −0 bin/create-cert.sh
  3. +90 −0 etc/common-env.sh
View
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+THISDIR="`dirname $0`"
+LIBDIR="$THISDIR/../etc/"
+if [ ! -f $LIBDIR/common-env.sh ]; then
+ echo "Failure, cannot find environment definitions" >&2
+ exit 1
+fi
+source $LIBDIR/common-env.sh
+
+# ----------------------------------------------------------------------------
+
+if [ ! -d $1 ]; then
+ echo "Directory does not exist: $1" >&2
+ exit 1
+fi
+
+$JAVA_BIN $JAVA_OPTS $EXE_CREATE_NEW_CA $1 $2
+if [ $? -ne 0 ]; then
+ echo "Problem creating new certificate authority, exiting." >&2
+ exit 1
+fi
+
+CA_PUBPEM="$1/$2.pem"
+CA_PUBPEM2="$1/$2.0"
+CA_SIGNING_POLICY="$1/$2.signing_policy"
+CA_PRIVPEM="$1/private-key-$2.pem"
+
+chmod 400 $CA_PRIVPEM
+if [ $? -ne 0 ]; then
+ echo "Problem setting permissions on $CA_PRIVPEM" >&2
+ exit 1
+fi
+
+$JAVA_BIN $JAVA_OPTS $EXE_WRITE_SIGNING_POLICY $CA_PUBPEM $CA_SIGNING_POLICY
+if [ $? -ne 0 ]; then
+ echo "Problem creating new certificate authority signing policy, exiting." >&2
+ exit 1
+fi
+
+cp $CA_PUBPEM $CA_PUBPEM2
+if [ $? -ne 0 ]; then
+ echo "Problem creating certificate authority, exiting." >&2
+ exit 1
+fi
+
+echo "Created certificate authority @ $1"
View
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+THISDIR="`dirname $0`"
+LIBDIR="$THISDIR/../etc/"
+if [ ! -f $LIBDIR/common-env.sh ]; then
+ echo "Failure, cannot find environment definitions" >&2
+ exit 1
+fi
+source $LIBDIR/common-env.sh
+
+TARGET_DIR=$1
+NEW_CN=$2
+PUBPEM=$3
+PRIVPEM=$4
+PUBCA=$5
+PRIVCA=$6
+
+
+# ----------------------------------------------------------------------------
+
+HOSTDN=`$JAVA_BIN $JAVA_OPTS $EXE_CREATE_NEW_CERT $TARGET_DIR $NEW_CN $PUBPEM $PRIVPEM $PUBCA $PRIVCA`
+if [ $? -ne 0 ]; then
+ echo "Problem creating cert, exiting."
+ exit 1
+fi
+
+NEW_PRIVPEM="$TARGET_DIR/$PRIVPEM"
+
+chmod 400 $NEW_PRIVPEM
+if [ $? -ne 0 ]; then
+ echo "Problem setting permissions on $NEW_PRIVPEM"
+ exit 1
+fi
+
+echo "Created certificate for '$NEW_CN' @ $TARGET_DIR/$PUBPEM"
View
@@ -0,0 +1,90 @@
+if [ ! "X$AUTOCOMMON_ENVIRONMENT_DEFINED" = "X" ]; then
+ return 0
+fi
+
+BASEDIR_REL="`dirname $0`/.."
+BASEDIR=`cd $BASEDIR_REL; pwd`
+
+AUTOCOMMON_DIST_DIR=$BASEDIR/dist
+export AUTOCOMMON_DIST_DIR
+
+AUTOCOMMON_BUILD_FILE=$BASEDIR/build.xml
+export AUTOCOMMON_BUILD_FILE
+
+JAVA_BIN="java"
+
+function nobin() {
+ echo -e "\nERROR: cannot find $1\n - install $1\n - OR adjust the configuration value at the top of this script to point to $1\n" >&2
+ exit 1
+}
+
+JAVA_OPTS="-classpath ."
+
+AUTOCOMMON_CLASSPATH_BASE1=$BASEDIR/dist
+AUTOCOMMON_CLASSPATH_BASE2=$BASEDIR/lib
+
+for directory in $AUTOCOMMON_CLASSPATH_BASE1 $AUTOCOMMON_CLASSPATH_BASE2; do
+ if [ -d $directory ]; then
+ for f in `ls $directory`; do
+ JAVA_OPTS="$JAVA_OPTS:$directory/$f"
+ done
+ fi
+done
+
+export JAVA_OPTS
+
+EXE_JVMCHECK="org.nimbustools.auto_common.JVMCheck"
+export EXE_JVMCHECK
+
+CAPTURE=`$JAVA_BIN -version 2>&1`
+if [ $? -ne 0 ]; then
+ nobin java
+fi
+
+$JAVA_BIN $JAVA_OPTS $EXE_JVMCHECK
+if [ $? -ne 0 ]; then
+ exit 1
+fi
+
+EXE_HOSTGUESS="org.nimbustools.auto_common.HostGuess"
+export EXE_HOSTGUESS
+
+EXE_LOGICAL_HOST="org.nimbustools.auto_common.confmgr.AddOrReplaceLogicalHost"
+export EXE_LOGICAL_HOST
+
+EXE_PUBLISH_HOST="org.nimbustools.auto_common.confmgr.AddOrReplacePublishHostname"
+export EXE_PUBLISH_HOST
+
+EXE_GLOBUS_SECDESC="org.nimbustools.auto_common.confmgr.AddOrReplaceGlobalSecDesc"
+export EXE_GLOBUS_SECDESC
+
+EXE_NEW_GRIDMAPFILE="org.nimbustools.auto_common.confmgr.ReplaceGridmap"
+export EXE_NEW_GRIDMAPFILE
+
+EXE_NEW_HOSTCERTFILE="org.nimbustools.auto_common.confmgr.ReplaceCertFile"
+export EXE_NEW_HOSTCERTFILE
+
+EXE_NEW_HOSTKEYFILE="org.nimbustools.auto_common.confmgr.ReplaceKeyFile"
+export EXE_NEW_HOSTKEYFILE
+
+EXE_CREATE_CONTAINER_DIR="org.nimbustools.auto_common.dirmgr.CreateNewNumberedDirectory"
+export EXE_CREATE_CONTAINER_DIR
+
+EXE_CREATE_NEW_CA="org.nimbustools.auto_common.ezpz_ca.GenerateNewCA"
+export EXE_CREATE_NEW_CA
+
+EXE_CREATE_NEW_CERT="org.nimbustools.auto_common.ezpz_ca.GenerateNewCert"
+export EXE_CREATE_NEW_CERT
+
+EXE_WRITE_SIGNING_POLICY="org.nimbustools.auto_common.ezpz_ca.SigningPolicy"
+export EXE_WRITE_SIGNING_POLICY
+
+EXE_FIND_CA_PUBPEM="org.nimbustools.auto_common.ezpz_ca.FindCAPubFile"
+EXE_FIND_CA_PRIVPEM="org.nimbustools.auto_common.ezpz_ca.FindCAPrivFile"
+export EXE_FIND_CA_PUBPEM EXE_FIND_CA_PRIVPEM
+
+EXE_CREATE_NEW_CERT_SHELL_SCRIPT_NAME="create-new-cert.sh"
+export EXE_CREATE_NEW_CERT_SHELL_SCRIPT_NAME
+
+AUTOCOMMON_ENVIRONMENT_DEFINED="X"
+export AUTOCOMMON_ENVIRONMENT_DEFINED

0 comments on commit 01e15b1

Please sign in to comment.