summaryrefslogtreecommitdiffstats
path: root/auth/sample/bin/client.sh
diff options
context:
space:
mode:
authorInstrumental <jonathan.gathman@att.com>2018-10-01 15:26:03 -0500
committerInstrumental <jonathan.gathman@att.com>2018-10-01 15:26:06 -0500
commit365638c2c53d3b790b6914fe3e06b58cec3b2963 (patch)
treeb8ca6505a97a67ce30d62ecefb2c4c5dca968ebe /auth/sample/bin/client.sh
parentdf3aa01e9fdc365770cf11e4c6d92b2d49122810 (diff)
Adjust Client Container
Change Client Container to reflect changes in regular Containers. Issue-ID: AAF-517 Change-Id: I26a6e657b2a626a2a5cd7c22fff5217b6fb8ed71 Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'auth/sample/bin/client.sh')
-rw-r--r--auth/sample/bin/client.sh77
1 files changed, 46 insertions, 31 deletions
diff --git a/auth/sample/bin/client.sh b/auth/sample/bin/client.sh
index a8b8b9a6..0e3d1ca1 100644
--- a/auth/sample/bin/client.sh
+++ b/auth/sample/bin/client.sh
@@ -15,18 +15,30 @@ for (( i=( ${#FQIA_E[@]} -1 ); i>0; i-- )); do
NS=${NS}${FQIA_E[i]}'.'
done
NS=${NS}${FQIA_E[0]}
-
+CONFIG="/opt/app/aaf_config"
+LOCAL="/opt/app/osaaf/local"
+DOT_AAF="$HOME/.aaf"
+SSO="$DOT_AAF/sso.props"
+
+# Setup Bash, first time only
+if [ ! -e "$HOME/.bash_aliases" ] || [ -z "$(grep aaf_config $HOME/.bash_aliases)" ]; then
+ echo "alias cadi='$CONFIG/bin/agent.sh EMPTY cadi \$*'" >>$HOME/.bash_aliases
+ echo "alias agent='$CONFIG/bin/agent.sh EMPTY \$*'" >>$HOME/.bash_aliases
+ chmod a+x $CONFIG/bin/agent.sh
+ . $HOME/.bash_aliases
+fi
# Setup SSO info for Deploy ID
function sso_encrypt() {
- $JAVA -cp /opt/app/aaf_config/bin/aaf-cadi-aaf-*-full.jar org.onap.aaf.cadi.CmdLine digest ${1} ~/.aaf/keyfile
+ $JAVA -cp $CONFIG/bin/aaf-cadi-aaf-*-full.jar org.onap.aaf.cadi.CmdLine digest ${1} $DOT_AAF/keyfile
}
-if [ ! -e " ~/.aaf/keyfile" ]; then
- mkdir -p ~/.aaf
- SSO=~/.aaf/sso.props
- $JAVA -cp /opt/app/aaf_config/bin/aaf-cadi-aaf-*-full.jar org.onap.aaf.cadi.CmdLine keygen ~/.aaf/keyfile
- chmod 400 ~/.aaf/keyfile
+
+if [ ! -e "$DOT_AAF/keyfile" ]; then
+ mkdir -p $DOT_AAF
+ echo "WRITING $DOT_AAF Props ($SSO)"
+ $JAVA -cp $CONFIG/bin/aaf-cadi-aaf-*-full.jar org.onap.aaf.cadi.CmdLine keygen $DOT_AAF/keyfile
+ chmod 400 $DOT_AAF/keyfile
echo cadi_latitude=${LATITUDE} > ${SSO}
echo cadi_longitude=${LONGITUDE} >> ${SSO}
echo aaf_id=${DEPLOY_FQI} >> ${SSO}
@@ -35,26 +47,29 @@ if [ ! -e " ~/.aaf/keyfile" ]; then
fi
echo aaf_locate_url=https://${AAF_FQDN}:8095 >> ${SSO}
echo aaf_url=https://AAF_LOCATE_URL/AAF_NS.service:${AAF_INTERFACE_VERSION} >> ${SSO}
- echo cadi_truststore=$(ls /opt/app/aaf_config/public/*trust*) >> ${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}
fi
# Only initialize once, automatically...
-if [ ! -e /opt/app/osaaf/local/${NS}.props ]; then
+if [ ! -e $LOCAL/${NS}.props ]; then
+ mkdir -p $LOCAL
for D in bin logs; do
- rsync -avzh --exclude=.gitignore /opt/app/aaf_config/$D/* /opt/app/osaaf/$D
+ rsync -avzh --exclude=.gitignore $CONFIG/$D/* /opt/app/osaaf/$D
done
# setup Configs
- $JAVA -jar /opt/app/aaf_config/bin/aaf-cadi-aaf-*-full.jar config $APP_FQI \
- cadi_etc_dir=/opt/app/osaaf/local
+ $JAVA -jar $CONFIG/bin/aaf-cadi-aaf-*-full.jar config $APP_FQI \
+ cadi_etc_dir=$LOCAL cadi_prop_files=$SSO
# Place Certificates
- $JAVA -jar /opt/app/aaf_config/bin/aaf-cadi-aaf-*-full.jar place ${APP_FQI} ${APP_FQDN}
+ $JAVA -jar $CONFIG/bin/aaf-cadi-aaf-*-full.jar place ${APP_FQI} ${APP_FQDN}
# Validate
- $JAVA -jar /opt/app/aaf_config/bin/aaf-cadi-aaf-*-full.jar validate \
- cadi_prop_files=/opt/app/osaaf/local/${NS}.props
+ $JAVA -jar $CONFIG/bin/aaf-cadi-aaf-*-full.jar validate \
+ cadi_prop_files=$LOCAL/${NS}.props
fi
# Now run a command
@@ -84,31 +99,31 @@ if [ ! "$CMD" = "" ]; then
;;
update)
for D in bin logs; do
- rsync -uh --exclude=.gitignore /opt/app/aaf_config/$D/* /opt/app/osaaf/$D
+ rsync -uh --exclude=.gitignore $CONFIG/$D/* /opt/app/osaaf/$D
done
;;
showpass)
echo "## Show Passwords"
- $JAVA -jar /opt/app/aaf_config/bin/aaf-cadi-aaf-*-full.jar showpass ${APP_FQI} ${APP_FQDN}
+ $JAVA -jar $CONFIG/bin/aaf-cadi-aaf-*-full.jar showpass ${APP_FQI} ${APP_FQDN}
;;
check)
- $JAVA -Dcadi_prop_files=/opt/app/osaaf/local/${NS}.props -jar /opt/app/aaf_config/bin/aaf-cadi-aaf-*-full.jar check ${APP_FQI} ${APP_FQDN}
+ $JAVA -Dcadi_prop_files=$LOCAL/${NS}.props -jar $CONFIG/bin/aaf-cadi-aaf-*-full.jar check ${APP_FQI} ${APP_FQDN}
;;
validate)
echo "## validate requested"
- $JAVA -jar /opt/app/aaf_config/bin/aaf-cadi-aaf-*-full.jar validate /opt/app/osaaf/local/${NS}.props
+ $JAVA -jar $CONFIG/bin/aaf-cadi-aaf-*-full.jar validate $LOCAL/${NS}.props
;;
bash)
- if [ ! -e ~/.bash_aliases ]; then
- echo "alias cadi='$JAVA -cp /opt/app/aaf_config/bin/aaf-cadi-aaf-*-full.jar org.onap.aaf.cadi.CmdLine \$*'" >~/.bash_aliases
- echo "alias agent='$JAVA -cp /opt/app/aaf_config/bin/aaf-cadi-aaf-*-full.jar org.onap.aaf.cadi.configure.Agent \$*'" >>~/.bash_aliases
- fi
+ #if [ ! -e $HOME/bash_aliases ]; then
+ # echo "alias cadi='$JAVA -cp $CONFIG/bin/aaf-cadi-aaf-*-full.jar org.onap.aaf.cadi.CmdLine \$*'" >$HOME/bash_aliases
+ # echo "alias agent='/bin/bash $CONFIG/bin/agent.sh no-op \$*'" >>$HOME/bash_aliases
+ #fi
shift
- cd /opt/app/osaaf/local || exit
+ cd $LOCAL || exit
/bin/bash "$@"
;;
setProp)
- cd /opt/app/osaaf/local || exit
+ cd $LOCAL || exit
FILES=$(grep -l "$1" ./*.props)
if [ "$FILES" = "" ]; then
FILES="$3"
@@ -125,11 +140,11 @@ if [ ! "$CMD" = "" ]; then
done
;;
encrypt)
- cd /opt/app/osaaf/local || exit
+ cd $LOCAL || exit
echo $1
FILES=$(grep -l "$1" ./*.props)
if [ "$FILES" = "" ]; then
- FILES=/opt/app/osaaf/local/${NS}.cred.props
+ FILES=$LOCAL/${NS}.cred.props
ADD=Y
fi
for F in $FILES; do
@@ -144,7 +159,7 @@ if [ ! "$CMD" = "" ]; then
else
ORIG_PW="$2"
fi
- PWD=$("$JAVA" -jar /opt/app/aaf_config/bin/aaf-cadi-aaf-*-full.jar cadi digest "$ORIG_PW" /opt/app/osaaf/local/${NS}.keyfile)
+ PWD=$("$JAVA" -jar $CONFIG/bin/aaf-cadi-aaf-*-full.jar cadi digest "$ORIG_PW" $LOCAL/${NS}.keyfile)
if [ "$ADD" = "Y" ]; then
echo "$1=enc:$PWD" >> $F
else
@@ -174,17 +189,17 @@ if [ ! "$CMD" = "" ]; then
;;
cadi)
echo "--- cadi Tool Comands ---"
- $JAVA -Dcadi_prop_files=/opt/app/osaaf/local/${NS}.props -jar /opt/app/aaf_config/bin/aaf-cadi-aaf-*-full.jar cadi | tail -n +6
+ $JAVA -Dcadi_prop_files=$LOCAL/${NS}.props -jar $CONFIG/bin/aaf-cadi-aaf-*-full.jar cadi | tail -n +6
;;
agent)
echo "--- agent Tool Comands ---"
- $JAVA -Dcadi_prop_files=/opt/app/osaaf/local/${NS}.props -jar /opt/app/aaf_config/bin/aaf-cadi-aaf-*-full.jar
+ $JAVA -Dcadi_prop_files=$LOCAL/${NS}.props -jar $CONFIG/bin/aaf-cadi-aaf-*-full.jar
;;
esac
echo ""
;;
*)
- $JAVA -Dcadi_prop_files=/opt/app/osaaf/local/${NS}.props -jar /opt/app/aaf_config/bin/aaf-cadi-aaf-*-full.jar "$CMD" "$@"
+ $JAVA -Dcadi_prop_files=$LOCAL/${NS}.props -jar $CONFIG/bin/aaf-cadi-aaf-*-full.jar "$CMD" "$@"
;;
esac
fi