5 NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt)
6 NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt)
7 if [ -e /opt/authz/auth/docker/d.props ]; then
8 NEXUS_DOCKER_REPO=`grep "DOCKER_REPOSITORY=" /opt/authz/auth/docker/d.props`
10 NEXUS_DOCKER_REPO="DOCKER_REPOSITORY="
13 if [ "$NEXUS_DOCKER_REPO" = "DOCKER_REPOSITORY=" ]; then
14 NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt)
16 NEXUS_DOCKER_REPO=${NEXUS_DOCKER_REPO#DOCKER_REPOSITORY=}
19 echo $NEXUS_DOCKER_REPO
20 HOSTNAME=`hostname -f`
21 FQDN=aaf.api.simpledemo.onap.org
22 HOST_IP=$(cat /opt/config/public_ip.txt)
24 cd /opt/authz/auth/auth-cass/docker
25 if [ "`docker container ls | grep aaf_cass`" = "" ]; then
27 echo Phase 1 Cassandra Install
31 if [ ! -e /opt/authz/auth/docker/d.props ]; then
32 cp /opt/authz/auth/docker/d.props.init /opt/authz/auth/docker/d.props
35 VERSION=$(grep VERSION /opt/authz/auth/docker/d.props)
36 VERSION=${VERSION#VERSION=}
37 CASS_IP=`docker inspect aaf_cass | grep '"IPAddress' | head -1 | cut -d '"' -f 4`
38 CASS_HOST="cass.aaf.osaaf.org:"$CASS_IP
39 if [ ! -e /opt/authz/auth/docker/cass.props ]; then
40 cp /opt/authz/auth/docker/cass.props.init /opt/authz/auth/docker/cass.props
43 sed -i "s/CASS_HOST=.*/CASS_HOST="$CASS_HOST"/g" /opt/authz/auth/docker/cass.props
44 # TODO Pull from Config Dir
46 CADI_LONGITUDE=-122.261
48 sed -i "s/DOCKER_REPOSITORY=.*/DOCKER_REPOSITORY=$NEXUS_DOCKER_REPO/g" /opt/authz/auth/docker/d.props
49 sed -i "s/VERSION=.*/VERSION=$VERSION/g" /opt/authz/auth/docker/d.props
50 sed -i "s/HOSTNAME=.*/HOSTNAME=$HOSTNAME/g" /opt/authz/auth/docker/d.props
51 sed -i "s/HOST_IP=.*/HOST_IP=$HOST_IP/g" /opt/authz/auth/docker/d.props
52 sed -i "s/LATITUDE=.*/LATITUDE=$CADI_LATITUDE/g" /opt/authz/auth/docker/d.props
53 sed -i "s/LONGITUDE=.*/LONGITUDE=$CADI_LONGITUDE/g" /opt/authz/auth/docker/d.props
55 SIGNER_B64="$CURRENT_DIR/config/sample_ca/aaf.signer.b64"
56 SIGNER_P12="$CURRENT_DIR/config/sample_ca/aaf.signer.p12"
57 AAF_P12="$CURRENT_DIR/config/sample_ca/aaf.bootstrap.p12"
58 P12_PASSWORD="something easy"
60 if [ ! -e "$SIGNER_P12" ]; then
61 mkdir -p "$CURRENT_DIR/config/sample_ca"
62 base64 -d $SIGNER_B64 > $SIGNER_P12
65 if [ ! -e "$AAF_P12" ]; then
66 mkdir -p $CURRENT_DIR/sample_ca
68 /bin/bash bootstrap.sh $SIGNER_P12 "$P12_PASSWORD"
69 if [ ! -e "aaf.bootstrap.p12" ]; then
70 echo "Certificates NOT created. Stopping installation"
73 mv aaf.bootstrap.p12 $AAF_P12
78 if [ -e "$AAF_P12" ]; then
79 sed -i "s/AAF_INITIAL_X509_P12=.*/AAF_INITIAL_X509_P12=${AAF_P12//\//\\/}/g" /opt/authz/auth/docker/d.props
80 sed -i "s/AAF_INITIAL_X509_PASSWORD=.*/AAF_INITIAL_X509_PASSWORD=\"$P12_PASSWORD\"/g" /opt/authz/auth/docker/d.props
83 if [ -e "$SIGNER_P12" ]; then
84 if [ -e "/opt/config/cadi_x509_issuers.txt" ]; then
85 ISSUERS=$(cat "/opt/config/cadi_x509_issuers.txt")":"
87 # Pick the REAL subject off the P12
88 SUBJECT=$(echo "$P12_PASSWORD" | openssl pkcs12 -info -clcerts -in $SIGNER_P12 -nokeys -passin stdin | grep subject)
89 SUBJECT=${SUBJECT//\// }
90 SUBJECT=${SUBJECT/subject= /}
91 # Needs to be reversed, separated by ", "
92 for S in $SUBJECT ; do
93 if [ "$RSUBJECT" = "" ]; then
96 RSUBJECT="$S, $RSUBJECT"
99 ISSUERS="$ISSUERS$RSUBJECT"
100 sed -i "s/CADI_X509_ISSUERS=.*/CADI_X509_ISSUERS=\"$ISSUERS\"/g" /opt/authz/auth/docker/d.props
101 sed -i "s/AAF_SIGNER_P12=.*/AAF_SIGNER_P12=${SIGNER_P12//\//\\/}/g" /opt/authz/auth/docker/d.props
102 sed -i "s/AAF_SIGNER_PASSWORD=.*/AAF_SIGNER_PASSWORD=\"$P12_PASSWORD\"/g" /opt/authz/auth/docker/d.props
105 cd /opt/authz/auth/docker
106 # Need new Deployment system properties