#!/bin/bash # # Setup customer aws user on probe # if test -t 0; then Warn() { echo "$*" >> /dev/stderr; } Continue() { echo -n; } while getopts "c:p:i:" optionName; do case "$optionName" in c) CUST="$OPTARG";; p) PROBE="$OPTARG";; i) NATIP="$OPTARG";; esac done KADDR="$PROBE" fi if [ -z "$CUST" ]; then Warn "Customer required for aws key setup" Warn "$0 -c -p -i " else echo "Setting up $CUST aws user:" echo $SSH "sudo -u wia /opt/iglass/bin/mkAwsUser.sh -c -u $CUST" # This can be run any time but the customer has to be in the list of iGlass customers for it to do anything # echo $SSH "sudo -u noc /opt/iglass/bin/awsGenerateLifecycle.pl --push" if false; then if [ -z "$PROBE" ]; then Warn "Probe name required for sync keys" elif [ -z "$KADDR" ]; then Warn "Probe kickstart IP required for sync keys" else echo echo "root@monolith:" echo "cd /home/KickStart/iGlassCA" echo "NATIP=" echo "/opt/iglass/bin/mkClientCert.sh -h $PROBE -a $NATIP" echo "scp CA/iGlassCA.crt.pem clients/${PROBE}-${NATIP}.key.pem clients/${PROBE}-${NATIP}.crt.pem noc@$KADDR:/opt/iglass/conf/pki/" echo echo "noc@$KADDR:" echo "cd /opt/iglass/conf/pki/" echo "ln -s ${PROBE}-${NATIP}.crt.pem $PROBE.crt" echo "ln -s ${PROBE}-${NATIP}.crt.pem probe.crt" echo "ln -s ${PROBE}-${NATIP}.key.pem $PROBE.key" echo "ln -s ${PROBE}-${NATIP}.key.pem probe.key" echo "ln -sf iGlassCA.crt.pem iGlassCA.crt" echo "chmod 600 *" fi fi fi Continue