5 if [ ! -e /opt/authz/auth/docker/d.props ]; then
6 cp /opt/authz/auth/docker/d.props.init /opt/authz/auth/docker/d.props
8 . /opt/authz/auth/docker/d.props
11 NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt)
12 NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt)
13 if [ -e /opt/authz/auth/docker/d.props ]; then
14 NEXUS_DOCKER_REPO=`grep "DOCKER_REPOSITORY=" /opt/authz/auth/docker/d.props`
16 NEXUS_DOCKER_REPO="DOCKER_REPOSITORY="
19 if [ "$NEXUS_DOCKER_REPO" = "DOCKER_REPOSITORY=" ]; then
20 NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt)
22 NEXUS_DOCKER_REPO=${NEXUS_DOCKER_REPO#DOCKER_REPOSITORY=}
25 echo $NEXUS_DOCKER_REPO
26 HOSTNAME=`hostname -f`
27 FQDN=aaf.api.simpledemo.onap.org
28 HOST_IP=$(cat /opt/config/public_ip.txt)
30 cd /opt/authz/auth/auth-cass/docker
31 if [ "`docker container ls | grep aaf_cass`" = "" ]; then
33 echo Phase 1 Cassandra Install
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
45 if [ "$LATITUDE" = "" ]; then
48 sed -i "s/LATITUDE=.*/LATITUDE=$LATITUDE/g" /opt/authz/auth/docker/d.props
49 sed -i "s/LONGITUDE=.*/LONGITUDE=$LONGITUDE/g" /opt/authz/auth/docker/d.props
52 sed -i "s/DOCKER_REPOSITORY=.*/DOCKER_REPOSITORY=$NEXUS_DOCKER_REPO/g" /opt/authz/auth/docker/d.props
53 sed -i "s/VERSION=.*/VERSION=$VERSION/g" /opt/authz/auth/docker/d.props
54 sed -i "s/HOSTNAME=.*/HOSTNAME=$HOSTNAME/g" /opt/authz/auth/docker/d.props
55 sed -i "s/HOST_IP=.*/HOST_IP=$HOST_IP/g" /opt/authz/auth/docker/d.props
57 SIGNER_B64="$CURRENT_DIR/config/sample_ca/aaf.signer.b64"
58 SIGNER_P12="$CURRENT_DIR/config/sample_ca/aaf.signer.p12"
59 AAF_P12="$CURRENT_DIR/config/sample_ca/aaf.bootstrap.p12"
60 P12_PASSWORD="something easy"
62 if [ ! -e "$SIGNER_P12" ]; then
63 mkdir -p "$CURRENT_DIR/config/sample_ca"
64 base64 -d $SIGNER_B64 > $SIGNER_P12
67 if [ ! -e "$AAF_P12" ]; then
68 mkdir -p $CURRENT_DIR/sample_ca
70 /bin/bash bootstrap.sh $SIGNER_P12 "$P12_PASSWORD"
71 if [ ! -e "aaf.bootstrap.p12" ]; then
72 echo "Certificates NOT created. Stopping installation"
75 mv aaf.bootstrap.p12 $AAF_P12
80 if [ -e "$AAF_P12" ]; then
81 sed -i "s/AAF_INITIAL_X509_P12=.*/AAF_INITIAL_X509_P12=${AAF_P12//\//\\/}/g" /opt/authz/auth/docker/d.props
82 sed -i "s/AAF_INITIAL_X509_PASSWORD=.*/AAF_INITIAL_X509_PASSWORD=\"$P12_PASSWORD\"/g" /opt/authz/auth/docker/d.props
85 if [ -e "$SIGNER_P12" ]; then
86 if [ "$CADI_X509_ISSUERS" != "" ]; then
87 CADI_X509_ISSUERS="$CADI_X509_ISSUERS:"
89 # Pick the REAL subject off the P12
90 SUBJECT=$(echo "$P12_PASSWORD" | openssl pkcs12 -info -clcerts -in $SIGNER_P12 -nokeys -passin stdin | grep subject)
91 SUBJECT=${SUBJECT//\// }
92 SUBJECT=${SUBJECT/subject= /}
93 # Needs to be reversed, separated by ", "
94 for S in $SUBJECT ; do
95 if [ "$RSUBJECT" = "" ]; then
98 RSUBJECT="$S, $RSUBJECT"
101 ISSUERS="$CADI_X509_ISSUERS$RSUBJECT"
102 sed -i "s/CADI_X509_ISSUERS=.*/CADI_X509_ISSUERS=\"$ISSUERS\"/g" /opt/authz/auth/docker/d.props
103 sed -i "s/AAF_SIGNER_P12=.*/AAF_SIGNER_P12=${SIGNER_P12//\//\\/}/g" /opt/authz/auth/docker/d.props
104 sed -i "s/AAF_SIGNER_PASSWORD=.*/AAF_SIGNER_PASSWORD=\"$P12_PASSWORD\"/g" /opt/authz/auth/docker/d.props
107 cd /opt/authz/auth/docker
108 # Need new Deployment system properties