diff options
Diffstat (limited to 'heat/ONAP/cloud-config/aaf_vm_init.sh')
-rw-r--r-- | heat/ONAP/cloud-config/aaf_vm_init.sh | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/heat/ONAP/cloud-config/aaf_vm_init.sh b/heat/ONAP/cloud-config/aaf_vm_init.sh index 59486e94..f2dd8781 100644 --- a/heat/ONAP/cloud-config/aaf_vm_init.sh +++ b/heat/ONAP/cloud-config/aaf_vm_init.sh @@ -2,6 +2,12 @@ CURRENT_DIR=$(pwd) +if [ ! -e /opt/authz/auth/docker/d.props ]; then + cp /opt/authz/auth/docker/d.props.init /opt/authz/auth/docker/d.props +fi +. /opt/authz/auth/docker/d.props + + NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) if [ -e /opt/authz/auth/docker/d.props ]; then @@ -19,7 +25,7 @@ fi echo $NEXUS_DOCKER_REPO HOSTNAME=`hostname -f` FQDN=aaf.api.simpledemo.onap.org -HOST_IP=$(cat /opt/config/local_ip.txt) +HOST_IP=$(cat /opt/config/public_ip.txt) cd /opt/authz/auth/auth-cass/docker if [ "`docker container ls | grep aaf_cass`" = "" ]; then @@ -28,12 +34,6 @@ if [ "`docker container ls | grep aaf_cass`" = "" ]; then bash ./dinstall.sh fi -if [ ! -e /opt/authz/auth/docker/d.props ]; then - cp /opt/authz/auth/docker/d.props.init /opt/authz/auth/docker/d.props -fi - -VERSION=$(grep VERSION /opt/authz/auth/docker/d.props) -VERSION=${VERSION#VERSION=} CASS_IP=`docker inspect aaf_cass | grep '"IPAddress' | head -1 | cut -d '"' -f 4` CASS_HOST="cass.aaf.osaaf.org:"$CASS_IP if [ ! -e /opt/authz/auth/docker/cass.props ]; then @@ -42,20 +42,28 @@ fi sed -i "s/CASS_HOST=.*/CASS_HOST="$CASS_HOST"/g" /opt/authz/auth/docker/cass.props # TODO Pull from Config Dir -CADI_LATITUDE=37.781 -CADI_LONGITUDE=-122.261 +if [ "$LATITUDE" = "" ]; then + LATITUDE=37.781 + LONGITUDE=-122.261 + sed -i "s/LATITUDE=.*/LATITUDE=$LATITUDE/g" /opt/authz/auth/docker/d.props + sed -i "s/LONGITUDE=.*/LONGITUDE=$LONGITUDE/g" /opt/authz/auth/docker/d.props +fi sed -i "s/DOCKER_REPOSITORY=.*/DOCKER_REPOSITORY=$NEXUS_DOCKER_REPO/g" /opt/authz/auth/docker/d.props sed -i "s/VERSION=.*/VERSION=$VERSION/g" /opt/authz/auth/docker/d.props sed -i "s/HOSTNAME=.*/HOSTNAME=$HOSTNAME/g" /opt/authz/auth/docker/d.props sed -i "s/HOST_IP=.*/HOST_IP=$HOST_IP/g" /opt/authz/auth/docker/d.props -sed -i "s/LATITUDE=.*/LATITUDE=$CADI_LATITUDE/g" /opt/authz/auth/docker/d.props -sed -i "s/LONGITUDE=.*/LONGITUDE=$CADI_LONGITUDE/g" /opt/authz/auth/docker/d.props -SIGNER_P12="$CURRENT_DIR/sample_ca/aaf.signer.p12" -AAF_P12="$CURRENT_DIR/sample_ca/aaf.bootstrap.p12" +SIGNER_B64="$CURRENT_DIR/config/sample_ca/aaf.signer.b64" +SIGNER_P12="$CURRENT_DIR/config/sample_ca/aaf.signer.p12" +AAF_P12="$CURRENT_DIR/config/sample_ca/aaf.bootstrap.p12" P12_PASSWORD="something easy" +if [ ! -e "$SIGNER_P12" ]; then + mkdir -p "$CURRENT_DIR/config/sample_ca" + base64 -d $SIGNER_B64 > $SIGNER_P12 +fi + if [ ! -e "$AAF_P12" ]; then mkdir -p $CURRENT_DIR/sample_ca cd /opt/authz/conf/CA @@ -75,8 +83,8 @@ if [ -e "$AAF_P12" ]; then fi if [ -e "$SIGNER_P12" ]; then - if [ -e "/opt/config/cadi_x509_issuers.txt" ]; then - ISSUERS=$(cat "/opt/config/cadi_x509_issuers.txt")":" + if [ "$CADI_X509_ISSUERS" != "" ]; then + CADI_X509_ISSUERS="$CADI_X509_ISSUERS:" fi # Pick the REAL subject off the P12 SUBJECT=$(echo "$P12_PASSWORD" | openssl pkcs12 -info -clcerts -in $SIGNER_P12 -nokeys -passin stdin | grep subject) @@ -90,7 +98,7 @@ if [ -e "$SIGNER_P12" ]; then RSUBJECT="$S, $RSUBJECT" fi done - ISSUERS="$ISSUERS$RSUBJECT" + ISSUERS="$CADI_X509_ISSUERS$RSUBJECT" sed -i "s/CADI_X509_ISSUERS=.*/CADI_X509_ISSUERS=\"$ISSUERS\"/g" /opt/authz/auth/docker/d.props sed -i "s/AAF_SIGNER_P12=.*/AAF_SIGNER_P12=${SIGNER_P12//\//\\/}/g" /opt/authz/auth/docker/d.props sed -i "s/AAF_SIGNER_PASSWORD=.*/AAF_SIGNER_PASSWORD=\"$P12_PASSWORD\"/g" /opt/authz/auth/docker/d.props |