#!/bin/bash username=$1 if [ X"$username" = X ]; then # no username given exit 1 fi ESGF_HOME=${ESGF_HOME:-"/esg"} GLOBUS_LOCATION=${GLOBUS_LOCATION:="/usr/local/globus"} envfile="/etc/esg.env" [ -e "${envfile}" ] && source ${envfile} # Configure this for each installation ESG_OPENID_RETRIEVER_DIR="${GLOBUS_LOCATION}/bin" CWD=`pwd` cd $ESG_OPENID_RETRIEVER_DIR # REQUIRES postgresql jar file either in same dir as this script and # java class file, or in the classpath export export CLASSPATH=$CLASSPATH:postgresql-8.4-703.jdbc3.jar:$ESG_OPENID_RETRIEVER_DIR/postgresql-8.4-703.jdbc3.jar # use this command for debug mode #JAVA_CMD="$JAVA_HOME/bin/java ESGOpenIDRetriever -h datagrid.ucar.edu:5433 -u esgcet_admin -p PASSWORD -d DATABASE -g ESG-NCAR -U -v" # # use this command for production mode # # NOTE!! Be sure to update the username/password and database below # #JAVA_CMD="$JAVA_HOME/bin/java ESGOpenIDRetriever -h pcmdi.llnl.gov:9999 -u esgcet_admin -p PASSWORD -d DATABASE -g https://${esgf_host}/esgf-idp/openid/ -U" #-------------------------------- # Read and set vars #-------------------------------- postgress_host=$(sed -n 's@^[^#]*[ ]*db.host[ ]*=[ ]*\(.*\)$@\1@p' ${ESGF_HOME}/config/esgf.properties | head -n1) postgress_port=$(sed -n 's@^[^#]*[ ]*db.port[ ]*=[ ]*\(.*\)$@\1@p' ${ESGF_HOME}/config/esgf.properties | head -n1) postgress_user=$(sed -n 's@^[^#]*[ ]*db.user[ ]*=[ ]*\(.*\)$@\1@p' ${ESGF_HOME}/config/esgf.properties | head -n1) pg_sys_acct_passwd=$(cat ${ESGF_HOME}/config/.esg_pg_pass 2> /dev/null) esgf_db_name=$(sed -n 's@^[^#]*[ ]*db.database[ ]*=[ ]*\(.*\)$@\1@p' ${ESGF_HOME}/config/esgf.properties | head -n1) esgf_host=$(sed -n 's@^[^#]*[ ]*esgf.host[ ]*=[ ]*\(.*\)$@\1@p' ${ESGF_HOME}/config/esgf.properties | head -n1) openid_dirname=${openid_dirname:-"https://${esgf_host}/esgf-idp/openid/"} ca_subject=$(openssl x509 -noout -in /var/lib/globus-connect-server/myproxy-ca/cacert.pem -subject| sed "s/=O/=\/O/"|tr -d ' '|sed "s/,/\//g"|cut -d '=' -f2-|sed "s/\(.*=\).*/\1/"|sed "s/\///") #-------------------------------- JAVA_CMD="$JAVA_HOME/bin/java ESGOpenIDRetriever -h ${postgress_host}:${postgress_port} -u ${postgress_user} -p ${pg_sys_acct_passwd} -d ${esgf_db_name} -g ${openid_dirname} -U" if ! test "x$1" = "x"; then OPENID_STR=`$JAVA_CMD $1` # Emit DN: DN must match the signing policy for your CA. echo "/${ca_subject}${OPENID_STR}" fi cd $CWD