2008-05-02 19:39:55 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
#egan@us.ibm.com
|
|
|
|
#(C)IBM Corp
|
|
|
|
#
|
|
|
|
|
2009-06-25 19:18:22 +00:00
|
|
|
if [ ! -x /usr/bin/openssl ]; then #Unless we have openssl stup
|
2010-04-06 08:17:04 +00:00
|
|
|
logger -t xcat "$0: /usr/bin/openssl is not executable"
|
2009-06-25 19:18:22 +00:00
|
|
|
exit 0
|
2009-04-08 14:44:16 +00:00
|
|
|
fi
|
2009-09-01 18:39:07 +00:00
|
|
|
USEOPENSSLFORXCAT=1 #Declare 2.3 style SSL
|
|
|
|
export USEOPENSSLFORXCAT
|
2008-05-02 19:39:55 +00:00
|
|
|
allowcred.awk &
|
|
|
|
CREDPID=$!
|
|
|
|
sleep 1
|
|
|
|
mkdir -p /root/.xcat
|
|
|
|
chmod 700 /root/.xcat
|
2011-04-27 08:53:38 +00:00
|
|
|
getcredentials.awk xcat_client_cred > /tmp/xcat_client_cred
|
|
|
|
grep -E '<error>' /tmp/xcat_client_cred
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
cat /tmp/xcat_client_cred | grep -v '<'|sed -e 's/</</' -e 's/>/>/' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /root/.xcat/client-cred.pem
|
2008-05-13 23:33:16 +00:00
|
|
|
CONT=`cat /root/.xcat/client-cred.pem`
|
2011-04-27 08:53:38 +00:00
|
|
|
while [ -z "$CONT" ]; do
|
2011-09-28 14:06:57 +00:00
|
|
|
SLI=$(awk 'BEGIN{srand(); printf("%d\n",rand()*10)}')
|
|
|
|
SLI=$((10 + $SLI))
|
2011-04-27 08:53:38 +00:00
|
|
|
sleep $SLI
|
|
|
|
getcredentials.awk xcat_client_cred | grep -v '<'|sed -e 's/</</' -e 's/>/>/' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /root/.xcat/client-cred.pem
|
|
|
|
CONT=`cat /root/.xcat/client-cred.pem`
|
|
|
|
done
|
|
|
|
else
|
|
|
|
ERR_MSG=`sed -n 's%.*<error>\(.*\)</error>.*%\1%p' /tmp/xcat_client_cred`
|
|
|
|
logger -t xCAT xcat_client_cred Error: $ERR_MSG
|
|
|
|
fi
|
|
|
|
rm /tmp/xcat_client_cred
|
|
|
|
|
2008-05-02 19:39:55 +00:00
|
|
|
chmod 600 /root/.xcat/client-cred.pem
|
2008-05-02 19:53:01 +00:00
|
|
|
cp _xcat/ca.pem /root/.xcat/ca.pem
|
2008-05-02 20:34:40 +00:00
|
|
|
kill -9 $CREDPID
|