#!/bin/bash
+#########
+# ============LICENSE_START====================================================
+# org.onap.aaf
+# ===========================================================================
+# Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
+# ===========================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END====================================================
+#
# This script is run when starting client Container.
# It needs to cover the cases where the initial data doesn't exist, and when it has already been configured (don't overwrite)
#
if [ ! -d $LOCAL ]; then
mkdir -p $LOCAL
for D in bin logs; do
- rsync -avzh --exclude=.gitignore $CONFIG/$D/* /opt/app/osaaf/$D
+ mkdir -p $OSAAF/$D
+ cp $CONFIG/$D/* $OSAAF/$D
done
fi
# Setup Bash, first time only
-if [ ! -e "$HOME/.bash_aliases" ] || [ -z "$(grep agent $HOME/.bash_aliases)" ]; then
- echo "alias cadi='$JAVA_CADI \$*'" >>$HOME/.bash_aliases
- echo "alias agent='$OSAAF/bin/agent.sh EMPTY \$*'" >>$HOME/.bash_aliases
- echo "alias aafcli='$JAVA_AAFCLI \$*'" >>$HOME/.bash_aliases
- chmod a+x $OSAAF/bin/agent.sh
- . $HOME/.bash_aliases
+if [ ! -e "$HOME/.bashrc" ] || [ -z "$(grep cadi $HOME/.bashrc)" ]; then
+ echo "alias cadi='$JAVA_CADI \$*'" >>$HOME/.bashrc
+ echo "alias agent='$CONFIG/bin/agent.sh agent \$*'" >>$HOME/.bashrc
+ echo "alias aafcli='$JAVA_AAFCLI \$*'" >>$HOME/.bashrc
+ chmod a+x $CONFIG/bin/agent.sh
+ . $HOME/.bashrc
fi
# Setup SSO info for Deploy ID
if [ ! "${DEPLOY_PASSWORD}" = "" ]; then
echo aaf_password=enc:$(sso_encrypt ${DEPLOY_PASSWORD}) >> ${SSO}
fi
+ if [ ! -z "${CONTAINER_NS}" ]; then
+ echo "aaf_locator_container_ns=${CONTAINER_NS}" >> ${SSO}
+ fi
+ if [ ! -z "${AAF_ENV}" ]; then
+ echo "aaf_env=${AAF_ENV}" >> ${SSO}
+ fi
echo aaf_locate_url=https://${AAF_FQDN}:8095 >> ${SSO}
echo aaf_url=https://AAF_LOCATE_URL/AAF_NS.service:${AAF_INTERFACE_VERSION} >> ${SSO}
base64 -d $CONFIG/cert/truststoreONAPall.jks.b64 > $DOT_AAF/truststoreONAPall.jks
echo "cadi_truststore=$DOT_AAF/truststoreONAPall.jks" >> ${SSO}
echo cadi_truststore_password=enc:$(sso_encrypt changeit) >> ${SSO}
+ echo "Caller Properties Initialized"
+ INITIALIZED="true"
fi
# Only initialize once, automatically...
echo "#### Validate Configuration and Certificate with live call"
$JAVA_AGENT_SELF validate
+ echo "Obtained Certificates"
+ INITIALIZED="true"
else
echo "#### Certificate Authorization Artifact must be valid to continue"
fi
# Now run a command
CMD=$2
if [ -z "$CMD" ]; then
- $JAVA_AGENT
+ if [ -n "$INITIALIZED" ]; then
+ echo "Initialization complete"
+ else
+ $JAVA_AGENT
+ fi
else
shift
shift
fi
fi
;;
- update)
- for D in bin logs; do
- rsync -uh --exclude=.gitignore $CONFIG/$D/* /opt/app/osaaf/$D
- done
- ;;
showpass)
echo "## Show Passwords"
$JAVA_AGENT showpass ${APP_FQI} ${APP_FQDN}
;;
check)
+ echo "## Check Certificate"
$JAVA_AGENT check ${APP_FQI} ${APP_FQDN}
;;
validate)
echo "## validate requested"
$JAVA_AGENT_SELF validate
;;
+ renew)
+ echo "## Renew Certificate"
+ $JAVA_AGENT place ${APP_FQI} ${APP_FQDN}
+ ;;
bash)
shift
cd $LOCAL || exit
- /bin/bash "$@"
+ exec bash "$@"
;;
setProp)
cd $LOCAL || exit
taillog)
sh /opt/app/osaaf/logs/taillog
;;
+ testConnectivity|testconnectivity)
+ echo "--- Test Connectivity ---"
+ $JAVA -cp $CONFIG/bin/aaf-auth-cmd-*-full.jar org.onap.aaf.cadi.aaf.TestConnectivity $LOCAL/org.osaaf.aaf.props
+ ;;
--help | -?)
case "$1" in
"")