diff options
author | Instrumental <jonathan.gathman@att.com> | 2018-10-01 15:26:03 -0500 |
---|---|---|
committer | Instrumental <jonathan.gathman@att.com> | 2018-10-01 15:26:06 -0500 |
commit | 365638c2c53d3b790b6914fe3e06b58cec3b2963 (patch) | |
tree | b8ca6505a97a67ce30d62ecefb2c4c5dca968ebe /auth | |
parent | df3aa01e9fdc365770cf11e4c6d92b2d49122810 (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')
-rw-r--r-- | auth/docker/Dockerfile.client | 2 | ||||
-rw-r--r-- | auth/docker/agent.sh | 10 | ||||
-rwxr-xr-x | auth/docker/dbuild.sh | 1 | ||||
-rw-r--r-- | auth/sample/bin/client.sh | 77 | ||||
-rw-r--r-- | auth/sample/bin/service.sh | 18 |
5 files changed, 68 insertions, 40 deletions
diff --git a/auth/docker/Dockerfile.client b/auth/docker/Dockerfile.client index aed42212..2ecf6a5d 100644 --- a/auth/docker/Dockerfile.client +++ b/auth/docker/Dockerfile.client @@ -8,7 +8,7 @@ LABEL version=${AAF_VERSION} COPY logs /opt/app/aaf_config/logs COPY bin/client.sh /opt/app/aaf_config/bin/agent.sh COPY bin/aaf-cadi*full.jar /opt/app/aaf_config/bin/ -COPY public/*all.jks /opt/app/aaf_config/public/ +COPY cert/*trust*.b64 /opt/app/aaf_config/cert/ ENTRYPOINT ["/bin/bash","/opt/app/aaf_config/bin/agent.sh"] CMD [] diff --git a/auth/docker/agent.sh b/auth/docker/agent.sh index 1ca12eb8..38b1070d 100644 --- a/auth/docker/agent.sh +++ b/auth/docker/agent.sh @@ -16,7 +16,7 @@ for V in VERSION DOCKER_REPOSITORY AAF_FQDN AAF_FQDN_IP DEPLOY_FQI APP_FQDN APP_ case $V in DOCKER_REPOSITORY) PROMPT="Docker Repo" - DEF=nexus3.onap.org:10003 + DEF="" ;; AAF_FQDN) PROMPT="AAF's FQDN";; DEPLOY_FQI) PROMPT="Deployer's FQI";; @@ -58,6 +58,12 @@ if [ "$(docker volume ls | grep ${VOLUME})" = "" ]; then docker volume create -d ${DRIVER} ${VOLUME} fi +if [ -n "$DOCKER_REPOSITORY" ]; then + PREFIX="$DOCKER_REPOSITORY/" +else + PREFIX="" +fi + docker run \ -it \ --rm \ @@ -71,5 +77,5 @@ docker run \ --env LATITUDE=${LATITUDE} \ --env LONGITUDE=${LONGITUDE} \ --name aaf_agent_$USER \ - $DOCKER_REPOSITORY/onap/aaf/aaf_agent:$VERSION \ + "$PREFIX"onap/aaf/aaf_agent:$VERSION \ /bin/bash "$@" diff --git a/auth/docker/dbuild.sh b/auth/docker/dbuild.sh index 886e7e7a..94fc7f46 100755 --- a/auth/docker/dbuild.sh +++ b/auth/docker/dbuild.sh @@ -35,6 +35,7 @@ docker tag ${ORG}/${PROJECT}/aaf_agent:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${ rm sample/Dockerfile sample/bin/aaf-cadi-aaf-${VERSION}-full.jar rm -Rf sample/CA cd - + ######## # Second, build a core Docker Image echo Building aaf_$AAF_COMPONENT... 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 diff --git a/auth/sample/bin/service.sh b/auth/sample/bin/service.sh index 43ef403f..da2eb855 100644 --- a/auth/sample/bin/service.sh +++ b/auth/sample/bin/service.sh @@ -10,6 +10,14 @@ CONFIG=/opt/app/aaf_config # Temp use for clarity of code FILE= +# 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 + # Only load Identities once # echo "Check Identities" FILE="$DATA/identities.dat" @@ -32,6 +40,8 @@ if [ ! -e $FILE ]; then base64 -d $CONFIG/cert/truststoreONAP.p12.b64 > $PUBLIC/truststoreONAP.p12 base64 -d $CONFIG/cert/truststoreONAPall.jks.b64 > $PUBLIC/truststoreONAPall.jks ln -s $PUBLIC/truststoreONAPall.jks $LOCAL + cp $CONFIG/cert/AAF_RootCA.cer $PUBLIC + CM_TRUST_CAS="$PUBLIC/AAF_RootCA.cer" echo "cadi_keystore_password=something easy" >> $CONFIG/local/aaf.props fi fi @@ -58,6 +68,7 @@ if [ ! -e $FILE ]; then I=${BOOT_ISSUER##CN=};I=${I%%,*} CM_CA_PASS="something easy" CM_CA_LOCAL="org.onap.aaf.auth.cm.ca.LocalCA,$LOCAL/org.osaaf.aaf.signer.p12;aaf_intermediate_9;enc:" + CM_TRUST_CAS="$PUBLIC/AAF_RootCA.cer" fi fi @@ -95,6 +106,7 @@ if [ ! -e $LOCAL/org.osaaf.aaf.props ]; then mv $FILE $FILE.backup grep -v "cm_ca.local=" $FILE.backup > $FILE echo "cm_ca.local=$CM_CA_LOCAL" >> $FILE + echo "cm_trust_cas=$CM_TRUST_CAS" >> $FILE fi fi @@ -138,12 +150,6 @@ if [ ! "$CMD" = "" ]; then echo Initializing ONAP configurations. ;; bash) - echo "alias agent='/bin/bash $CONFIG/bin/agent.sh EMPTY \$*'" >>~/.bashrc - if [ ! "$(grep aaf_config ~/.bashrc)" = "" ]; then - echo "alias cadi='/bin/bash $CONFIG/bin/agent.sh EMPTY cadi \$*'" >>~/.bashrc - echo "alias agent='/bin/bash $CONFIG/bin/agent.sh EMPTY \$*'" >>~/.bashrc - #. ~/.bashrc - fi shift cd $LOCAL || exit /bin/bash "$@" |