Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 1 | #!/bin/bash |
Instrumental | 7a1817b | 2018-11-05 11:11:15 -0600 | [diff] [blame] | 2 | ######### |
| 3 | # ============LICENSE_START==================================================== |
| 4 | # org.onap.aaf |
| 5 | # =========================================================================== |
| 6 | # Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. |
| 7 | # =========================================================================== |
| 8 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 9 | # you may not use this file except in compliance with the License. |
| 10 | # You may obtain a copy of the License at |
| 11 | # |
| 12 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 13 | # |
| 14 | # Unless required by applicable law or agreed to in writing, software |
| 15 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 17 | # See the License for the specific language governing permissions and |
| 18 | # limitations under the License. |
| 19 | # ============LICENSE_END==================================================== |
| 20 | # |
Instrumental | 9ec2895 | 2018-07-12 11:14:10 -0500 | [diff] [blame] | 21 | # This script is run when starting aaf_config Container. |
| 22 | # It needs to cover the cases where the initial data doesn't exist, and when it has already been configured (don't overwrite) |
| 23 | # |
| 24 | JAVA=/usr/bin/java |
Instrumental | 9fe1153 | 2018-10-23 17:40:47 -0500 | [diff] [blame] | 25 | |
| 26 | OSAAF=/opt/app/osaaf |
| 27 | LOCAL=$OSAAF/local |
| 28 | DATA=$OSAAF/data |
| 29 | PUBLIC=$OSAAF/public |
Instrumental | bc299c0 | 2018-09-25 06:42:31 -0500 | [diff] [blame] | 30 | CONFIG=/opt/app/aaf_config |
Instrumental | 5451a50 | 2018-10-10 18:51:33 -0500 | [diff] [blame] | 31 | |
Instrumental | 9fe1153 | 2018-10-23 17:40:47 -0500 | [diff] [blame] | 32 | JAVA_CADI="$JAVA -cp $CONFIG/bin/aaf-auth-cmd-*-full.jar org.onap.aaf.cadi.CmdLine" |
| 33 | JAVA_AGENT="$JAVA -cp $CONFIG/bin/aaf-auth-cmd-*-full.jar -Dcadi_prop_files=$LOCAL/org.osaaf.aaf.props org.onap.aaf.cadi.configure.Agent" |
| 34 | JAVA_AAFCLI="$JAVA -cp $CONFIG/bin/aaf-auth-cmd-*-full.jar -Dcadi_prop_files=$LOCAL/org.osaaf.aaf.props org.onap.aaf.auth.cmd.AAFcli" |
Instrumental | e2fa0e6 | 2019-02-07 11:09:32 -0600 | [diff] [blame] | 35 | JAVA_AAFBATCH="$JAVA -Dcadi_prop_files=$LOCAL/org.osaaf.aaf.batch.props -jar $CONFIG/bin/aaf-auth-batch-*-full.jar" |
Instrumental | 9fe1153 | 2018-10-23 17:40:47 -0500 | [diff] [blame] | 36 | |
Instrumental | 5451a50 | 2018-10-10 18:51:33 -0500 | [diff] [blame] | 37 | # If doesn't exist... still create |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 38 | mkdir -p $OSAAF |
Instrumental | 5451a50 | 2018-10-10 18:51:33 -0500 | [diff] [blame] | 39 | |
Instrumental | 3505a52 | 2019-01-31 14:49:24 -0600 | [diff] [blame] | 40 | # If not created by separate PV, create |
| 41 | mkdir -p /opt/app/aaf/status |
| 42 | |
Instrumental | bc299c0 | 2018-09-25 06:42:31 -0500 | [diff] [blame] | 43 | # Temp use for clarity of code |
| 44 | FILE= |
Instrumental | 9ec2895 | 2018-07-12 11:14:10 -0500 | [diff] [blame] | 45 | |
Instrumental | 365638c | 2018-10-01 15:26:03 -0500 | [diff] [blame] | 46 | # Setup Bash, first time only |
Instrumental | e2fa0e6 | 2019-02-07 11:09:32 -0600 | [diff] [blame] | 47 | if [ ! -e "$HOME/.bashrc" ] || [ -z "$(grep cadi $HOME/.bashrc)" ]; then |
| 48 | echo "alias cadi='$JAVA_CADI \$*'" >>$HOME/.bashrc |
| 49 | echo "alias agent='$CONFIG/bin/agent.sh \$*'" >>$HOME/.bashrc |
| 50 | echo "alias aafcli='$JAVA_AAFCLI \$*'" >>$HOME/.bashrc |
| 51 | echo "alias batch='$JAVA_AAFBATCH \$*'" >>$HOME/.bashrc |
Instrumental | 365638c | 2018-10-01 15:26:03 -0500 | [diff] [blame] | 52 | chmod a+x $CONFIG/bin/agent.sh |
Instrumental | e2fa0e6 | 2019-02-07 11:09:32 -0600 | [diff] [blame] | 53 | . $HOME/.bashrc |
Instrumental | 365638c | 2018-10-01 15:26:03 -0500 | [diff] [blame] | 54 | fi |
| 55 | |
Instrumental | 9ec2895 | 2018-07-12 11:14:10 -0500 | [diff] [blame] | 56 | # Only load Identities once |
Instrumental | bc299c0 | 2018-09-25 06:42:31 -0500 | [diff] [blame] | 57 | # echo "Check Identities" |
| 58 | FILE="$DATA/identities.dat" |
| 59 | if [ ! -e $FILE ]; then |
| 60 | mkdir -p $DATA |
| 61 | cp $CONFIG/data/sample.identities.dat $FILE |
Instrumental | 284ad0a | 2018-10-24 07:01:09 -0500 | [diff] [blame] | 62 | echo "Set Identities" |
| 63 | INITIALIZED="true" |
Instrumental | bc299c0 | 2018-09-25 06:42:31 -0500 | [diff] [blame] | 64 | fi |
| 65 | |
| 66 | # Load up Cert/X509 Artifacts |
| 67 | # echo "Check Signer Keyfile" |
| 68 | FILE="$LOCAL/org.osaaf.aaf.signer.p12" |
| 69 | if [ ! -e $FILE ]; then |
| 70 | mkdir -p $LOCAL |
| 71 | mkdir -p $PUBLIC |
| 72 | if [ -e $CONFIG/cert/org.osaaf.aaf.signer.p12 ]; then |
| 73 | cp $CONFIG/cert/org.osaaf.aaf.signer.p12 $FILE |
Instrumental | 284ad0a | 2018-10-24 07:01:09 -0500 | [diff] [blame] | 74 | echo "Installed Signer P12" |
| 75 | INITIALIZED="true" |
Instrumental | bc299c0 | 2018-09-25 06:42:31 -0500 | [diff] [blame] | 76 | else |
| 77 | echo "Decode" |
| 78 | base64 -d $CONFIG/cert/demoONAPsigner.p12.b64 > $FILE |
| 79 | base64 -d $CONFIG/cert/truststoreONAP.p12.b64 > $PUBLIC/truststoreONAP.p12 |
| 80 | base64 -d $CONFIG/cert/truststoreONAPall.jks.b64 > $PUBLIC/truststoreONAPall.jks |
| 81 | ln -s $PUBLIC/truststoreONAPall.jks $LOCAL |
Instrumental | 365638c | 2018-10-01 15:26:03 -0500 | [diff] [blame] | 82 | cp $CONFIG/cert/AAF_RootCA.cer $PUBLIC |
| 83 | CM_TRUST_CAS="$PUBLIC/AAF_RootCA.cer" |
Instrumental | bc299c0 | 2018-09-25 06:42:31 -0500 | [diff] [blame] | 84 | echo "cadi_keystore_password=something easy" >> $CONFIG/local/aaf.props |
Instrumental | 284ad0a | 2018-10-24 07:01:09 -0500 | [diff] [blame] | 85 | echo "Setup ONAP Test CAs and Signers" |
| 86 | INITIALIZED="true" |
Instrumental | bc299c0 | 2018-09-25 06:42:31 -0500 | [diff] [blame] | 87 | fi |
| 88 | fi |
| 89 | |
| 90 | # echo "Check keyfile" |
| 91 | FILE="$LOCAL/org.osaaf.aaf.p12" |
| 92 | if [ ! -e $FILE ]; then |
| 93 | if [ -e $CONFIG/cert/org.osaaf.aaf.p12 ]; then |
| 94 | cp $CONFIG/cert/org.osaaf.aaf.p12 $FILE |
Instrumental | 284ad0a | 2018-10-24 07:01:09 -0500 | [diff] [blame] | 95 | echo "Installed AAF P12" |
| 96 | INITIALIZED="true" |
Instrumental | bc299c0 | 2018-09-25 06:42:31 -0500 | [diff] [blame] | 97 | else |
| 98 | echo "Bootstrap Creation of Keystore from Signer" |
| 99 | cd $CONFIG/CA |
| 100 | |
| 101 | # Remove this after Casablanca |
| 102 | CADI_X509_ISSUERS="CN=intermediateCA_1, OU=OSAAF, O=ONAP, C=US:CN=intermediateCA_7, OU=OSAAF, O=ONAP, C=US" |
| 103 | bash bootstrap.sh $LOCAL/org.osaaf.aaf.signer.p12 'something easy' |
| 104 | cp aaf.bootstrap.p12 $FILE |
| 105 | if [ -n "$CADI_X509_ISSUERS" ]; then |
| 106 | CADI_X509_ISSUERS="$CADI_X509_ISSUERS:" |
| 107 | fi |
| 108 | BOOT_ISSUER="$(cat aaf.bootstrap.issuer)" |
| 109 | CADI_X509_ISSUERS="$CADI_X509_ISSUERS$BOOT_ISSUER" |
| 110 | |
| 111 | I=${BOOT_ISSUER##CN=};I=${I%%,*} |
| 112 | CM_CA_PASS="something easy" |
| 113 | CM_CA_LOCAL="org.onap.aaf.auth.cm.ca.LocalCA,$LOCAL/org.osaaf.aaf.signer.p12;aaf_intermediate_9;enc:" |
Instrumental | 365638c | 2018-10-01 15:26:03 -0500 | [diff] [blame] | 114 | CM_TRUST_CAS="$PUBLIC/AAF_RootCA.cer" |
Instrumental | 284ad0a | 2018-10-24 07:01:09 -0500 | [diff] [blame] | 115 | echo "Generated ONAP Test AAF certs" |
| 116 | INITIALIZED="true" |
Instrumental | bc299c0 | 2018-09-25 06:42:31 -0500 | [diff] [blame] | 117 | fi |
Instrumental | 9ec2895 | 2018-07-12 11:14:10 -0500 | [diff] [blame] | 118 | fi |
| 119 | |
| 120 | # Only initialize once, automatically... |
Instrumental | bc299c0 | 2018-09-25 06:42:31 -0500 | [diff] [blame] | 121 | if [ ! -e $LOCAL/org.osaaf.aaf.props ]; then |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 122 | cp $CONFIG/local/org.osaaf.aaf* $LOCAL |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 123 | for D in public etc logs; do |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 124 | mkdir -p $OSAAF/$D |
| 125 | cp $CONFIG/$D/* $OSAAF/$D |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 126 | done |
Instrumental | 9c8a8b0 | 2018-07-16 18:41:10 -0500 | [diff] [blame] | 127 | |
| 128 | TMP=$(mktemp) |
| 129 | echo aaf_env=${AAF_ENV} >> ${TMP} |
Instrumental | 575c982 | 2018-10-19 11:13:05 -0500 | [diff] [blame] | 130 | echo aaf_release=${VERSION} >> ${TMP} |
Instrumental | 9c8a8b0 | 2018-07-16 18:41:10 -0500 | [diff] [blame] | 131 | echo cadi_latitude=${LATITUDE} >> ${TMP} |
| 132 | echo cadi_longitude=${LONGITUDE} >> ${TMP} |
Instrumental | bc299c0 | 2018-09-25 06:42:31 -0500 | [diff] [blame] | 133 | echo cadi_x509_issuers=${CADI_X509_ISSUERS} >> ${TMP} |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 134 | AAF_LOCATE_URL=${aaf_locate_url:="https://${HOSTNAME}:8095"} |
| 135 | echo aaf_locate_url=${AAF_LOCATE_URL} >> ${TMP} |
| 136 | for P in `env`; do |
| 137 | if [[ "$P" == aaf_locator* ]]; then |
Instrumental | 4ac37bf | 2019-04-10 13:01:30 -0500 | [diff] [blame] | 138 | S="${P/_helm/.helm}" |
| 139 | S="${S/_oom/.oom}" |
| 140 | echo "$S" >> ${TMP} |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 141 | fi |
| 142 | done |
Instrumental | 9c8a8b0 | 2018-07-16 18:41:10 -0500 | [diff] [blame] | 143 | |
Instrumental | bc299c0 | 2018-09-25 06:42:31 -0500 | [diff] [blame] | 144 | cat $TMP |
| 145 | |
Instrumental | 9fe1153 | 2018-10-23 17:40:47 -0500 | [diff] [blame] | 146 | $JAVA_AGENT config \ |
| 147 | aaf@aaf.osaaf.org \ |
Instrumental | bc299c0 | 2018-09-25 06:42:31 -0500 | [diff] [blame] | 148 | cadi_etc_dir=$LOCAL \ |
| 149 | cadi_prop_files=$CONFIG/local/initialConfig.props:$CONFIG/local/aaf.props:${TMP} |
Instrumental | 9c8a8b0 | 2018-07-16 18:41:10 -0500 | [diff] [blame] | 150 | rm ${TMP} |
Instrumental | 196000b | 2018-10-05 19:30:59 -0500 | [diff] [blame] | 151 | |
| 152 | # Cassandra Config stuff |
| 153 | # Default is expect a Cassandra on same Node |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 154 | CASS_HOST=${CASS_HOST:="aaf-cass"} |
Instrumental | 9fe1153 | 2018-10-23 17:40:47 -0500 | [diff] [blame] | 155 | CASS_PASS=$($JAVA_CADI digest "${CASSANDRA_PASSWORD:-cassandra}" $LOCAL/org.osaaf.aaf.keyfile) |
Instrumental | 196000b | 2018-10-05 19:30:59 -0500 | [diff] [blame] | 156 | CASS_NAME=${CASS_HOST/:*/} |
Instrumental | 14f3707 | 2018-10-09 08:32:06 -0500 | [diff] [blame] | 157 | sed -i.backup -e "s/\\(cassandra.clusters=\\).*/\\1${CASSANDRA_CLUSTERS:=$CASS_HOST}/" \ |
Instrumental | 196000b | 2018-10-05 19:30:59 -0500 | [diff] [blame] | 158 | -e "s/\\(cassandra.clusters.user=\\).*/\\1${CASSANDRA_USER:=cassandra}/" \ |
| 159 | -e "s/\\(cassandra.clusters.password=enc:\\).*/\\1$CASS_PASS/" \ |
| 160 | -e "s/\\(cassandra.clusters.port=\\).*/\\1${CASSANDRA_PORT:=9042}/" \ |
| 161 | $LOCAL/org.osaaf.aaf.cassandra.props |
Instrumental | bc299c0 | 2018-09-25 06:42:31 -0500 | [diff] [blame] | 162 | |
| 163 | if [ -n "$CM_CA_LOCAL" ]; then |
| 164 | if [ -n "$CM_CA_PASS" ]; then |
Instrumental | 9fe1153 | 2018-10-23 17:40:47 -0500 | [diff] [blame] | 165 | CM_CA_LOCAL=$CM_CA_LOCAL$($JAVA_CADI digest "$CM_CA_PASS" $LOCAL/org.osaaf.aaf.keyfile) |
Instrumental | bc299c0 | 2018-09-25 06:42:31 -0500 | [diff] [blame] | 166 | fi |
| 167 | # Move and copy method, rather than sed, because of slashes in CM_CA_LOCAL makes too complex |
| 168 | FILE=$LOCAL/org.osaaf.aaf.cm.ca.props |
| 169 | mv $FILE $FILE.backup |
| 170 | grep -v "cm_ca.local=" $FILE.backup > $FILE |
| 171 | echo "cm_ca.local=$CM_CA_LOCAL" >> $FILE |
Instrumental | 365638c | 2018-10-01 15:26:03 -0500 | [diff] [blame] | 172 | echo "cm_trust_cas=$CM_TRUST_CAS" >> $FILE |
Instrumental | bc299c0 | 2018-09-25 06:42:31 -0500 | [diff] [blame] | 173 | fi |
Instrumental | 284ad0a | 2018-10-24 07:01:09 -0500 | [diff] [blame] | 174 | echo "Created AAF Initial Configurations" |
| 175 | INITIALIZED="true" |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 176 | fi |
Instrumental | 9ec2895 | 2018-07-12 11:14:10 -0500 | [diff] [blame] | 177 | |
Instrumental | bc299c0 | 2018-09-25 06:42:31 -0500 | [diff] [blame] | 178 | |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 179 | # Now run a command |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 180 | CMD=$1 |
Instrumental | 9fe1153 | 2018-10-23 17:40:47 -0500 | [diff] [blame] | 181 | if [ -z "$CMD" ]; then |
Instrumental | 284ad0a | 2018-10-24 07:01:09 -0500 | [diff] [blame] | 182 | if [ -n "$INITIALIZED" ]; then |
| 183 | echo "Initialization Complete" |
| 184 | else |
| 185 | echo "No Additional Initialization required" |
| 186 | fi |
Instrumental | 9fe1153 | 2018-10-23 17:40:47 -0500 | [diff] [blame] | 187 | else |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 188 | shift |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 189 | case "$CMD" in |
| 190 | ls) |
| 191 | echo ls requested |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 192 | find $OSAAF -depth |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 193 | ;; |
| 194 | cat) |
| 195 | if [ "$1" = "" ]; then |
| 196 | echo "usage: cat <file... ONLY files ending in .props>" |
| 197 | else |
| 198 | if [[ $1 == *.props ]]; then |
| 199 | echo |
| 200 | echo "## CONTENTS OF $3" |
| 201 | echo |
| 202 | cat "$1" |
| 203 | else |
| 204 | echo "### ERROR ####" |
| 205 | echo " \"cat\" may only be used with files ending with \".props\"" |
| 206 | fi |
| 207 | fi |
| 208 | ;; |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 209 | validate) |
| 210 | echo "## validate requested" |
Instrumental | 9fe1153 | 2018-10-23 17:40:47 -0500 | [diff] [blame] | 211 | $JAVA_AAFCLI perm list user aaf@aaf.osaaf.org |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 212 | ;; |
Instrumental | bc299c0 | 2018-09-25 06:42:31 -0500 | [diff] [blame] | 213 | onap) |
Instrumental | 284ad0a | 2018-10-24 07:01:09 -0500 | [diff] [blame] | 214 | #echo Initializing ONAP configurations. |
Instrumental | bc299c0 | 2018-09-25 06:42:31 -0500 | [diff] [blame] | 215 | ;; |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 216 | bash) |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 217 | shift |
Instrumental | bc299c0 | 2018-09-25 06:42:31 -0500 | [diff] [blame] | 218 | cd $LOCAL || exit |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 219 | exec /bin/bash -c "$@" |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 220 | ;; |
Instrumental | 9c8a8b0 | 2018-07-16 18:41:10 -0500 | [diff] [blame] | 221 | setProp) |
Instrumental | bc299c0 | 2018-09-25 06:42:31 -0500 | [diff] [blame] | 222 | cd $LOCAL || exit |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 223 | FILES=$(grep -l "$1" ./*.props) |
Instrumental | 9fe1153 | 2018-10-23 17:40:47 -0500 | [diff] [blame] | 224 | if [ -z "$FILES" ]; then |
| 225 | if [ -z "$3" ]; then |
| 226 | FILES=org.osaaf.aaf.props |
| 227 | else |
| 228 | FILES="$3" |
| 229 | fi |
Instrumental | 9c8a8b0 | 2018-07-16 18:41:10 -0500 | [diff] [blame] | 230 | ADD=Y |
| 231 | fi |
| 232 | for F in $FILES; do |
Instrumental | 9c8a8b0 | 2018-07-16 18:41:10 -0500 | [diff] [blame] | 233 | if [ "$ADD" = "Y" ]; then |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 234 | echo "Changing $1 for $F" |
Instrumental | aeb80c8 | 2018-08-21 10:24:08 -0500 | [diff] [blame] | 235 | echo "$1=$2" >> $F |
Instrumental | 9c8a8b0 | 2018-07-16 18:41:10 -0500 | [diff] [blame] | 236 | else |
Instrumental | 9fe1153 | 2018-10-23 17:40:47 -0500 | [diff] [blame] | 237 | echo "Changing $1 in $F" |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 238 | sed -i.backup -e "s/\\(${1}=\\).*/\\1${2}/" $F |
Instrumental | 9c8a8b0 | 2018-07-16 18:41:10 -0500 | [diff] [blame] | 239 | fi |
| 240 | cat $F |
| 241 | done |
| 242 | ;; |
| 243 | encrypt) |
Instrumental | bc299c0 | 2018-09-25 06:42:31 -0500 | [diff] [blame] | 244 | cd $LOCAL || exit |
Instrumental | 9c8a8b0 | 2018-07-16 18:41:10 -0500 | [diff] [blame] | 245 | echo $1 |
| 246 | FILES=$(grep -l "$1" ./*.props) |
| 247 | if [ "$FILES" = "" ]; then |
Instrumental | bc299c0 | 2018-09-25 06:42:31 -0500 | [diff] [blame] | 248 | FILES=$LOCAL/org.osaaf.aaf.cred.props |
Instrumental | 9c8a8b0 | 2018-07-16 18:41:10 -0500 | [diff] [blame] | 249 | ADD=Y |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 250 | fi |
| 251 | for F in $FILES; do |
| 252 | echo "Changing $1 in $F" |
| 253 | if [ "$2" = "" ]; then |
| 254 | read -r -p "Password (leave blank to cancel): " -s ORIG_PW |
| 255 | echo " " |
| 256 | if [ "$ORIG_PW" = "" ]; then |
| 257 | echo canceling... |
| 258 | break |
| 259 | fi |
| 260 | else |
| 261 | ORIG_PW="$2" |
| 262 | fi |
Instrumental | 9fe1153 | 2018-10-23 17:40:47 -0500 | [diff] [blame] | 263 | PWD=$($JAVA_CADI digest "$ORIG_PW" $LOCAL/org.osaaf.aaf.keyfile) |
Instrumental | 9c8a8b0 | 2018-07-16 18:41:10 -0500 | [diff] [blame] | 264 | if [ "$ADD" = "Y" ]; then |
| 265 | echo "$1=enc:$PWD" >> $F |
| 266 | else |
| 267 | sed -i.backup -e "s/\\($1.*enc:\\).*/\\1$PWD/" $F |
| 268 | fi |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 269 | cat $F |
| 270 | done |
| 271 | ;; |
Instrumental | 9c8a8b0 | 2018-07-16 18:41:10 -0500 | [diff] [blame] | 272 | taillog) |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 273 | sh $OSAAF/logs/taillog |
Instrumental | 9c8a8b0 | 2018-07-16 18:41:10 -0500 | [diff] [blame] | 274 | ;; |
Instrumental | ca788dc | 2018-11-03 14:38:21 -0500 | [diff] [blame] | 275 | wait) |
| 276 | bash $CONFIG/bin/pod_wait.sh wait $1 |
| 277 | ;; |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 278 | --help | -?) |
| 279 | case "$1" in |
| 280 | "") |
| 281 | echo "--- Agent Container Comands ---" |
| 282 | echo " ls - Lists all files in Configuration" |
| 283 | echo " cat <file.props>> - Shows the contents (Prop files only)" |
| 284 | echo " validate - Runs a test using Configuration" |
Instrumental | 9c8a8b0 | 2018-07-16 18:41:10 -0500 | [diff] [blame] | 285 | echo " setProp <tag> [<value>] - set value on 'tag' (if no value, it will be queried from config)" |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 286 | echo " encrypt <tag> [<pass>] - set passwords on Configuration (if no pass, it will be queried)" |
| 287 | echo " bash - run bash in Container" |
| 288 | echo " Note: the following aliases are preset" |
| 289 | echo " cadi - CADI CmdLine tool" |
| 290 | echo " agent - Agent Java tool (see above help)" |
| 291 | echo "" |
| 292 | echo " --help|-? [cadi|agent] - This help, cadi help or agent help" |
| 293 | ;; |
| 294 | cadi) |
| 295 | echo "--- cadi Tool Comands ---" |
Instrumental | 9fe1153 | 2018-10-23 17:40:47 -0500 | [diff] [blame] | 296 | $JAVA_CADI |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 297 | ;; |
| 298 | agent) |
| 299 | echo "--- agent Tool Comands ---" |
Instrumental | 9fe1153 | 2018-10-23 17:40:47 -0500 | [diff] [blame] | 300 | $JAVA_AGENT |
| 301 | ;; |
| 302 | aafcli) |
| 303 | echo "--- aafcli Tool Comands ---" |
| 304 | $JAVA_AAFCLI |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 305 | ;; |
| 306 | esac |
| 307 | echo "" |
| 308 | ;; |
| 309 | *) |
Instrumental | 9fe1153 | 2018-10-23 17:40:47 -0500 | [diff] [blame] | 310 | $JAVA_AGENT "$CMD" "$@" cadi_prop_files=$LOCAL/org.osaaf.aaf.props |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 311 | ;; |
| 312 | esac |
| 313 | fi |