aboutsummaryrefslogtreecommitdiffstats
path: root/dbc-client/misc
diff options
context:
space:
mode:
authordglFromAtt <dgl@research.att.com>2019-04-03 23:16:06 +0000
committerdglFromAtt <dgl@research.att.com>2019-04-03 23:16:15 +0000
commita4aeefb08d2ed5fb10a94fe3df63910db7827d33 (patch)
treef8c9f5db3d13dc34eafc1680d3bc0eeeb007165f /dbc-client/misc
parente6de2cef6c35390335df07f868d2484adc3949c3 (diff)
Add client cert PEM files for authenticated requests
Note also relocated AAF cert artifacts since they are used by both docker images created in this repo. Change-Id: I539c0062ab9bc573e610bc7669d78e9528e2aace Signed-off-by: dglFromAtt <dgl@research.att.com> Issue-ID: DMAAP-1142
Diffstat (limited to 'dbc-client/misc')
-rw-r--r--dbc-client/misc/dbc-client31
1 files changed, 27 insertions, 4 deletions
diff --git a/dbc-client/misc/dbc-client b/dbc-client/misc/dbc-client
index 8df970c..775f719 100644
--- a/dbc-client/misc/dbc-client
+++ b/dbc-client/misc/dbc-client
@@ -35,6 +35,12 @@ REQUESTID=${REQUESTID:-dbc-client}
DBC=${DBC:-dmaap-bc}
PROTO=${PROTO:-https}
PORT=${PORT:-8443}
+WAIT_TO_EXIT=${WAIT_TO_EXIT:-N}
+PEMDIR=${PEMDIR:-/opt/app/osaaf/local}
+CAPEM=${CAPEM:-ca.pem}
+CLIENTPEM=${CLIENTPEM:-client.pem}
+KEYPEM=${KEYPEM:-key.pem}
+CERTPWD=${CERTPWD:-"2U[iOZzMHI:.#tdCwlBqc;}S"}
@@ -47,6 +53,18 @@ config() {
echo "Expected app root directory $APP_ROOT does not exist"
exit 1
fi
+ cd $PEMDIR
+ pwd
+ ls -l
+ if [ -f $CAPEM -a -f $CLIENTPEM -a -f $KEYPEM ]
+ then
+ echo "--key $PEMDIR/$KEYPEM --cacert $PEMDIR/$CAPEM --cert $PEMDIR/${CLIENTPEM}:${CERTPWD}" > $PEMDIR/curl.cred
+ CURLCRED="-K $PEMDIR/curl.cred"
+ else
+ echo "Warning: PEM files for authorization not found!"
+ CURLCRED=""
+ fi
+ echo "CURLCRED=$CURLCRED"
cd $APP_ROOT
find . -type f -exec ls -l {} \;
find $CONFIGMAP_ROOT -type f -exec ls -l {} \;
@@ -57,7 +75,7 @@ config() {
source $CONTAINER_CONFIG
fi
- if [ "$DMAAPBC_WAIT_TO_EXIT" != "Y" ]
+ if [ "$WAIT_TO_EXIT" != "Y" ]
then
echo "Creating $APP_ROOT/ok_to_exit so no waiting..."
> $APP_ROOT/ok_to_exit
@@ -70,6 +88,7 @@ config() {
init() {
+ set -x
echo "ENTER init"
if [ ! -d $CONFIGMAP_ROOT ]
then
@@ -82,18 +101,20 @@ init() {
while [ $rc != "200" ]
do
sleep 10
- rc=`curl -s -o /dev/null -I -w "%{http_code}" -X GET -H "X-ECOMP-RequestID: $REQUESTID" -H "Content-Type: application/json" ${PROTO}://${DBC}:${PORT}/webapi/dmaap`
+ rc=`curl $CURLCRED -s -o /dev/null -I -w "%{http_code}" -X GET -H "X-ECOMP-RequestID: $REQUESTID" -H "Content-Type: application/json" ${PROTO}://${DBC}:${PORT}/webapi/dmaap`
echo "get dmaap response=${rc}"
done
+ set +x
}
dopost() {
+ set -x
RETRY_TIME=60
loop=true
while [ $loop = true ]
do
- rc=`curl -s -X POST -w "%{http_code}" -H "X-ECOMP-RequestID: $REQUESTID" -H "Content-Type: application/json" -d @${1} ${PROTO}://${DBC}:${PORT}/webapi/${2} -o /dev/null`
+ rc=`curl $CURLCRED -s -X POST -w "%{http_code}" -H "X-ECOMP-RequestID: $REQUESTID" -H "Content-Type: application/json" -d @${1} ${PROTO}://${DBC}:${PORT}/webapi/${2} -o /dev/null`
case $rc in
200 | 201 | 409 )
echo "response=$rc"
@@ -105,10 +126,12 @@ dopost() {
;;
esac
done
+ set +x
}
doprov() {
+ set -x
cd $CONFIGMAP_ROOT
pwd
# order is important in this next list
@@ -123,6 +146,7 @@ doprov() {
done
fi
done
+ set +x
}
delay() {
echo "DELAY=$DELAY"
@@ -132,7 +156,6 @@ delay() {
fi
}
-set -x
delay
config
init